/Time-series-classification

Source code for a paper using Mahalanobis distances for time series classification.

Primary LanguageMATLAB

HOWTO for reproducing the results in the paper
Zoltan Prekopcsak, Daniel Lemire: Time Series Classification by Class-Specific Mahalanobis Distance Measures

Preliminaries:
- the Keogh benchmark[1] should be placed in a directory called 'dataset'
- the mLMNN package[2] should be in the Matlab path (File/Set path)
- the data.mat file has to be loaded to Matlab

The results in Table 2 can be reproduced by the following commands column by column:
looper(data,'gmahalanobis',Inf,'euc',1)
looper(data,'mahalanobis',Inf,'euc',1)
looper(data,'gmahalanobis',0,'euc',1)
looper(data,'mahalanobis',0,'euc',1)

The results in Table 3 can be reproduced by the following commands column by column:
looper(data,'ones',0,'euc',1)
looper(data,'ones',0,'dtw',1)
looper(data,'mahalanobis',Inf,'euc',1)
looper(data,'mahalanobis',0,'euc',1)
looper_lmnn2(data(2:17),'global',1)

For Figure 3, first the synthetic data needs to be generated by calling 'python generatedata.py'.
Then e.g. the CC results can be reproduced by the following command:
looper_synth('CC',[10 20 50 100 200 500 1000],'ones',0,'euc',1)
looper_synth('CC',[10 20 50 100 200 500 1000],'mahalanobis',0,'euc',1)
This calculates results for all 10 random sets of all training sizes,
and we have presented the average of these runs on Figure 3.
Results for Waveform and KEOGHCBF can be obtained the same way.

[1] http://www.cs.ucr.edu/~eamonn/time_series_data/
[2] http://www.cse.wustl.edu/~kilian/Downloads/LMNN.html