• Stars
    star
    240
  • Rank 168,229 (Top 4 %)
  • Language
    Jupyter Notebook
  • License
    Apache License 2.0
  • Created about 5 years ago
  • Updated about 2 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

fastai V2 implementation of Timeseries classification papers.

timeseries_fastai

This repository aims to implement TimeSeries classification/regression algorithms. It makes extensive use of fastai V2!

I recommend to use Ignacio's tsai for a more complete and robust timeseries fastai based library. It is well documented and implemetns way more models that me here.

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/fastai
cd fastai
conda env create -f environment.yml
source activate fastai
pip install fastai 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.

InceptionTime: Finding AlexNet for Time SeriesClassification

The original paper repo is here

Results

You can run the benchmark using:

$python ucr.py --arch='inception' --tasks='all' --filename='inception.csv' --mixup=0.2

Default Values:

  • lr = 1e-3
  • opt = 'ranger'
  • epochs = 40
  • fp16 = True
results_inception = pd.read_csv(Path.cwd().parent/'inception.csv', index_col=0)
display_df(results_inception)
acc acc_max train_loss val_loss
task
ACSF1 0.82 0.85 0.77 0.62
Adiac 0.77 0.77 0.81 0.89
ArrowHead 0.70 0.76 0.28 1.21
BME 0.85 0.88 0.21 0.79
Beef 0.77 0.83 0.50 0.53
BeetleFly 0.70 0.85 0.14 0.79
BirdChicken 0.95 0.95 0.14 0.20
CBF 0.95 0.97 0.22 0.24
Car 0.60 0.68 0.33 1.23
Chinatown 0.95 0.96 0.05 0.27
ChlorineConcentration 0.82 0.82 0.28 0.48
CinCECGTorso 0.58 0.60 0.42 1.60
Coffee 0.71 0.82 0.16 0.71
Computers 0.66 0.72 0.24 0.72
CricketX 0.72 0.73 0.49 0.88
CricketY 0.71 0.72 0.53 0.84
CricketZ 0.77 0.78 0.52 0.79
Crop 0.78 0.78 0.56 0.76
DiatomSizeReduction 0.93 0.96 0.22 0.22
DistalPhalanxOutlineAgeGroup 0.71 0.75 0.18 0.80
DistalPhalanxOutlineCorrect 0.74 0.78 0.16 0.57
DistalPhalanxTW 0.62 0.68 0.27 1.22
ECG200 0.87 0.91 0.15 0.30
ECG5000 0.94 0.94 0.17 0.27
ECGFiveDays 0.92 0.94 0.14 0.21
EOGHorizontalSignal 0.36 0.40 0.63 2.05
EOGVerticalSignal 0.37 0.39 0.79 2.00
Earthquakes 0.75 0.75 0.12 0.89
ElectricDevices 0.71 0.72 0.36 1.20
EthanolLevel 0.32 0.36 0.61 1.81
FaceAll 0.77 0.78 0.46 0.84
FaceFour 0.83 0.89 0.29 0.57
FacesUCR 0.83 0.83 0.51 0.73
FiftyWords 0.67 0.69 0.70 1.27
Fish 0.83 0.83 0.45 1.69
FordA 0.95 0.95 0.18 0.13
FordB 0.83 0.85 0.16 0.38
FreezerRegularTrain 0.98 0.99 0.20 0.10
FreezerSmallTrain 0.71 0.81 0.21 1.54
Fungi 0.77 0.85 0.31 0.68
GunPoint 0.95 0.97 0.17 0.14
GunPointAgeSpan 0.97 0.98 0.25 0.08
GunPointMaleVersusFemale 1.00 1.00 0.17 0.02
GunPointOldVersusYoung 1.00 1.00 0.13 0.01
Ham 0.55 0.66 0.21 1.12
HandOutlines 0.89 0.91 0.25 0.29
Haptics 0.38 0.43 0.44 1.94
Herring 0.61 0.70 0.19 0.82
HouseTwenty 0.85 0.88 0.18 0.39
InlineSkate 0.30 0.31 0.95 2.05
InsectEPGRegularTrain 1.00 1.00 0.28 0.08
InsectEPGSmallTrain 0.80 1.00 0.49 0.48
InsectWingbeatSound 0.55 0.56 0.65 1.27
ItalyPowerDemand 0.96 0.96 0.14 0.16
LargeKitchenAppliances 0.85 0.86 0.28 0.69
Lightning2 0.70 0.77 0.18 0.73
Lightning7 0.71 0.73 0.46 1.10
Mallat 0.65 0.66 0.43 1.37
Meat 0.93 0.95 0.25 0.26
MedicalImages 0.72 0.75 0.40 0.85
MelbournePedestrian 0.10 0.10 nan nan
MiddlePhalanxOutlineAgeGroup 0.53 0.60 0.20 1.28
MiddlePhalanxOutlineCorrect 0.77 0.81 0.17 0.46
MiddlePhalanxTW 0.49 0.59 0.34 1.37
MixedShapesRegularTrain 0.93 0.93 0.35 0.25
MixedShapesSmallTrain 0.80 0.81 0.42 0.64
MoteStrain 0.75 0.76 0.09 0.52
NonInvasiveFetalECGThorax1 0.92 0.93 0.66 0.32
NonInvasiveFetalECGThorax2 0.93 0.93 0.59 0.27
OSULeaf 0.82 0.84 0.43 0.58
OliveOil 0.77 0.80 0.27 0.74
PhalangesOutlinesCorrect 0.81 0.83 0.17 0.46
Phoneme 0.22 0.22 0.79 3.25
PigAirwayPressure 0.12 0.14 2.33 4.06
PigArtPressure 0.47 0.47 1.25 2.25
PigCVP 0.30 0.33 1.69 2.97
Plane 1.00 1.00 0.35 0.07
PowerCons 0.98 0.98 0.17 0.10
ProximalPhalanxOutlineAgeGroup 0.83 0.87 0.22 0.53
ProximalPhalanxOutlineCorrect 0.88 0.89 0.17 0.34
ProximalPhalanxTW 0.78 0.80 0.28 0.78
RefrigerationDevices 0.50 0.56 0.27 1.35
Rock 0.58 0.78 0.29 1.43
ScreenType 0.42 0.43 0.33 1.41
SemgHandGenderCh2 0.73 0.79 0.21 0.52
SemgHandMovementCh2 0.35 0.40 0.43 1.56
SemgHandSubjectCh2 0.52 0.52 0.39 1.13
ShapeletSim 0.99 1.00 0.14 0.12
ShapesAll 0.80 0.80 0.89 0.83
SmallKitchenAppliances 0.65 0.66 0.43 1.60
SmoothSubspace 0.96 0.97 0.23 0.15
SonyAIBORobotSurface1 0.87 0.90 0.08 0.29
SonyAIBORobotSurface2 0.75 0.79 0.15 0.54
StarLightCurves 0.98 0.98 0.22 0.09
Strawberry 0.97 0.98 0.15 0.09
SwedishLeaf 0.94 0.94 0.52 0.27
Symbols 0.83 0.87 0.39 0.61
SyntheticControl 1.00 1.00 0.31 0.04
ToeSegmentation1 0.93 0.97 0.16 0.17
ToeSegmentation2 0.88 0.91 0.15 0.27
Trace 1.00 1.00 0.29 0.02
TwoLeadECG 0.91 0.92 0.10 0.26
TwoPatterns 1.00 1.00 0.25 0.01
UMD 0.92 0.94 0.25 0.26
UWaveGestureLibraryAll 0.91 0.91 0.41 0.31
UWaveGestureLibraryX 0.82 0.82 0.46 0.56
UWaveGestureLibraryY 0.73 0.73 0.50 0.78
UWaveGestureLibraryZ 0.74 0.74 0.48 0.72
Wafer 1.00 1.00 0.05 0.01
Wine 0.48 0.63 0.19 1.07
WordSynonyms 0.62 0.62 0.61 1.60
Worms 0.77 0.78 0.41 0.70
WormsTwoClass 0.73 0.81 0.22 0.56
Yoga 0.86 0.86 0.24 0.33

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/tcapelle/SteadySun/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()

png

inception = create_inception(1, len(dls.vocab))
learn = Learner(dls, inception, metrics=[accuracy])
learn.fit_one_cycle(1, 1e-3)
epoch     train_loss  valid_loss  accuracy  time    
0         3.934007    3.640701    0.043478  00:03     

More Repositories

1

apple_m1_pro_python

A collection of ML scripts to test the M1 Pro MacBook Pro
Jupyter Notebook
165
star
2

termGPT

A simple wrapper to call openAI's chatGPT on the terminal written in Python
Python
78
star
3

llm_recipes

A set of scripts and notebooks on LLM finetunning and dataset creation
Jupyter Notebook
57
star
4

metnet_pytorch

A MetNet implementation in Pytorch and fastai
Jupyter Notebook
31
star
5

cloud_diffusion

Diffusion on the Clouds: Short-term solar energy forecasting with Diffusion Models
Python
30
star
6

moving_mnist

Exploring Moving Mnist dataset with forecasting algorithms
Jupyter Notebook
30
star
7

action_recognition

Solving UCF-101 with fastai2
Jupyter Notebook
28
star
8

fastai_timm

Exploring fastai and timm integration for model finetune
Jupyter Notebook
22
star
9

whisper

Exporting youtube videos using whisper
Jupyter Notebook
17
star
10

mixtral

Mixtral finetuning
Jupyter Notebook
17
star
11

solar_seg

Solar segmentation of PV modules
Jupyter Notebook
8
star
12

resnet_checkpoints

Exploring gradient chekcpoints resnets with fastai V2
Jupyter Notebook
7
star
13

torch_moving_mnist

A simple Dataset generator for Moving Mnist
Jupyter Notebook
7
star
14

eclipse_pytorch

My take on ECLIPSE solar nowcasting DL paper
Jupyter Notebook
7
star
15

gpt_translate

Translate a docodile website using GPT4
Python
6
star
16

pokepalette

A color library based on pokemons colors!
Python
5
star
17

torchdata

Exploring new PyTorch 1.11 data API
Jupyter Notebook
5
star
18

shear

Shear and Pruning of LLMs
Python
4
star
19

cloud_segmentation

A simple segmentation model on public images, with wandb support
Jupyter Notebook
3
star
20

hydra_net

A simple HydraNet for depth and segmentation
Jupyter Notebook
3
star
21

hackercup_rag

A simple RAG pipeline to get you started
Python
3
star
22

ETHz

A repo for the tools needed for the Hackathon
Jupyter Notebook
2
star
23

wandbot_llm

A OSS LLM trained on wandb API
Jupyter Notebook
2
star
24

Julia

Julia notebooks presented today
Jupyter Notebook
2
star
25

fmnist

A benchmark on Fashion MNIST
Jupyter Notebook
2
star
26

mini_llm

A minimal training/eval LLM repo
Python
2
star
27

tcapelle.github.io

my website
Jupyter Notebook
2
star
28

dummy_docs

A repo with some docs
2
star
29

TGS

TGS kagle challenge
Jupyter Notebook
2
star
30

diffuser

Experimenting with SD
Jupyter Notebook
1
star
31

langchain_explore

A simple repo to try some stuff with langchain
Jupyter Notebook
1
star
32

fastwandb

A collection of wandb functions
Jupyter Notebook
1
star
33

pytranus

Python implementation of Tranus
HTML
1
star
34

wids

wids dehazed comp from kaggle
Jupyter Notebook
1
star
35

jupyter_tutorial

Basic nbdev tutorial
Jupyter Notebook
1
star
36

lrp

Codes from article Location and Routing Problem with PD
Python
1
star
37

CV

CV in Latex
TeX
1
star
38

aws_smsl_demo

AV segmentation in SageMaker Studio Lab
Jupyter Notebook
1
star
39

tabular_image_models

A fastai based repo to ensemble image and tabular data.
Jupyter Notebook
1
star
40

simple-translate-action

A simple github Action to translate files
1
star
41

eval_vlm

A quick eval of recent Llama 3.2
Jupyter Notebook
1
star