scitex_ml.sklearn.to_sktime
Functions
|
Converts a dataset to a format compatible with sktime, encapsulating each sample as a pandas DataFrame. |
- scitex_ml.sklearn.to_sktime.to_sktime_df(X)[source]
Converts a dataset to a format compatible with sktime, encapsulating each sample as a pandas DataFrame.
Arguments: - X (numpy.ndarray or torch.Tensor or pandas.DataFrame): The input dataset with shape (n_samples, n_chs, seq_len).
It should be a 3D array-like structure containing the time series data.
Return: - sktime_df (pandas.DataFrame): A DataFrame where each element is a pandas Series representing a univariate time series.
Data Types and Shapes: - If X is a numpy.ndarray, it should have the shape (n_samples, n_chs, seq_len). - If X is a torch.Tensor, it should have the shape (n_samples, n_chs, seq_len) and will be converted to a numpy array. - If X is a pandas.DataFrame, it is assumed to already be in the correct format and will be returned as is.
References: - sktime: https://github.com/alan-turing-institute/sktime
Examples:
>>> X_np = np.random.rand(64, 160, 1024) >>> sktime_df = to_sktime_df(X_np) >>> type(sktime_df) <class 'pandas.core.frame.DataFrame'>