dattalab / keypoint-moseq

https://keypoint-moseq.readthedocs.io
Other
63 stars 25 forks source link

How to decide the number of iterations when applying a model to new data? #115

Closed romainligneul closed 6 months ago

romainligneul commented 7 months ago

Dear Caleb,

This is not an issue but rather a conceptual question. The apply_model function comes with an num_iters parameter and I could not find the pieces of information that would allow me to choose the right number. The function comment states that the default value is 20 but the actual default value is set to 50, which leads to rather long inference time. In fact, I was surprised to see that the seconds/iteration were almost identical to that of the fitting, and I wondered whether, under the hood, the apply_model function actually fitted the new data using the (trained) model parameters as priors.

Whenever you find the time, I'd be happy to read you about this topic.

Sincerely,

Romain

calebweinreb commented 7 months ago

Hi Romain,

The apply_model doesn't update the parameters. The reason inference still takes a long time is because the hard part is estimating pose states, which has to be done both when applying and fitting the model. Currently there isn't a formal way available through the existing code base to choose the number of iterations. In my experience, the output after 2o is pretty close to the final output, so is likely fine initially. 50 is better for final analyses.