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

Skip to content

DOC updates for D2 log loss #28969

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 2 commits into from
May 7, 2024
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
6 changes: 3 additions & 3 deletions sklearn/metrics/_classification.py
Original file line number Diff line number Diff line change
Expand Up @@ -3277,10 +3277,10 @@ def d2_log_loss_score(y_true, y_pred, *, sample_weight=None, labels=None):
:math:`D^2` score function, fraction of log loss explained.

Best possible score is 1.0 and it can be negative (because the model can be
arbitrarily worse). A model that always uses the empirical mean of `y_true` as
constant prediction, disregarding the input features, gets a D^2 score of 0.0.
arbitrarily worse). A model that always predicts the per-class proportions
of `y_true`, disregarding the input features, gets a D^2 score of 0.0.

Read more in the :ref:`User Guide <d2_score>`.
Read more in the :ref:`User Guide <d2_score_classification>`.

.. versionadded:: 1.5

Expand Down
3 changes: 2 additions & 1 deletion sklearn/metrics/tests/test_classification.py
Original file line number Diff line number Diff line change
Expand Up @@ -3048,7 +3048,8 @@ def test_d2_log_loss_score():


def test_d2_log_loss_score_raises():
"""Test that d2_log_loss raises error on invalid input."""
"""Test that d2_log_loss_score raises the appropriate errors on
invalid inputs."""
y_true = [0, 1, 2]
y_pred = [[0.2, 0.8], [0.5, 0.5], [0.4, 0.6]]
err = "contain different number of classes"
Expand Down
Loading