Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to use the data I've prepared for training #867

Open
642721838 opened this issue Dec 12, 2023 · 3 comments
Open

How to use the data I've prepared for training #867

642721838 opened this issue Dec 12, 2023 · 3 comments

Comments

@642721838
Copy link

In timeseriesAI, all the demos use predefined datasets, such as get_UCR_data(dsid, return_split=False). If you want to use your own prepared data, how can you call it before data reading and processing?

@aaalvinnn
Copy link

aaalvinnn commented Dec 15, 2023

u can try this way:

import numpy as np
DATA_PATH = './npydata/'
# read dataset
X_train = np.load(DATA_PATH + 'X_train.npy')
y_train = np.load(DATA_PATH + 'y_train.npy')
X_test = np.load(DATA_PATH + 'X_test.npy')
y_test = np.load(DATA_PATH + 'y_test.npy')

# convert to dataloader
X, y, splits = combine_split_data([X_train, X_test], [y_train, y_test])
tfms  = [None, [Categorize()]]
dsets = TSDatasets(X, y, tfms=tfms, splits=splits, inplace=True)
dls = TSDataLoaders.from_dsets(dsets.train, dsets.valid, bs=64, batch_tfms=[TSStandardize()], num_workers=0)

where DATA_PATH is ur dataset with numpy form.
Whats more, tsai library has specific format requirements for input data (such as X_train and X_test here). u can check this from their Tutorial: https://timeseriesai.github.io/tsai/tutorials.html

@Albertccy
Copy link

TypeError Traceback (most recent call last)
Cell In[81], line 13
10 X, y, splits = combine_split_data([X_train, X_test], [y_train, y_test])
11 tfms = [None, [Categorize()]]
---> 13 dsets = TSDatasets(X, y, tfms=tfms, splits=splits, inplace=True)
14 dls = TSDataLoaders.from_dsets(dsets.train, dsets.valid, bs=64, batch_tfms=[TSStandardize()], num_workers=0)

TypeError: unhashable type: 'numpy.ndarray'

then I have this error when I used your sentence.could you do me a favor that what I should do?thanks a lot.

@aayushukla
Copy link

Hey I am also facing this same issue. Were you able to resolve it? @Albertccy

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants