lindermanlab / ssm

Bayesian learning and inference for state space models
MIT License
540 stars 196 forks source link

Explained variance for the rSLDS latents #159

Open neven-x opened 1 year ago

neven-x commented 1 year ago

Hi, I am trying to get the explained variance from the continuous states of an rSLDS model, but I can't identify this from the model attributes. The alternative is predicting the original data from the latent embedding, but I can't find a prediction method in the class or the neuron loadings for the latents so I could reconstruct the original data myself. What am I missing?

Thanks!

juliagorman commented 1 month ago

Hi, I have the same question. Were you able to figure it out?

slinderman commented 1 month ago

There isn't a built in function to report the fraction of explained variance, unfortunately. The subtle issue is that unlike in a linear regression model where you have covariates x and responses y, in a state space model you don't know the latent states, x. One simple though admittedly imperfect approach is to infer the most likely latent states (or the posterior mean) using the available SSM functions, and then compute the R^2 using that point estimate of x.

slinderman commented 1 month ago

Tagging @adityanairneuro to weigh in on the analyses in his Cell paper.