A timeseries lib on top of fastai2
Project description
timeseries_fastai
This repository aims to implement TimeSeries classification/regression algorithms. It makes extensive use of fastai V2!
Installation
You will need to install fastai V2 from here and then you can do from within the environment where you installed fastai V2:
pip install timeseries_fastai
and you are good to go.
TL;DR
git clone https://github.com/fastai/fastai2
cd fastai2
conda env create -f environment.yml
source activate fastai2
pip install fastai2 timeseries_fastai
Time Series Classification from Scratch with Deep Neural Networks: A Strong Baseline
The original paper repo is here is implemented in Keras/Tf.
- Notebook 01: This is a basic notebook that implements the Deep Learning models proposed in Time Series Classification from Scratch with Deep Neural Networks: A Strong Baseline.
InceptionTime: Finding AlexNet for Time SeriesClassification
The original paper repo is here
- Notebook 02: Added InceptionTime architecture from InceptionTime: Finding AlexNet for Time SeriesClassification.
Results
You can run the benchmark using:
$python ucr.py --arch='inception' --tasks='all' --filename='inception.csv' --mixup=0.2
Default Values:
lr
= 1e-3opt
= 'ranger'epochs
= 40fp16
= True
import pandas as pd
from pathlib import Path
results_inception = pd.read_csv(Path.cwd().parent/'inception.csv', index_col=0)
results_inception.head(10)
<style scoped>
.dataframe tbody tr th:only-of-type {
vertical-align: middle;
}
.dataframe tbody tr th {
vertical-align: top;
}
.dataframe thead th {
text-align: right;
}
</style>
acc | acc_max | train_loss | val_loss | |
---|---|---|---|---|
task | ||||
Adiac | 0.83 | 0.83 | 1.54 | 1.31 |
ArrowHead | 0.84 | 0.89 | 0.47 | 0.60 |
Beef | 0.57 | 0.60 | 1.22 | 1.27 |
BeetleFly | 0.85 | 1.00 | 0.29 | 0.38 |
BirdChicken | 0.80 | 0.95 | 0.25 | 0.55 |
Car | 0.85 | 0.85 | 0.58 | 0.74 |
CBF | 0.99 | 1.00 | 0.44 | 0.37 |
ChlorineConcentration | 0.77 | 0.77 | 0.61 | 0.70 |
CinCECGTorso | 0.65 | 0.68 | 0.64 | 1.06 |
Coffee | 1.00 | 1.00 | 0.33 | 0.21 |
Getting Started
from timeseries_fastai.imports import *
from timeseries_fastai.core import *
from timeseries_fastai.data import *
from timeseries_fastai.models import *
PATH = Path.cwd().parent
df_train, df_test = load_df_ucr(PATH, 'Adiac')
Loading files from: /home/tc256760/Documents/timeseries_fastai/Adiac
x_cols = df_train.columns[0:-2].to_list()
dls = TSDataLoaders.from_dfs(df_train, df_test, x_cols=x_cols, label_col='target', bs=16)
dls.show_batch()
inception = create_inception(1, len(dls.vocab))
learn = Learner(dls, inception, metrics=[accuracy])
learn.fit_one_cycle(5, 1e-3)
epoch | train_loss | valid_loss | accuracy | time |
---|---|---|---|---|
0 | 3.948751 | 3.637887 | 0.028133 | 00:02 |
1 | 3.705492 | 3.507715 | 0.094629 | 00:02 |
2 | 3.418483 | 5.099520 | 0.038363 | 00:02 |
3 | 3.108469 | 2.665389 | 0.248082 | 00:02 |
4 | 2.820438 | 2.508861 | 0.304348 | 00:02 |
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
timeseries_fastai-0.0.3.tar.gz
(16.9 kB
view hashes)
Built Distribution
Close
Hashes for timeseries_fastai-0.0.3-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 905e1782a4bbb9e6215689685e070c9dcc936cb4878494b0cf792971c96f580a |
|
MD5 | e131a300bbb35399cfa17afd3f760565 |
|
BLAKE2b-256 | 5610288797839f016dd7e09e0ca120ad8dc4b95ba2a9fad441d0b97c6e415d68 |