--- title: Label-mixing transforms keywords: fastai sidebar: home_sidebar summary: "Callbacks that perform data augmentation by mixing samples in different ways." description: "Callbacks that perform data augmentation by mixing samples in different ways." nb_path: "nbs/018_data.mixed_augmentation.ipynb" ---
from fastai.learner import *
from tsai.models.InceptionTime import *
from tsai.data.external import get_UCR_data
from tsai.data.core import get_ts_dls, TSCategorize
from tsai.data.preprocessing import TSStandardize
from tsai.learner import ts_learner
X, y, splits = get_UCR_data('NATOPS', return_split=False)
tfms = [None, TSCategorize()]
batch_tfms = TSStandardize()
dls = get_ts_dls(X, y, tfms=tfms, splits=splits, batch_tfms=batch_tfms)
learn = ts_learner(dls, InceptionTime, cbs=MixUp1d(0.4))
learn.fit_one_cycle(1)
X, y, splits = get_UCR_data('NATOPS', split_data=False)
tfms = [None, TSCategorize()]
batch_tfms = TSStandardize()
dls = get_ts_dls(X, y, tfms=tfms, splits=splits, batch_tfms=batch_tfms)
learn = ts_learner(dls, InceptionTime, cbs=IntraClassCutMix1d())
learn.fit_one_cycle(1)
X, y, splits = get_UCR_data('NATOPS', split_data=False)
tfms = [None, TSCategorize()]
batch_tfms = TSStandardize()
dls = get_ts_dls(X, y, tfms=tfms, splits=splits, batch_tfms=batch_tfms)
learn = ts_learner(dls, cbs=CutMix1d(1.))
learn.fit_one_cycle(1)