save_to_ts_file

save_to_ts_file(X, y=None, *, label_type=None, path='./', problem_name='data', file_suffix=None, header=None)[source]

Write an aeon collection of time series to text file in .ts format.

Write metadata and data stored in aeon compatible data set to file. A description of the .ts format available at https://www.aeon-toolkit.org/en/stable/api_reference/data_format.html.

Parameters:
X: ``aeon`` collection data format

A collection of time series cases in one of the following formats:

  • “numpy3D”: a 3D numpy ndarray of shape (n_cases, n_channels, n_timepoints)

  • “np-list”: length n_cases Python list of 2D numpy ndarray

    with shape (n_channels, n_timepoints_i)

  • “df-list”: length n_cases Python list of 2D pandas DataFrame

    with shape (n_channels, n_timepoints_i)

  • “numpy2D”: a 2D numpy ndarray of shape (n_cases, n_timepoints)

  • “pd-wide”: a 2D pandas DataFrame of shape (n_cases, n_timepoints)

  • “pd-multiindex”: a pandas DataFrame with MultiIndex, index

    [case, timepoint], columns [channel]

y: np.ndarray, pd.Series or None, default=None

The response variable if present. Must be discrete for classification, continuous for regression. None if no labels are written.

label_type: str or None, default=None

If not None, specifies the type of label, either "classification" or "regression" to ensure the correct header is written. Must be set if y is not None.

path: str, default=”./”

The directory to write the file to. If the directory does not exist, it will be created.

problem_name: string, default = “data”

The name of the problem being written to file. Used in the file metadata and file name. The file is written to {path}/{problem_name}{file_suffix}.ts.

file_suffix: str or None, default=None

If not None, this string is appended to the end of the file name, i.e. "_TRAIN" or "_TEST". The file is written to {path}/{problem_name}{file_suffix}.ts.

header: str or None, default=None

Optional text at the top of the written file. This is for information only and is ignored when loading.