-
Notifications
You must be signed in to change notification settings - Fork 117
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
added marginal flag to segment.nce #227
added marginal flag to segment.nce #227
Conversation
@craffel do you have any opinions on how tests for this one should look? Some options:
If we do go the regression test route, I think we'd need to add the wrapper function so that the results are kept distinct from the existing NCE metrics. What do you think? |
Regression would be good, both would be good too. Are you planning on making it so that the |
Your call. If we do, I'd advocate doing it via a wrapper/rename, instead of having two separate output dict entries. It will make it easier to keep things separate down the road. |
Added bonus of the wrapper solution: we can encourage people to deprecate nce in favor of v-measure, and all they have to do is ignore columns (rather than change defaults). |
If the goal is to eventually deprecate Regarding the test, whichever is the non-default behavior (i.e. whichever is NOT called in evaluate) is OK to just have a unit test. The other should be regression tested, of course. Does that seem reasonable? |
I guess it's a matter of whether we deprecate |
When do you propose we do the deprecation? What was the community consensus? |
Predictably, there was no obvious consensus. I think the best thing to do is implement it now, then pitch it in the unconference at the next ismir so that people have to actually respond. |
SG. I would advocate for a unit test for v-measure and regression test for the current behavior, and then switching to regression for v-measure and unit for current behavior once it's deprecated. |
Cool. OTOH, we could also just regression-test both if it's going to become another entry in the |
I thought we just decided it wasn't going to become another output of |
Hah, I thought we just decided the opposite? Let me be totally clear about what I think makes the most sense:
EDIT: forgot to address the confusing point. The above would be in contrast to doing something like: {'NCE Over': ..., 'NCE Over (marginal)': ..., ...} where the |
Ok, sounds fine. For |
d6ef7bd
to
07646c1
Compare
What is left on this other than wait for the other tests to stop failing? |
Well, I'd need to actually implement the separate wrapper function and top-level |
Okay, this one's up to speed. I added I noticed that the reference section is missing in the segmentation docstring. Do you want me to add one while we're at it? |
@craffel I had to move the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Requesting some documentation fixes.
mir_eval/segment.py
Outdated
marginal : bool | ||
If `False`, normalize conditional entropy by uniform entropy. | ||
If `True`, normalize conditional entropy by the marginal entropy. | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add (Default value = False)
for consistency within this docstring.
true_given_est = p_est.dot(scipy.stats.entropy(contingency, base=2)) | ||
pred_given_ref = p_ref.dot(scipy.stats.entropy(contingency.T, base=2)) | ||
|
||
if marginal: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add comment to the effect of # Normalize conditional entropy by the marginal entropy
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done below
mir_eval/segment.py
Outdated
marginal : bool | ||
If `False`, normalize conditional entropy by uniform entropy. | ||
If `True`, normalize conditional entropy by the marginal entropy. | ||
|
||
Returns | ||
------- | ||
S_over |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we change the math in this part of the docstring to note that it can be different according to the value of marginal
? For example denominator should be H(y_ref)
right? Or at least, we should change them in the v_measure
docstring right?
Sure! |
No problem. |
I think I've hit all the review points. @craffel last pass? |
Last thing to check - did you rebuild the docs and make sure there are no new errors/glitches now that the refs are there? |
I have built the docs locally and didn't notice anything bad, but I wasn't looking too carefully. |
Look carefully at the changes caused by this PR and I will be happy :) |
Done. Fixed a couple of minor formatting issues, but I think it's solid. |
Merged, thanks! |
Implements #226