LINCellularNeuroscience/VAME

How to apply model to unseen data

AliyaAbl opened this issue · 3 comments

Hi, I have trained a model and saved it. How do I apply it new new/unseed data, without training it again? I don't want to create a new project and config file, but continue working on the finished trained model. Is that possible, or do I have to stick to the 5-steps-workflow every time I check the model on new data?

Hi!
You need to set the config.yaml parameter pretrained_model to True if you want to use a pretrained model for further fine tuning on new data. If you want to apply an already trained model for the behavior segmentation, you can just go ahead and use the function vame.pose_segmentation(config). The only problem is, that the HMM (or k-Means) will be initialized from scratch again. This reminds me that I wanted to add a save file of the HMM to the code.
For now, you could do this yourself by looking at the example from the hmmlearn documentation. You would need to add this after line 147 here and then write a few lines to load a saved HMM and use it on unseen data.

I hope this helps and I try to add this when I find some time.

Okay I went ahead and added it myself to the code now. Just replace the pose_segmentation.py within your copy of VAME. Moreover, you need to add the parameter hmm_trained: False to your config.yaml. Once you have your HMM trained you can change this parameter to True and run it on unseen data to detect the same motifs in a new data set. If there are any bugs/questions feel free to ask

Closing this.