LINCellularNeuroscience/VAME

re-defined functions in tree_heirarchy.py

alexcwsmith opened this issue · 4 comments

Hi,
I am trying to debug some issues with the community functions, and just realized that there are multiple definitions of the functions traverse_tree and _traverse_tree in tree_heirarchy.py:

traverse_tree is first defined on line 256, then again on 321
_traverse_tree is first defined on line 264 (inside the traverse_tree function), then again on line 296.

So I'm just wondering if you can clarify that the second definitions of those functions are the ones intended for use? I will be happy to submit a pull request cleaning that file up if you'd like, once that is confirmed.

Thanks,
Alex

@alexcwsmith @kvnlxm @pavolbauer hi, thanks for all the contribution and the really great tool. I had some issue with using the community which I believe is related to this and may be other option issue#62. Any insight to be able to use the community function would be great. I got similar error even when using your repo Alex @alexcwsmith

@wAOndering This issue stems from motif usage for some motifs being 0, I have not tracked down the fix yet. This issue arises when either n_cluster is not optimal (typically too high), or if there are any videos that are not good quality or are very different from the rest of the videos. For me, it is helpful to generate a CSV file containing the # of frames in each motif for each video, to see if any data from any video looks very different from the rest. With my repo as the working directory (or added to PATH), you can do this with:

from vame.custom import helperFunctions as hf
hf.combineBehavior(config, save=True, cluster_method='kmeans', legacy=False)

This will generate a CSV file within the project folder called CombinedMotifUsage.csv.

Here is a screenshot of an example where this was the case in one of my projects:
Screen Shot 2022-03-04 at 9 42 17 AM

This shows that the data from Vid3 is obviously not like the rest. Looking at that video it was clear that it was corrupted (the mouse had gotten onto the edge of the arena and the full body was not visible for the majority of the video). Excluding that video and re-running vame.pose_segmentation() on the rest fixed the problem in this project.

No guarantee that this is the case for your project, but generating and manually inspecting the CombinedMotifUsage.csv is likely a good first step to figuring out what the issue is.

@alexcwsmith thanks Alex for the recommendations much appreciated!

Thank you @alexcwsmith and @wAOndering for bringing up these issues. We know that there are still some unsolved problems with the tree function when it comes down to motifs not being present in the data. We welcome any further advance in this direction and hope to add some workarounds within a newer VAME version.

Cheers,
Kevin