Skip to content

FEA add PredictionErrorDisplay - #18020

Merged
jeremiedbb merged 182 commits into
scikit-learn:mainfrom
glemaitre:predicted_actual_regression_plot
Nov 25, 2022
Merged

jeremiedbb merged 182 commits into
scikit-learn:mainfrom
glemaitre:predicted_actual_regression_plot

Conversation

@glemaitre

@glemaitre glemaitre commented Jul 28, 2020 •

Copy link
Copy Markdown
Member

Add a PredictionErrorDisplay which is useful when dealing with regression.

Edit: Partially addresses #16608.

@NicolasHug

Copy link
Copy Markdown
Member

i'm getting baited into reviewing this but it doesn't seem finished yet... mark as WIP @glemaitre ? ;)

@glemaitre

Copy link
Copy Markdown
Member Author

Ups sorry. This is WIP :)

@glemaitre glemaitre changed the title FEA add plot_prediction_error [WIP] FEA add plot_prediction_error Jul 29, 2020
@glemaitre

Copy link
Copy Markdown
Member Author

You can have a look at the API thought. I change examples and I am writing proper test now that I did my example-based development :)

@glemaitre glemaitre changed the title [WIP] FEA add plot_prediction_error FEA add plot_prediction_error and PredictionErrorDisplay Jul 30, 2020
@glemaitre

glemaitre commented Jul 30, 2020 •

Copy link
Copy Markdown
Member Author

@NicolasHug @thomasjpfan I think the PR is ready to get some attention.
Open to any suggestion regarding the API

@glemaitre glemaitre closed this Jul 30, 2020
@glemaitre glemaitre reopened this Jul 30, 2020

@NicolasHug NicolasHug left a comment

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.

Thanks @glemaitre,

I only took a very brief look but my impression is that this might be a bit too high-level for scikit-learn.

My understanding of our goal with the plotting utilities is that we allow users to i) compute complicated stuff like PDPs and ii) update the plot styles without having to re-compute the results every time.

It seems that error plots are really just a matter of calling predict and scatter so it's already quite simple.

Just my personal thoughts, no strong opinion anyway

Comment thread sklearn/metrics/_plot/regression.py Resolved
@glemaitre

Copy link
Copy Markdown
Member Author

It seems that error plots are really just a matter of calling predict and scatter so it's already quite simple.

I agree with these statements. Basically, I wanted my arguments were the following:

  • it is a useful plot that you want to use often in teaching (we need to it during developing our MOOC) or even in practice.
  • the predict and scatter are actually the easy part. What I most dislike with some plots that I saw around: (i) the wrong diagonal is shown and (ii) the aspect ratio of the plot is not squared.

So I agree that this is more of a convenience function.

@jnothman

Copy link
Copy Markdown
Member

And I like its convenience! I am not sure we need to limit our plotting utilities to things that are difficult to achieve without.

Comment thread sklearn/metrics/_plot/regression.py Resolved
@glemaitre

Copy link
Copy Markdown
Member Author

I addressed the issue pointed out by @ogrisel

@lorentzenchr lorentzenchr left a comment •

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.

A partial review. Short on time atm.

Comment thread doc/modules/model_evaluation.rst Resolved
Comment thread doc/modules/model_evaluation.rst Resolved
Comment thread doc/modules/model_evaluation.rst Resolved
Comment thread doc/modules/model_evaluation.rst Resolved
Comment thread doc/modules/model_evaluation.rst Resolved
Comment thread sklearn/metrics/_plot/regression.py Resolved
Comment thread sklearn/metrics/_plot/regression.py Resolved
Comment thread sklearn/metrics/_plot/regression.py Resolved
Comment thread sklearn/metrics/_plot/regression.py Resolved
Comment thread sklearn/metrics/_plot/regression.py Resolved
@ogrisel

ogrisel commented Nov 24, 2022

Copy link
Copy Markdown
Member

I think that using kind="residuals" as the default is indeed a good idea because the class name PredictionErrorDisplay is about "prediction error" which better "residuals vs predicted" than "actual vs predicted".

Comment thread sklearn/metrics/_plot/regression.py Resolved

@ogrisel ogrisel left a comment

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.

More feedback.

Once this and @lorentzenchr's review comments are addressed, LGTM.

Comment thread sklearn/metrics/_plot/regression.py Resolved
Comment thread sklearn/metrics/_plot/regression.py Resolved
Comment thread sklearn/metrics/_plot/regression.py Resolved
Comment thread sklearn/metrics/_plot/regression.py Resolved
Comment thread doc/modules/model_evaluation.rst Resolved

@ogrisel ogrisel left a comment

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.

Final pass. Other than that and the previous suggestion, LGTM.

Comment thread doc/modules/model_evaluation.rst Resolved
Comment thread doc/modules/model_evaluation.rst Resolved
Comment thread doc/modules/model_evaluation.rst Resolved
Comment thread doc/modules/model_evaluation.rst Resolved
Comment thread sklearn/metrics/_plot/regression.py Resolved
Comment thread sklearn/metrics/_plot/regression.py Resolved
Comment thread sklearn/metrics/_plot/regression.py Resolved
Comment thread sklearn/metrics/_plot/regression.py Resolved
Comment thread sklearn/metrics/_plot/regression.py Resolved
@jeremiedbb

Copy link
Copy Markdown
Member

Let's go !

We can still improve some wordings later if needed.

Thanks @glemaitre !

@jeremiedbb
jeremiedbb merged commit 40d7d88 into scikit-learn:main Nov 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

No open projects
Status: Done

Development

Successfully merging this pull request may close these issues.