CNN TSC

A CNN for time-series classification

View the Project on GitHub RobRomijnders/CNN_tsc

A Convolutional Neural Network for time-series classification

This post implements a CNN for time-series classification and benchmarks the performance on three of the UCR time-series.

CNN's are widely used for applications involving images. In this post, I show their performance on time-series. This project is a rebound after this implementation of LSTM's on the same data. The LSTM's only got 60% test-accuracy, whereas state-of-the-art is 99.8% test-accuracy.

Mechanism

Many of our knowledge and intuition for CNN's on images carry over to time-series. The main difference in the code is the stride argument we pass to the conv-layer. We want the kernel to stride along the time-series, but not along the second dimension that we would have used for images.

Batchnorm

This projects is also a showcase of batch normalization after the conv-layers. With help of this post on StackOverflow, the code is equipped with three batch-norm layers.

A small code-snippet for illustration:

ewma = tf.train.ExponentialMovingAverage(decay=0.99)                  
bn_conv1 = ConvolutionalBatchNormalizer(num_filt_1, 0.001, ewma, True)           
update_assignments = bn_conv1.get_assigner() 
a_conv1 = bn_conv1.normalize(a_conv1, train=bn_train)

Performance

We benchmark the implementation on the datasets from UCR. Specifically, we achieve 99.9% and 84.9% test-accuracy on Two_Patterns and ChlorineConcentration. Both performances have remarkable consequences.

As of 10-April-'16, we also achieve 91.0% test-accuracy for FaceAll, while this article reporting 89.5% as best performance

Results

The graph of the CNN: Graph The evolution of accuracies based on a run with ChlorineConcentration Accuracies Showcase of TensorBoard TensorBoard

As always, I am curious to any comments and questions. Reach me at romijndersrob@gmail.com