load('laser_small.mat');
seed = 3;
split = 0.7;
class_col = 61;
[train, y_train, test, y_test] = ...
    split_train_test([X,Y],seed,split,class_col);
alpha = learnKernelRegERM(train,y_train,1,@dtw_kernel,0.0005);
ypredict = classKernelRegERM(alpha,train,@dtw_kernel,0.0005,test);


disp(['accuracy: ' ...
    num2str(sum(ypredict == y_test) / numel(y_test) * 100) '%']);


% visualize the data
for i = 1:5
    figure(i);
    for j = 1:10
        subplot(5,2,j);
        plot(1:size(X,2),X(((i-1) * 10) + j,:),'r');
        title(['Label: ' num2str(Y(((i-1) * 10) + j))]);
    end
end
