Skip to content

[MRG]Fix issue for normalized_mutual_info_score not returning error for continuous values. - #17938

Closed
Ashutosh619-sudo wants to merge 13 commits into
scikit-learn:masterfrom
Ashutosh619-sudo:master
Closed

Ashutosh619-sudo wants to merge 13 commits into
scikit-learn:masterfrom
Ashutosh619-sudo:master

Conversation

@Ashutosh619-sudo

@Ashutosh619-sudo Ashutosh619-sudo commented Jul 16, 2020 •

Copy link
Copy Markdown

Reference Issues/PRs

Fixes #17892

What does this implement/fix? Explain your changes.

Fix of issue normalized_mutual_info_score not returning error for continuous values. as it is only for classification. In the check_clustering function, we are checking if the type of arrays passed are discrete or continuous and if continuous throwing a ValueError for the same.

Any other comments?

@Ashutosh619-sudo Ashutosh619-sudo changed the title Fix issue for normalized_mutual_info_score not returning error for continuous values. [WIP]Fix issue for normalized_mutual_info_score not returning error for continuous values. Jul 17, 2020
@Ashutosh619-sudo Ashutosh619-sudo changed the title [WIP]Fix issue for normalized_mutual_info_score not returning error for continuous values. [MRG]Fix issue for normalized_mutual_info_score not returning error for continuous values. Jul 17, 2020

@swierh swierh left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the MR and issue it states that normalized_mutual_info_score is for classification only. So shouldn't the function that checks the arrays be identical to the one used for other classification metrics (i.e. check_targets)?

Or are the input requirements of these two functions not identical?

Comment on lines +48 to +52
if (type_of_target(labels_true) == "continuous" or
type_of_target(labels_pred) == "continuous"):
raise ValueError('Classification metrics expects discrete \
values received %r for label, and %r \
for target' % (labels_pred.dtype.type, labels_true.dtype.type))

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a reason you're not using the check_targets function from the classification module?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No there is no particular reason for using that. As only categorical arrays are allowed type_of_target gets the job done.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

using sklearn.metrics.normalized_mutual_info_score for continuous data does not return a warning

2 participants