Example 2: Visualize single-trial neural trajectories


If you have not yet performed dimensionality reduction, please go here. This video shows how to use DataHigh to analyze single-trial neural trajectories.



Download video



Detailed Step-by-step tutorial


The same tutorial can be found in the DataHigh User Guide .pdf in the main folder of the DataHigh software package. It corresponds to Section 3.2 of the DataHigh JNE Paper, as well as ex2_visualize.m in /DataHigh/examples/.

1.

If you are continuing the steps from the Example 2 DimReduce tutorial, we could visualize all of the extracted neural trajectories, which may look cluttered. For visual clarity, we suggest initially visualizing a small subset of trajectories to orient ourselves in the latent space. For your convenience, we have included example data in which the neural trajectories were extracted in the same manner as the previous tutorial, but only 15 trajectories were kept for each condition. To load the data, click the Analysis Tools tab and then click Load Data. Navigate back one folder to the main DataHigh directory, then navigate to the data folder. Load ex2_singletrialtrajs.mat. Continue to the next step.

Otherwise, if you have jumped to this tutorial, navigate to the examples folder in the main DataHigh directory. Enter ex2_visualize into the Matlab command line console to upload the single-trial neural trajectory data to DataHigh. Beforehand, we applied Gaussian-process factor analysis (GPFA) to the 61-dimensional raw spike trains and determined the optimal dimensionality to be 15 with cross-validation. The data consist of two experimental conditions, and each condition has 15 trials.

2.

The main DataHigh interface fills the screen. The colors (green and blue) represent the two different experimental conditions. Each neural trajectory represents the population timecourse for one trial. The start of the neural trajectories (i.e., the first timepoints) are in light grey in the center of the projection, and time increases as you follow along the trajectories. Save this projection by clicking the Saved Projections tab and then Capture Projection.

3.

Now click Randomize. Try to use the preview panels (located to the left and right of the central panel) to find a nice projection that separates the neural trajectories based on their corresponding experimental conditions (green and blue). If you feel you are stuck at a certain type of projection (e.g., a local optima of visualization), you can start over with another random projection. In truth, you are not searching for the “best projection,” but rather viewing many projections that give you intuition for the data. In the process of trying to find a nice projection, you can get a sense of how ugly or beautiful the data are. You can also click the Freeroll button to see a smooth sequence of projections---it runs like a screensaver.

4.

There are other tools if you are having trouble finding a nice projection (sometimes the data will not have a "nice" projection!). You could use the Find Projection tool, but the standard cost functions tend to not find meaningful projections. Another option is Genetic Search. Click Analysis Tools and click the Genetic Search button. The Genetic Search figure starts with fifteen random projections. Click on projections that look of interest. Then, click on Next Generation. DataHigh has an algorithm that finds fifteen new projections that are similar to the selected projections. Try some iterations of GeneticSearch. You can upload an interesting projection by clicking on it (only one projection should be selected) and clicking Upload to DataHigh.

5.

We can do more analysis on the previously found projection. Upload the captured projection to the central panel by clicking the Saved Projections tab and clicking on the previously captured projection’s thumbnail. Now click the Analysis Tools tab and click 3d Projection. The Projection3D figure appears. The user can use this projection as a Matlab 3-d viewer (as if we used plot3) by dragging the figure around.

6.

Note that this is a static 3-d projection (with the same two projection vectors used by the central panel and a third random projection vector). Clicking Randomize may alter the 3-d projection, as it randomizes the third projection vector. Click on the Evolve button to view the population activity play out over time. You may drag on the figure while Evolve is executing, and also save a movie. After Evolve has finished, close the Projection3D figure.

7.

Click the Annotations tab and then click on Average Trajs. This displays average neural trajectories for each condition, which can be helpful in analysis. You can also view the epoch boundaries by clicking on the Epoch Boundaries button. For this example dataset, the two epoch boundaries correspond to target onset and to when the go cue was given. The starting epoch in grey corresponds to pre-stimulus activity, and the last timepoint corresponds to movement onset. You can quickly change epoch colors with the Update Colors tool in Analysis Tools.

8.

DataHigh is also useful to detect “outlying” trials (i.e., a trial in which the population activity does not resemble that of other trials from the same condition). This can be useful for quickly triaging large data sets, and identifying which trials are out of the ordinary, which may be interesting in their own right. For example, an outlying trajectory might correspond to a trial with a long reaction time. We previously found an outlying neural trajectory with DataHigh. Click the Analysis Tools tab, and click Update Colors. In the top left of the UpdateColors figure, click the Update Trial button. Under Select Trial, select trial 7. Under Epoch Colors, change rows 2 and 3 from [0 .7 0] to [1 0 0]. This changes the trajectory’s color to red. Click Upload to DataHigh. Click the Conditions tab and deselect condition 2. Click Recenter Data at the very bottom of the Conditions panel. You can now rotate the 2-d projection plane to see how the red neural trajectory (trial 7) deviates from the others. You can also find differences using the Genetic Search tool.



      Return to Tutorial Videos

      Return to the DataHigh main page