Testing TSCU by recreating the results in an article.
This script is prepared to test the Time Series Classification Utility by recreating the last column of Table II in the following article.
Gudmundsson, Steinn, Thomas Philip Runarsson, and Sven Sigurdsson. "Support vector machines and dynamic time warping for time series." Neural Networks, 2008. IJCNN 2008.(IEEE World Congress on Computational Intelligence). IEEE International Joint Conference on. IEEE, 2008.
- Author : Huseyin Kaya
- Website: http://timewarping.org
- Sources: https://github.com/hkayabilisim/TSCU
clear all close all clc cSearch = 2.^(-5:2:15); gSearch = 2.^(-15:2:3); % Dataset error published in the article data = { 'synthetic_control' , 2.33 ,... 'Gun_Point' ,12.67 ,... 'CBF' , 4.56 ,... 'FaceAll' ,26.57 ,... 'OSULeaf' ,40.08 ,... 'SwedishLeaf' ,38.24 ,... 'Trace' , 0.00 ,... 'Two_Patterns' , 0.00 ,... 'wafer' , 3.39 ,... 'FaceFour' ,11.36 ,... 'Lighting2' ,11.48 ,... 'Lighting7' ,30.14 ,... 'ECG200' ,17.00 ,... 'Adiac' ,56.01 ,... 'yoga' ,21.87 ,... 'Fish' ,29.71 ,... 'Beef' ,60.00 ,... 'Coffee' ,17.86 ,... 'OliveOil' ,26.67 ,... }; fprintf('%-20s %-s\n' ,'' ,' SVM GDTW Error (%)'); fprintf('%-20s %-15s %-15s\n','Dataset','found by TSCU','in the Article'); fprintf('%-20s %-15s %-15s\n','-------','-------------','--------------'); for i=[1 2 18] dataname = data{2*(i-1)+1}; expected = data{2*(i-1)+2}; trn=load(sprintf('../../UCR/%s/%s_TRAIN',dataname,dataname)); tst=load(sprintf('../../UCR/%s/%s_TEST',dataname,dataname)); SVM_GDTW =tscu(trn,tst ,... 'Classifier' ,'SVM' ,... 'Alignment' ,'DTW' ,... 'SVMKernel' ,'gaussian' ,... 'SVMSoftMargin' ,cSearch ,... 'SVMGamma' ,gSearch ,... 'CrossValidation',5 ,... 'LogLevel' ,'Alert'); calculated = 100*(1-SVM_GDTW.perf.OA); fprintf('%-20s %-15.2f %-15.2f\n',dataname,calculated,expected); end
SVM GDTW Error (%) Dataset found by TSCU in the Article ------- ------------- -------------- synthetic_control 2.33 2.33 Gun_Point 12.67 12.67 Coffee 17.86 17.86