kimtonyhyun / analysis

2 stars 0 forks source link

Better visualization tools for CP decomposition #234

Closed ahwillia closed 5 years ago

ahwillia commented 7 years ago

This is a to-do list for myself. @kimtonyhyun - yell at me if I don't make progress on these points.

Visualizing CPD factors:

Visualizing similarity of CPD fits:

kimtonyhyun commented 7 years ago

Ah, interesting. Was there a separate "factor magnitude" (like the singular values for 2D matrix SVD) that was not being visualized in visualize_neuron_ktensor? (Or, equivalently, the neuron / intra-trial time / trial vectors had some sort of standardized normalization?)

ahwillia commented 7 years ago

Was there a separate "factor magnitude" (like the singular values for 2D matrix SVD)

Yes. In our current code you can view them like this:

>> model(replicate, rank).decomp.lambda
kimtonyhyun commented 7 years ago

Here are some suggestions for visualizing the CPD factors. I'm not requesting any feature per se in our current implementation, and it may even be the case that Matlab isn't well suited for building a visualization tool with the features that I'm suggesting. But here goes.

I think visualize_neuron_ktensor is a good start for getting an overview of the factors: vis_neuron_kfactor

Obviously, one feature that would be nice is to be able to select different features of trial_meta for coloring of the trial factors. If the vis tool were a GUI app, a drop-down menu above the "trial factors" label would be appreciated.

For a chosen trial_meta label, it would also be nice to see a simple summary statistic (e.g. discriminability) for each trial factor.

I also think that rigorously aligning neurons in the "neuron factors" column doesn't buy us much. I think it will be more informative to have each factor sorted independently based on magnitude. For each factor, the independent sort gives us a feeling of how many neurons significantly contribute to that CPD factor. By comparing the distributions (without regards to neuron identities) across different factors would then give us a sense of the strength of the representation of the particular CPD factor in the space of neurons.

The point of having a common cell indexing in the "neuron factors" column is to be able to assess what kind of "mixings" may be present at the single neuron level. For instance, a certain cell with high amplitude on CPD factor m, may also have high amplitudes on a different CPD factor n. While the current cell-aligned layout in principle allows for this type of comparison, in practice it is quite difficult.

The same goal could be achieved even with independent cell sorting of each factor, by adding some interactivity to the visualization. For example, imagine I click the neuron factors subplot of factor k. The vis tool then could highlight the top N cells in that factor (say, by coloring the bars red), and correspondingly color those cells in the other factors. I think that would give a much better intuition to the question: "Do the cells that represent this factor show up prominently in other factors?"

Along those lines, one might also think about the type of interactivity that could be helpful if the user were to click a particular "time factors" subplot.

kimtonyhyun commented 7 years ago

More (rambling) thoughts on visualization.

In coloring of the trial vectors in visualize_neuron_ktensor, it would be handy to be able to switch between different trial_metadata rapidly.

One way this could be done is to handle the right click event of each trial vector subplot, which would then show a list of the available metadata. Clicking on any particular metadata would color the trial vector accordingly. This approach also has the nice feature that different factors could be colored independently. (A little text indicating the currently chosen metadata would then be helpful.)


Also, as discussed in the group meeting yesterday, it would be nice to be able to add a vertical line in the time factors column to, for example, highlight the gate close frame.