You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
First of all thanks a lot for this great toolbox (and for the great review that comes with it).
While using ruptures I noticed that only a few metrics were available for comparing two segmentations and thought it would maybe be a good idea to implement additional ones.
For instance, it is super straightforward to implement the adjusted randindex by leveraging the efficient implementation of the adjusted rand score in scikit learn (although adding this to ruptures would imply to add scikit as a dependency) :
fromsklearn.metricsimportadjusted_rand_scoredefchpt_to_label(bkps):
"""Return the segment index each sample belongs to. Example ------- >>> chpt_to_label([4, 10]) array([0, 0, 0, 0, 1, 1, 1, 1, 1, 1]) """duration=np.diff([0] +bkps)
returnnp.repeat(np.arange(len(bkps)), duration)
defrandindex_adjusted(bkps1, bkps2):
"Compute the adjusted rand index for two lists of changepoints."label1=chpt_to_label(bkps1)
label2=chpt_to_label(bkps2)
returnadjusted_rand_score(label1, label2)
I guess there are much more similar metrics (Intersection over Union...) that could be added to ruptures in order to make the package even more complete than it is right now.
Of course this is simply a suggestion and I would be happy to give a hand if you think this direction would indeed be interesting to pursue :)
Cheers,
Romain
The text was updated successfully, but these errors were encountered:
Thanks for you message. This would indeed be a great addition to have more metrics.
For the adjusted Rand Index, I do not mind to have scikit-learn as a dependency so your current implementation is fine by me. Do not hesite to make a pull request.
Same comment for a metric derived from the Intersection over Union.
If you make a PR, just put the code, and we'll work together from here.
Hi !
First of all thanks a lot for this great toolbox (and for the great review that comes with it).
While using
ruptures
I noticed that only a few metrics were available for comparing two segmentations and thought it would maybe be a good idea to implement additional ones.For instance, it is super straightforward to implement the adjusted randindex by leveraging the efficient implementation of the adjusted rand score in scikit learn (although adding this to
ruptures
would imply to add scikit as a dependency) :I guess there are much more similar metrics (Intersection over Union...) that could be added to
ruptures
in order to make the package even more complete than it is right now.Of course this is simply a suggestion and I would be happy to give a hand if you think this direction would indeed be interesting to pursue :)
Cheers,
Romain
The text was updated successfully, but these errors were encountered: