TRAKR – A reservoir-based tool for fast and accurate classification of neural time-series patterns

1 INTRODUCTION . The size and complexity of neural data collected has increased greatly ( Marblestone et al . ( 2013 ) ) . Neural data display rich dynamics in the firing patterns of neurons across time , resulting from the recurrently connected circuitry in the brain . As our insight into these dynamics increases through new recording modalities , so does the desire to understand how dynamical patterns change across time and , ultimately , give rise to different behaviors . A lot of work in computational neuroscience over the past decade has focused on modeling the collective dynamics of a population of neurons in order to gain insight into how firing patterns are related to task variables ( Márton et al . ( 2020 ) ; Richards et al . ( 2019 ) ; Yang et al . ( 2018 ) ; Remington et al . ( 2018 ) ; Kell et al . ( 2018 ) ; Zeng et al . ( 2018 ) ; Pandarinath et al . ( 2018 ) ; Durstewitz ( 2017 ) ; Chaisangmongkon et al . ( 2017 ) ; Rajan et al . ( 2016 ) ; Sussillo et al . ( 2015 ) ; Mante et al . ( 2013 ) ; Sussillo & Barak ( 2013 ) ; Barak et al . ( 2013 ) ; Sussillo & Abbott ( 2009 ) ) . These approaches , however , rely on fitting the whole dynamical system through many rounds of optimization , either indirectly by modeling the task inputs and outputs ( Márton et al . ( 2020 ) ; Kell et al . ( 2018 ) ; Chaisangmongkon et al . ( 2017 ) ; Sussillo et al . ( 2015 ) ; Mante et al . ( 2013 ) ; Sussillo & Barak ( 2013 ) , or directly by fitting the weights of a neural network to recorded firing patterns ( Pandarinath et al . ( 2018 ) ; Durstewitz ( 2017 ) ) . Thus , these approaches can be too time- and computation-intensive for certain applications , e.g . in clinical settings where decisions need to be taken based on recordings in real-time . In these settings , neural time-series patterns need to be accurately distinguished in order to , say , detect the onset of seizures , or distinguish different mental states . Previous approaches to classifying time series lie on a spectrum from simple distance metrics ( e.g. , Euclidean ) to more computationally intensive approaches such as dynamic time warping ( Xing et al . ( 2010 ) ) , ensembles of classifiers ( Bagnall et al . ) or deep supervised learning ( Jeong ( 2020 ) ; Fawaz et al . ( 2019 ) ) . Computing simple distance metrics is fast and straightforward , but does not always yield high accuracy results because the patterns may not be perfectly aligned in time . On the other end of the spectrum , ensembles of classifiers and deep learning-based approaches ( Bagnall et al . ; Jeong ( 2020 ) ; Fawaz et al . ( 2019 ) ) have been developed that can offer high accuracy results , but at high computational cost . Dynamic time warping ( DTW ) has been consistently found to offer good results in practice relative to computational cost ( Fawaz et al . ( 2019 ) ; Bagnall et al . ( 2016 ) ; Serrà & Arcos ( 2014 ) ) and is currently routinely used to measure the similarity of time-series patterns . Previous work in reservoir computing has shown that networks of neurons can be used as reservoirs of useful dynamics , so called echo-state networks ( ESNs ) , without the need to train recurrent weights through successive rounds of expensive optimization ( Vlachas et al . ( 2020 ) ; Pathak et al . ( 2018 ) ; Vincent-Lamarre et al . ( 2016 ) ; Buonomano & Maass ( 2009 ) ; Jaeger & Haas ( 2004 ) ; Jaeger ( a ; b ) ; Maass et al . ( 2002 ) ) . This suggests reservoir networks could offer a computationally cheaper alternative to deep supervised approaches in the classification of neural time-series data . However , the training of reservoir networks has been found to be more unstable compared to methods that also adjust the recurrent connections ( e.g. , via backpropagation through time , BPTT ) in the case of reduced-order data ( Vlachas et al . ( 2020 ) ) . Even though ESNs have been shown to yield good results when fine-tuned ( Tanisaro & Heidemann ( 2016 ) ; Aswolinskiy et al . ( 2016 ) ) , convergence represents a significant problem when training ESNs end-to-end to perform classification on complex time-series datasets , and is a hurdle to their wider adoption . Here , we propose fitting the reservoir output weights to a single time series - thus avoiding many rounds of training that increase training time and could potentially cause instabilities . We use the error generated through the output unit in response to a particular test pattern as input to a classifier . We show that using this approach , we obtain high accuracy results on a benchmark dataset - sequential MNIST - outperforming other approaches such as simple distance metrics ( e.g. , based on Euclidean distance or Mutual Information ) and a previous approach based on echo-state networks , while performing on par with deep supervised networks . We also show that our approach is more robust to noise than other approaches , in particular deep supervised networks . At the same time , TRAKR achieves high performance while keeping training and inference time low . We also apply our tool , TRAKR , to neural data from the macaque orbitofrontal cortex ( OFC ) , a higher-order brain region involved in encoding expectations , and inducing changes in behavior during unexpected outcomes ( Rich & Wallis ( 2016 ) ; Rudebeck & Rich ( 2018 ) ; Jones et al . ( 2012 ) ; Wallis ( 2012 ) ; Schoenbaum ( 2009 ) ; Burke et al . ( 2009 ) ; Wallis & Miller ( 2003 ) ; Schoenbaum et al . ( 1998 ) ) . This data consists of 128-channel electrocorticography ( micro-ECOG ) recordings obtained from the macaque OFC , including anterior and posterior areas 11 and 13 , during a reward expectation task . The task was designed to understand if and how expectations encoded in OFC are updated by unexpected outcomes . TRAKR is able to distinguish three different behaviorally relevant epochs based on the neural time-series with high accuracy , revealing that OFC units differentiate between different task episodes . This shows it can be used as a reliable tool to gain further insight into the information encoded in neural circuits . Taken together , we make the following contributions : - We show that by fitting single time series and working with the error signal reservoirs can perform on par with supervised deep networks in time series classification - We show that this approach , while easy to use , outperforms other commonly used approaches , such as Dynamic Time Warping ( DTW ) , and other distance measures embraced for their simplicity - We show that our approach is more robust to noise than other approaches - Our approach is computationally less expensive than other approaches , achieving high performance at low train- and inference- time - It is able to detect differences between neural patterns with high accuracy Altogether , this shows that TRAKR is a viable alternative to state-of-the-art approaches for time series classification . 2 METHODS . 2.1 MODEL DETAILS . TRAKR ( Figure 1A ) is a reservoir-based recurrent neural network ( RNN ) with N recurrently connected neurons . Recurrent weights , J , are initialized randomly and remain aplastic over time ( Buonomano & Maass ( 2009 ) ; Jaeger ( b ) ; Maass et al . ( 2002 ) ) . The readout unit , zout , is connected to the reservoir through a set of output weights , wout , which are plastic and are adjusted during training . The reservoir also receives an input signal , I ( t ) , through an aplastic set of weights win . The network is governed by the following equations : τ dxi ( t ) dt = −xi ( t ) + g N∑ j=1 Jijϕj ( t ) + wi , inI ( t ) ( 1 ) zout ( t ) = ∑ i wout , i ( t ) xi ( t ) ( 2 ) Here , xi ( t ) is the activity of a single neuron in the reservoir , τ is the integration time constant , g is the gain setting the scale for the recurrent weights , and J is the recurrent weight matrix of the reservoir . The term g N∑ j=1 Jijϕj ( t ) denotes the strength of input to a particular neuron from other neurons in the reservoir and I ( t ) is the input signal ( Equation 1 ) . zout ( t ) denotes the activity of the readout unit together with the output weights , wout ( Equation 2 ) . In our notation , wij denote the weight from neuron j to i , and so wout , i means the weight from ith unit in the reservoir to the readout unit . ϕ is the activation function given by : ϕi ( t ) = tanh ( xi ( t ) ) ( 3 ) We use recursive least squares ( RLS ) to adjust the output weights , wout during training ( Haykin , Simon S. ( 1996 ) ) . The algorithm and the update rules are given by : ∆wout , i ( t ) = −η ( zout ( t ) − f ( t ) ) ∑ j Pij ( t ) ϕj ( t ) ( 4 ) wout , i ( t ) = wout , i ( t− 1 ) + ∆wout , i ( t ) ( 5 ) Here , η is the learning rate , f ( t ) is the target function , and the term ∑ j Pij ( t ) ϕj ( t ) acts as a regularizer where P is the inverse cross-correlation matrix of the network firing rates . For details on setting hyperparameters , see Appendix A . 2.2 ADJUSTING RESERVOIR DYNAMICS . During training , the output weights , wout , are optimized using RLS based on the instantaneous difference between the output , zout ( t ) , and the target function , f ( t ) . This optimization is performed in one shot ( without the need for multiple optimization rounds ) . Here , we use the reservoir to autoencode the input signal , thus f ( t ) = I ( t ) . The instantaneous difference gives rise to an error term , E ( t ) , calculated as : E ( t ) = N∑ i=1 ∆wout , i ( t ) ( 6 ) 2.3 OBTAINING THE ERROR SIGNAL . After training , the output weights , wout are frozen . The test pattern is fed to the network via the input , I ( t ) , and the network is iterated to obtain the error , E ( t ) over the duration of the test signal . The error , E ( t ) is computed as the difference between the test signal and the network output ( Equation 6 ) . The error may vary depending on the similarity of a given test signal to the learned time series . The error is used as input to a classifier .

Summary: The paper proposes a new method to classify neural time-series. The method is based on a recurrent reservoir, which includes a black box function (here a fixed random RNN) and a linear readout. The black box function produces an state vector at each time point of an input time-series. This state vector is then transformed with a linear readout, trained to reconstruct the input signal. In other words, the reservoir is an auto-encoder with a fixed random RNN encoder and a linear decoder trained to minimize the reconstruction error. The method then uses the reconstruction error of the reservoir as a representation of the signal, to be used in a RBF-kernel SVM classifier and perform a given task.  On a simple toy example, the authors show that the reservoir can learn to reconstruct a sinusoid signal, and that it fails to reconstruct a sinusoid with a frequency different than during training. This failure can be considered useful to identify regimes different that the ones seen during training. The method is then used on a small MNIST datasest, training the reservoir on one sample, and then training an SVM classifier on all samples based on the reconstruction error of the reservoir. The method is then compared with four baseline methods. Finally, the method is applied to neural recordings of a macaque OFC, training the reservoir on one epoch, and then training a classifier to predict behavioral states.