-
-
Notifications
You must be signed in to change notification settings - Fork 25.8k
FIX Pop unnecessary elements from metric_kwargs
in datasets_pair.pyx.tp
#26987
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
Conversation
Ping @jjerphan @OmarManzoor in case either of you are interested in reviewing |
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.
Thanks
if metric_kwargs is not None: | ||
# Copying metric_kwargs not to pop "X_norm_squared" | ||
# and "Y_norm_squared" where they are used | ||
metric_kwargs = copy.copy(metric_kwargs) |
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.
quick question: does metric_kwargs
can have nested objects such that calling deepcopy
instead of copy
could be better?
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.
Here, we do not want to copy the objects themselves, (which is what deepcopy
does), and only want to copy their reference in another dictionary (which is what copy
does).
What do you think? Is this right?
Probably we could include a comment to explain the function that is used.
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.
OK right, metric_kwargs
will only be used "read-only", that makes sense.
Reference Issues/PRs
This change was first made in #25561 by @jjerphan and @Vincent-Maladiere
What does this implement/fix? Explain your changes.
Any other comments?
I factored this out separately so as to simplify the new PR (#26983)