Skip to content
This repository was archived by the owner on Feb 28, 2025. It is now read-only.

Support different inputs for ROC #221

Closed

Conversation

yafimvo
Copy link
Contributor

@yafimvo yafimvo commented Jan 17, 2023

Describe your changes

Added support for 3 different inputs for ROC curve: lables/classes array, onehot encoded array, and array of values.

array([0, 1, 2])

array([[0, 1, 0], 
        [1, 0, 0], 
        [0, 0, 1]])

array([[0.1, 0.8, 0.1], 
        [0.8, 0.1, 0.1], 
        [0.1, 0.1, 0.8]])

Issue ticket number and link

Closes #98

Checklist before requesting a review

  • I have performed a self-review of my code
  • I have added thorough tests (when necessary).
  • I have added the right documentation (when needed). Product update? If yes, write one line about this update.

📚 Documentation preview 📚: https://sklearn-evaluation--221.org.readthedocs.build/en/221/

@coveralls
Copy link

coveralls commented Jan 17, 2023

Pull Request Test Coverage Report for Build 3951368466

Warning: This coverage report may be inaccurate.

This pull request's base commit is no longer the HEAD commit of its target branch. This means it includes changes from outside the original pull request, including, potentially, unrelated coverage changes.

Details

  • 14 of 14 (100.0%) changed or added relevant lines in 1 file are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.2%) to 94.641%

Totals Coverage Status
Change from base Build 3949074078: 0.2%
Covered Lines: 2649
Relevant Lines: 2799

💛 - Coveralls

@yafimvo
Copy link
Contributor Author

yafimvo commented Jan 17, 2023

@edublancas @idomic
I added an example to classifications.

I think it's not the best example for ROC since the accuracy is almost 100% and the curves are "too good"

image

@yafimvo yafimvo requested review from edublancas and idomic January 17, 2023 20:21
@yafimvo yafimvo mentioned this pull request Jan 18, 2023
Copy link
Contributor

@idomic idomic left a comment

Choose a reason for hiding this comment

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

Looking good, just rebase on main and let's merge this.

Use the predicted labels or classes to plot an ROC curve.
We support 3 main formats that allow you to quickly generate a single or a multi classification ROC curve.

```
Copy link
Contributor

Choose a reason for hiding this comment

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

let's move this to the docstring. and clarify that the first two formats are for the y_true argument and the second format is for y_score

For this example we will plot a multi classification ROC using the predicted classes

```{code-cell} ipython3
plot.roc(y_test, y_pred_dt)
Copy link
Contributor

Choose a reason for hiding this comment

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

there's an error here, y_pred_dt is created with y_pred_dt = dt_model.predict(X_test)

but it should be y_pred_dt = dt_model.predict_proba(X_test)

note that some plots like confusion matrix need the output of predict, and others like roc need predict_proba

@edublancas
Copy link
Contributor

found a minor issue

@yafimvo
Copy link
Contributor Author

yafimvo commented Jan 29, 2023

@edublancas @idomic
This PR should be closed since we took another approach where ROC inputs should be "scores" like for y_score and "classes"/"one hot" for y_test.

@edublancas edublancas closed this Jan 29, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Multiclass ROC curve
4 participants