sgoldenlab / simba

SimBA (Simple Behavioral Analysis), a pipeline and GUI for developing supervised behavioral classifiers
https://simba-uw-tf-dev.readthedocs.io/
GNU General Public License v3.0
272 stars 137 forks source link

Analyze Machine Predictions: Aggregate for Three Animals #327

Open olivialaw opened 4 months ago

olivialaw commented 4 months ago

Hello! I started using SimBA recently, and I'm using a model with 3 animals that I imported from SLEAP. During the analysis portion of my model, I was hoping to get the number of behavior bouts for different animal pairs, but I noticed it just aggregates the behavioral counts altogether. I can see how this would work fine with 2 animals only, but I'm specifically interested in looking at how many bouts of behavior each animal has so I can compare behavioral interactions between Animal 1 and Animal 2 versus how Animal 2 and Animal 3 interact, for example.

Is there any way I can get this information in the analysis portion of the program, or is this feature unavailable at this time? Thank you for your help!

sronilsson commented 4 months ago

Hi @olivialaw - Good question. A single classifier will only provide one boolean true vs false output value (BEHAVIOR PRESENT vs BEHAVIOR ABSENT) for each frame. There is currently no way if teasing out which animal or animals performed the action if the action is e.g., "interact". So, if you have three animals and you want to score specific interactions, you would need three classifiers. (Animal_1 <-> Animal_2, Animal_2 <-> Animal_3, Animal_1 <-> Animal_3). Note that if you have any type of “directionality” in your behaviors e.g., “following other animal” or “sniffing other animal” the number of required classifiers can balloon and the number of classifiers can become tricky to work with (Animal_1 -> Animal_2, Animal_2 -> Animal_1, Animal_1 -> Animal_3, Animal_3 -> Animal_1, Animal_2 -> Animal_3, Animal_3 -> Animal_2)..

Three classifiers would be doable. The workflow I’ve come across is to annotate e.g., “interact” in BORIS, with a “ANIMAL” flag, saying which animals are performing the interact action. Then you can concatenate the animal column and the behavior column in the BORIS files into three separate behaviors as discussed in Gitter HERE. You then append that BORIS data to your data in SimBA to create three different classifiers.