Skip to content

marcovisentin/Decoding_monkey_thoughts

Repository files navigation

Decoding_monkey_thoughts

The purpose of this project was to develop a decoding algorithm that predicts arm movement trajectory in the x- and y- directions. The data used to accomplish this were obtained from the motor cortex of a monkey trained to perform arm movements at 8 different angles. Neural spiking from 98 electrodes was recorded in 100 trials for each movement. Hand positions in space were also recorded for the duration of movement. This information, once processed, was used as training data to drive a hypothetical prosthetic device. In this report, the project was divided into 2 stages: angle classification and trajectory prediction.

Preprocessing: The dataset given for the development of the algorithm consists of a cell array that contains trials, neurons, reaching angles, and the trajectory of the arm for a time window of 300 milliseconds (ms) before the arm movement initiation, until 100 ms after. The neural activity had already been converted into a binary form resulting in a spike train where 1 represents the existence of a spike at a time interval of 1 ms. The 2D trajectory data were used to train the decoder, predict x- and y- coordinates in each time bin, and then compared to the actual coordinates. For the SVM classifier, the spikes of each neuron were added for the first 320 ms. The transformed matrix had dimensions of (trials x angles) x neurons. If we assume that there are 100 trials, then the 2D matrix has dimensions of (100 x 8) x 98, where each set of 100 rows corresponds to a different angle. The neural activity is the sum of neural spikes for a specific trial across the same angle. For both trajectory prediction methods, the kinematic data were binned at time intervals of 20 ms and the position recorded at the end of each bin was taken. For the Kalman filter, the spike trains were also binned at the same intervals, and the summed activity in each bin was taken. After a process of trial and error, it was decided that a bias of 300 ms (ignoring the first 300 ms) and a time-lag of 60 ms (3 bins) would provide the best results. A 60ms time-lag means that the movement at time t corresponds to neural activity at t-60ms

Trajectory prediction: The optimal method is ascertainable via quantification of RMSE and prediction speed. Ideally, the algorithm should be fast enough to allow real-time predictions. A subset of the data were used to train the model for trajectory prediction. The dataset was divided as: 70% for training and the remaining 30% for testing. The Kalman filter is a statistical model-based algorithm with low computational complexity, which should allow for fast prediction, and high accuracy. The optimal lag identified for the filter was 3 time-bins (60 ms). This time lag is consistent with previous findings that suggested it should be between 50-100 ms [8]. The Kalman filter assumes each observation is a linear function of the current state summed to a Gaussian noise. For this reason, the firing rates were square�root transformed, making them more Gaussian, and the mean firing rate was subtracted to achieve zero-mean data [9]. Majority of the trajectories estimated by the Kalman filter reproduced the real trajectory (Figure 5 – Appendix), but the method lost its reliability during the final part of the trajectory during which the movements become slower. This ending artifact could be due to a small overall reduction in firing rate associated with a large decrease in movement displacement (Figure 6 – Appendix). To minimise the mismatch between reductions in firing rate and movement displacement, selection of an optimal neuron could be useful in the future. The Kalman filter predicted trajectory in 13.2 seconds with an average RMSE of 13.678

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages