Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

EPM_syllables notebook #17

Merged
merged 15 commits into from
Oct 2, 2024
Merged

EPM_syllables notebook #17

merged 15 commits into from
Oct 2, 2024

Conversation

sfmig
Copy link
Contributor

@sfmig sfmig commented Oct 1, 2024

A notebook demoing some simple analysis using a trained keypoint moseq model on new data.

It should be compatible with PR #16, but I rebased to main rather than to that branch for clarity (to have just one file on this PR).

Some questions:

  • I cleared the outputs in the last commit, but let me know if we prefer to have them displayed and I can revert it.
  • What was the target syllable duration during training? I wrote 20 frames but not 100% sure

@sfmig sfmig force-pushed the smg/notebook-kpt-moseq branch from bb871a6 to b32e250 Compare October 1, 2024 16:23
@sfmig sfmig force-pushed the smg/notebook-kpt-moseq branch from b32e250 to 2639c3f Compare October 1, 2024 16:26
@sfmig sfmig marked this pull request as ready for review October 1, 2024 16:30
@sfmig sfmig requested a review from niksirbi October 1, 2024 16:30
@niksirbi
Copy link
Member

niksirbi commented Oct 1, 2024

  • What was the target syllable duration during training? I wrote 20 frames but not 100% sure

It was actually 12 frames (400 ms), and I achieved that for the AR-HMM fit. During the full model fit, while is also started at ~12 frames, it drifted upwards over time and finally settled at ~16 frames. I decided to leave it at that instead of re-training.

I will rephrase this:

We can compute the median duration of all syllables, and check if it is in line with the target of 20 frames.

to:

We can compute the median duration of all syllables in the new data.

Keep in mind that the median syllable duration in the training data was ~16 frames

@niksirbi
Copy link
Member

niksirbi commented Oct 1, 2024

Nice touch with the itertools.groupby. I'd never used it before and it's very useful.

@niksirbi
Copy link
Member

niksirbi commented Oct 1, 2024

I cleared the outputs in the last commit, but let me know if we prefer to have them displayed and I can revert it.

I prefer to have them displayed, to match the other existing notebooks.

It's also nice for posterity, if someone happens to come across these notebooks on github after the course (or completely outside the course context).

I've generated the outputs on my end and pushed them.

Copy link
Member

@niksirbi niksirbi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Excellent work @sfmig!

This notebook is a great resource beyond just this course.

I especially appreciate the fact that you went at length to match the formatting I had in the EPM_analysis.ipynb notebook. This way there was no polishing / harmonisation left for me to do.

The only finishing touch I made was to show the sample frame image as a background for the centroid trajectory and heatmap plots (as we do in EPM_analysis.ipynb as well). Apart from the visual context it adds, it also eliminates the need for manually inverting the y axis and setting an equal aspect (because matpltolib automatically applies these settings when you show an image first).

This PR is ready to go as is, but I have one lingering question out of curiosity: why did you need to use 51 colors in the ethogram if the number of syllables is much less that that?

@sfmig
Copy link
Contributor Author

sfmig commented Oct 2, 2024

why did you need to use 51 colors in the ethogram if the number of syllables is much less that that?

Yeah good catch! I suspect it is an artefact of my explorations 😅

I reduced it to 30 and added an explanation. Even though usually ~15 are found in our example, I left it as 30 just in case people want to have a go with a different video.

@sfmig sfmig merged commit 258e19a into main Oct 2, 2024
1 check passed
@sfmig sfmig deleted the smg/notebook-kpt-moseq branch October 2, 2024 11:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants