timeseriesAI / tsai

Time series Timeseries Deep Learning Machine Learning Python Pytorch fastai | State-of-the-art Deep Learning library for Time Series and Sequences in Pytorch / fastai
https://timeseriesai.github.io/tsai/
Apache License 2.0
5.07k stars 633 forks source link

how can I train without a val_set? thanks #671

Closed jarvis1890 closed 1 year ago

oguiza commented 1 year ago

Hi @jarvis1890, Both fastai and tsai are built with the idea of using a validation set. However, there's an easy hack you can use, and it's to pass [0] as your validation split and disregard the validation metrics. Here's an example of how this could work:

from tsai.basics import *
X, y, _ = get_UCR_data('LSST', split_data=False)
splits = (np.arange(len(y)), [0])
tfms = [None, TSClassification()]
batch_tfms = TSStandardize(by_sample=True)
dls = get_ts_dls(X, y, splits=splits, tfms=tfms, batch_tfms=batch_tfms)
learn = ts_learner(dls, metrics=accuracy, cbs=[ShowGraph()], train_metrics=True)
learn.fit_one_cycle(10, 1e-2)
oguiza commented 1 year ago

I've modified the dataloaders so you no longer need to pass a validation or test set. You can just pass any of the following:

oguiza commented 1 year ago

I'll close this issue due to the lack of response.