ContextLab / quail

A python toolbox for analyzing and plotting free recall data
http://cdl-quail.readthedocs.io/en/latest/
MIT License
21 stars 10 forks source link

specifying distance functions #108

Open andrewheusser opened 6 years ago

andrewheusser commented 6 years ago

There is an inconsistency with how distance functions for different feature dimensions are handled. When an egg is created, the user can optionally pass a dist_funcs dictionary containing distance functions for each feature. This is used in the clustering analyses (fingerprint, temporal). However, when performing naturalistic analyses, a new distance function is assigned, e.g. egg.analyze('spc', match='best', distance='correlation'). This forces the distance function to be 'correlation' for all features. Some possible resolutions:

1) keep the distance argument, but default to egg.dist_funcs. if a string or function is passed, assume that all features should use that distance function. if a dictionary of feature:function pairs is passed, use these instead of the functions specified in egg.dist_funcs

2) get rid of the distance argument in the analyze method (always infer it from the egg.dist_funcs dict).

1 seems like a more flexible solution...by default assumes you want to use egg.dist_funcs, but allow the user to modify the distance functions on the fly. @jeremymanning and @paxtonfitzpatrick , can I get your thoughts on this?

paxtonfitzpatrick commented 6 years ago

I like the first option. I think getting rid of the distance arg would make quickly comparing/testing distance functions on the same egg difficult. Also, maybe worth adding a method to Egg to restore default dist funcs?