Thanks to visit codestin.com
Credit goes to github.com

Skip to content

MAINT Follow-up on a fix for criterion="poisson" in decision trees #22306

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

Merged
merged 3 commits into from
Jan 26, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions doc/whats_new/v1.1.rst
Original file line number Diff line number Diff line change
Expand Up @@ -520,24 +520,24 @@ Changelog
`n_iter_`, the number of iterations of the libsvm optimization routine.
:pr:`21408` by :user:`Juan Martín Loyola <jmloyola>`.

- |Enhancement| :func:`svm.SVR`, :func:`svm.SVC`, :func:`svm.NuSVR`,
:func:`svm.OneClassSVM`, :func:`svm.NuSVC` now raise an error
when the dual-gap estimation produce non-finite parameter weights.
:pr:`22149` by :user:`Christian Ritter <chritter>` and
:user:`Norbert Preining <norbusan>`.

- |Fix| :class:`smv.NuSVC`, :class:`svm.NuSVR`, :class:`svm.SVC`,
:class:`svm.SVR`, :class:`svm.OneClassSVM` now validate input
parameters in `fit` instead of `__init__`.
:pr:`21436` by :user:`Haidar Almubarak <Haidar13 >`.

:mod:`sklearn.tree`
.......................
...................

- |Fix| Fix a bug in the Poisson splitting criterion for
:class:`tree.DecisionTreeRegressor`.
:pr:`22191` by :user:`Christian Lorentzen <lorentzenchr>`.

- |Enhancement| :func:`svm.SVR`, :func:`svm.SVC`, :func:`svm.NuSVR`,
:func:`svm.OneClassSVM`, :func:`svm.NuSVC` now raise an error
when the dual-gap estimation produce non-finite parameter weights.
:pr:`22149` by :user:`Christian Ritter <chritter>` and
:user:`Norbert Preining <norbusan>`.

:mod:`sklearn.utils`
....................

Expand Down
6 changes: 3 additions & 3 deletions sklearn/ensemble/tests/test_forest.py
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ def test_poisson_vs_mse():
forest_mse.fit(X_train, y_train)
dummy = DummyRegressor(strategy="mean").fit(X_train, y_train)

for X, y, val in [(X_train, y_train, "train"), (X_test, y_test, "test")]:
for X, y, data_name in [(X_train, y_train, "train"), (X_test, y_test, "test")]:
metric_poi = mean_poisson_deviance(y, forest_poi.predict(X))
# squared_error forest might produce non-positive predictions => clip
# If y = 0 for those, the poisson deviance gets too good.
Expand All @@ -244,9 +244,9 @@ def test_poisson_vs_mse():
# As squared_error might correctly predict 0 in train set, its train
# score can be better than Poisson. This is no longer the case for the
# test set. But keep the above comment for clipping in mind.
if val == "test":
if data_name == "test":
assert metric_poi < metric_mse
assert metric_poi < 0.5 * metric_dummy
assert metric_poi < 0.8 * metric_dummy


@pytest.mark.parametrize("criterion", ("poisson", "squared_error"))
Expand Down