multi-sequential input - single sequence output #267
Replies: 3 comments 3 replies
-
Hi @razi2021, X, y, splits = get_regression_data('Covid3Month', split_data=False)
y_multi= y.reshape(-1,1).repeat(5,1) # this is to simulate sequences of 5 steps
tfms = [None, TSRegression()]
batch_tfms = TSStandardize(by_sample=True)
dls = get_ts_dls(X, y_multi, splits=splits, tfms=tfms, batch_tfms=batch_tfms)
learn = ts_learner(dls, InceptionTimePlus, metrics=mae, cbs=[ShowGraph()])
learn.fit_one_cycle(10, 1e-2)
preds = learn.get_X_preds(X)[0]
preds.shape output: torch.Size([201, 5]) |
Beta Was this translation helpful? Give feedback.
-
Hi @oguiza, Thanks for the quick reply! To contextualize, what I have in mind is a sleep staging problem: a series of heart rate and activity from a set of users and their respective sleep stage. For each timestamp, I have a tuple <person, hr, act, sleep_stage> and the goal is creating a f(hr, act) -> sleep_stage. One alternative would be using a sliding window to break my long 8 hours of sleep into small pieces. Another alternative is modeling as a seq2seq task. I decided to start by this second one first and that is why I wrote the question above. If you think there is another preprocessing approach that I should try, please let me know. The example above now generates the dataset, but does not fit correctly. It seems the batch size gets flattened somewhere: X, _, splits = get_regression_data('Covid3Month', split_data=False)
y_multi = np.random.randint(0, 2, (201, 5), dtype=np.int)
tfms = [None, TSClassification()]
batch_tfms = TSStandardize(by_sample=True)
dls = get_ts_dls(X, y_multi, splits=splits, tfms=tfms, batch_tfms=batch_tfms)
learn = ts_learner(dls, InceptionTimePlus, cbs=[ShowGraph()])
learn.fit_one_cycle(1, 1e-2)
ValueError: Expected input batch_size (64) to match target batch_size (320). Last, thank you very much for the MaskedL1Loss, good idea! :) |
Beta Was this translation helpful? Give feedback.
-
I've just updated the repo with some updated code that I believe will fix this issue. !pip install git+https://github.com/timeseriesAI/tsai.git -Uqq
# ⚠️ REMEMBER TO RESTART (NOT RECONNECT/ RESET) THE KERNEL/ RUNTIME ONCE THE INSTALLATION IS FINISHED and test it again. I have tested it with this code: X, _, splits = get_regression_data('Covid3Month', split_data=False)
y_multi = np.random.randint(0, 2, (201, 5), dtype=np.int)
tfms = [None, TSClassification()]
batch_tfms = TSStandardize(by_sample=True)
dls = get_ts_dls(X, y_multi, splits=splits, tfms=tfms, batch_tfms=batch_tfms)
learn = ts_learner(dls, InceptionTimePlus, cbs=[ShowGraph()])
learn.fit_one_cycle(1, 1e-2) and it seems to work well. |
Beta Was this translation helpful? Give feedback.
-
Hi,
Among the current TSAI models available, is there any that takes in a multi-sequential input and outputs a single sequence?
.
I'm working on a project in which there are several (let's say 13) temporal features from a fixed-term recording (let's say 120 frames) and I would like to leverage these features to predict a single sequence during that fixed-term (13by120 to 1by120). I've seen some models that take multi-seq but they don't turn a seq as the output. Please note that this is neither a classification nor a regression problem.
.
I highly appreciate your reply :)
Beta Was this translation helpful? Give feedback.
All reactions