Package: timeseries-fastai
timeseries_fastaiThis repository aims to implement TimeSeries classification/regression algorithms. It makes extensive use of fastai V2!I recommend to use Ignacio'stsaifor a more complete and robust timeseries fastai based library. It is well documented and implemetns way more models that me here.InstallationYou will need to install fastai V2 fromhereand then you can do from within the environment where you installed fastai V2:pipinstalltimeseries_fastaiand you are good to go.TL;DRgitclonehttps://github.com/fastai/fastaicdfastai
condaenvcreate-fenvironment.ymlsourceactivatefastai
pipinstallfastaitimeseries_fastaiTime Series Classification from Scratch with Deep Neural Networks: A Strong BaselineThe original paper repo ishereis implemented in Keras/Tf.Notebook 01: This is a basic notebook that implements the Deep Learning models proposed inTime Series Classification from Scratch with Deep Neural Networks: A Strong Baseline.InceptionTime: Finding AlexNet for Time SeriesClassificationThe original paper repo ishereNotebook 02: Added InceptionTime architecture fromInceptionTime: Finding AlexNet for Time SeriesClassification.ResultsYou can run the benchmark using:$python ucr.py --arch='inception' --tasks='all' --filename='inception.csv' --mixup=0.2Default Values:lr= 1e-3opt= 'ranger'epochs= 40fp16= Trueresults_inception=pd.read_csv(Path.cwd().parent/'inception.csv',index_col=0)display_df(results_inception)accacc_maxtrain_lossval_losstaskACSF10.820.850.770.62Adiac0.770.770.810.89ArrowHead0.700.760.281.21BME0.850.880.210.79Beef0.770.830.500.53BeetleFly0.700.850.140.79BirdChicken0.950.950.140.20CBF0.950.970.220.24Car0.600.680.331.23Chinatown0.950.960.050.27ChlorineConcentration0.820.820.280.48CinCECGTorso0.580.600.421.60Coffee0.710.820.160.71Computers0.660.720.240.72CricketX0.720.730.490.88CricketY0.710.720.530.84CricketZ0.770.780.520.79Crop0.780.780.560.76DiatomSizeReduction0.930.960.220.22DistalPhalanxOutlineAgeGroup0.710.750.180.80DistalPhalanxOutlineCorrect0.740.780.160.57DistalPhalanxTW0.620.680.271.22ECG2000.870.910.150.30ECG50000.940.940.170.27ECGFiveDays0.920.940.140.21EOGHorizontalSignal0.360.400.632.05EOGVerticalSignal0.370.390.792.00Earthquakes0.750.750.120.89ElectricDevices0.710.720.361.20EthanolLevel0.320.360.611.81FaceAll0.770.780.460.84FaceFour0.830.890.290.57FacesUCR0.830.830.510.73FiftyWords0.670.690.701.27Fish0.830.830.451.69FordA0.950.950.180.13FordB0.830.850.160.38FreezerRegularTrain0.980.990.200.10FreezerSmallTrain0.710.810.211.54Fungi0.770.850.310.68GunPoint0.950.970.170.14GunPointAgeSpan0.970.980.250.08GunPointMaleVersusFemale1.001.000.170.02GunPointOldVersusYoung1.001.000.130.01Ham0.550.660.211.12HandOutlines0.890.910.250.29Haptics0.380.430.441.94Herring0.610.700.190.82HouseTwenty0.850.880.180.39InlineSkate0.300.310.952.05InsectEPGRegularTrain1.001.000.280.08InsectEPGSmallTrain0.801.000.490.48InsectWingbeatSound0.550.560.651.27ItalyPowerDemand0.960.960.140.16LargeKitchenAppliances0.850.860.280.69Lightning20.700.770.180.73Lightning70.710.730.461.10Mallat0.650.660.431.37Meat0.930.950.250.26MedicalImages0.720.750.400.85MelbournePedestrian0.100.10nannanMiddlePhalanxOutlineAgeGroup0.530.600.201.28MiddlePhalanxOutlineCorrect0.770.810.170.46MiddlePhalanxTW0.490.590.341.37MixedShapesRegularTrain0.930.930.350.25MixedShapesSmallTrain0.800.810.420.64MoteStrain0.750.760.090.52NonInvasiveFetalECGThorax10.920.930.660.32NonInvasiveFetalECGThorax20.930.930.590.27OSULeaf0.820.840.430.58OliveOil0.770.800.270.74PhalangesOutlinesCorrect0.810.830.170.46Phoneme0.220.220.793.25PigAirwayPressure0.120.142.334.06PigArtPressure0.470.471.252.25PigCVP0.300.331.692.97Plane1.001.000.350.07PowerCons0.980.980.170.10ProximalPhalanxOutlineAgeGroup0.830.870.220.53ProximalPhalanxOutlineCorrect0.880.890.170.34ProximalPhalanxTW0.780.800.280.78RefrigerationDevices0.500.560.271.35Rock0.580.780.291.43ScreenType0.420.430.331.41SemgHandGenderCh20.730.790.210.52SemgHandMovementCh20.350.400.431.56SemgHandSubjectCh20.520.520.391.13ShapeletSim0.991.000.140.12ShapesAll0.800.800.890.83SmallKitchenAppliances0.650.660.431.60SmoothSubspace0.960.970.230.15SonyAIBORobotSurface10.870.900.080.29SonyAIBORobotSurface20.750.790.150.54StarLightCurves0.980.980.220.09Strawberry0.970.980.150.09SwedishLeaf0.940.940.520.27Symbols0.830.870.390.61SyntheticControl1.001.000.310.04ToeSegmentation10.930.970.160.17ToeSegmentation20.880.910.150.27Trace1.001.000.290.02TwoLeadECG0.910.920.100.26TwoPatterns1.001.000.250.01UMD0.920.940.250.26UWaveGestureLibraryAll0.910.910.410.31UWaveGestureLibraryX0.820.820.460.56UWaveGestureLibraryY0.730.730.500.78UWaveGestureLibraryZ0.740.740.480.72Wafer1.001.000.050.01Wine0.480.630.191.07WordSynonyms0.620.620.611.60Worms0.770.780.410.70WormsTwoClass0.730.810.220.56Yoga0.860.860.240.33Getting Startedfromtimeseries_fastai.importsimport*fromtimeseries_fastai.coreimport*fromtimeseries_fastai.dataimport*fromtimeseries_fastai.modelsimport*PATH=Path.cwd().parentdf_train,df_test=load_df_ucr(PATH,'Adiac')Loading files from: /home/tcapelle/SteadySun/timeseries_fastai/Adiacx_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(1,1e-3)epoch     train_loss  valid_loss  accuracy  time    
0         3.934007    3.640701    0.043478  00:03