Skip to content

Fix: mean_squared_error ignores the squared argument if multioutput='raw_values'#16323

Merged
qinhanmin2014 merged 10 commits intoscikit-learn:masterfrom
rushabh-v:mse
Feb 1, 2020
Merged

Fix: mean_squared_error ignores the squared argument if multioutput='raw_values'#16323
qinhanmin2014 merged 10 commits intoscikit-learn:masterfrom
rushabh-v:mse

Conversation

@rushabh-v
Copy link
Copy Markdown
Contributor

Fixes #16313

rushabh-v and others added 3 commits January 31, 2020 17:11
Co-Authored-By: Alexandre Gramfort <alexandre.gramfort@m4x.org>
@rushabh-v
Copy link
Copy Markdown
Contributor Author

Thanks for the approval @agramfort

Copy link
Copy Markdown
Member

@NicolasHug NicolasHug left a comment

Choose a reason for hiding this comment

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

Thanks for the PR @rushabh-v , minor comments but it looks good otherwise

np.sum(1 / y_true) / (4 * n))


def test_mean_squared_error_multioutput_raw_value_squared():
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Please add a comment e.g.

# non-regression test for https://github.com/scikit-learn/scikit-learn/pull/16323

mse2 = mean_squared_error(
[[1]], [[10]], multioutput="raw_values", squared=False
)
assert_allclose(np.sqrt(mse1), mse2)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

we avoid using those helpers now, you can directly use:

assert np.sqrt(mse1) == pytest.approx(mse2)

Copy link
Copy Markdown
Member

@qinhanmin2014 qinhanmin2014 left a comment

Choose a reason for hiding this comment

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

thanks

@qinhanmin2014 qinhanmin2014 merged commit 0396c88 into scikit-learn:master Feb 1, 2020
@rushabh-v rushabh-v deleted the mse branch February 1, 2020 08:03
thomasjpfan pushed a commit to thomasjpfan/scikit-learn that referenced this pull request Feb 22, 2020
panpiort8 pushed a commit to panpiort8/scikit-learn that referenced this pull request Mar 3, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

mean_squared_error ignores the squared argument if multioutput="raw_values"

5 participants