Repository navigation
Error Plotter for visualizing metrics with error ranges - #857
Conversation
romanlutz
left a comment
There was a problem hiding this comment.
I added a bunch of comments, although it's clear you're aware of the additional TODOs that remain at the moment.
I think this is a fine approach. In general, we expect people to add tests for new functionality, which perhaps isn't possible here since it's plotting. I've written some matplotlib tests myself but they don't work on all operating systems and are deactivated for that reason. The example will run on every PR, so that's something. I would appreciate if you could add
- a summary to the user guide's "assessment" section
- a note to CHANGES.md
- optional: if you like you can add your name to AUTHORS.md 🙂
| return error | ||
|
|
||
|
|
||
| def wilson(p, n, digits=digits, z=z_score): |
There was a problem hiding this comment.
Would these not be useful to define in fairlearn.metrics?
There was a problem hiding this comment.
Some of them (like this Wilson bound).... really they belong somewhere like sklearn, though
There was a problem hiding this comment.
Then shall we perhaps talk to sklearn folks about contributing it there? I don't mind having it here temporarily until sklearn has a release out with it, of course. @adrinjalali any thoughts?
There was a problem hiding this comment.
This sounds more like something that would be on either scipy.stats or statsmodels (which already has a function called proportion_confint)
There was a problem hiding this comment.
Great! Do we want to use the ones that are available from elsewhere then and only redefine the ones that don't exist yet?
There was a problem hiding this comment.
I second roman here, especially if they're in scipy.
| return (round(lower_bound, digits), round(upper_bound, digits)) | ||
|
|
||
|
|
||
| def compute_error_metric(metric_value, sample_size, z_score): |
There was a problem hiding this comment.
Note for any future documentation: this formula assumes that the metric is a proportion, which makes sense for most classification metrics but maybe not for different types of metrics, e.g., for mean_prediction in regression problems you'd need to use a confidence interval for the mean.
There was a problem hiding this comment.
I expect a lively discussion about how to document these and present the examples :-)
| return error | ||
|
|
||
|
|
||
| def wilson(p, n, digits=digits, z=z_score): |
There was a problem hiding this comment.
Then shall we perhaps talk to sklearn folks about contributing it there? I don't mind having it here temporarily until sklearn has a release out with it, of course. @adrinjalali any thoughts?
…d option for vanilla matplotlib plotting
…to matplotlib instead of df.plot
riedgar-ms
left a comment
There was a problem hiding this comment.
Thanks for updating. @hildeweerts @michaelamoako @MiroDudik what do you think of the updated API? It would be great to get that agreed, so that @alexquach can fill out tests etc.
MiroDudik
left a comment
There was a problem hiding this comment.
This is very close! Just a couple of small tweaks requested.
| error_labels_fontsize: int = 8, | ||
| error_labels_color: str = "black", | ||
| error_labels_ha: str = "center", | ||
| legend_label: str = "95% CI", |
There was a problem hiding this comment.
I think we should change the argument name from legend_label to error_labels_legend (for consistency with other arguments). Also, the default should be None corresponding to no legend being displayed. We shouldn't assume that the provided confidence intervals are 95%.
As an alternative to the default of None, we could also default to "conf. intervals", I think that "CI" is way too cryptic. I'm personally slightly in favor of None, but I don't mind "conf. interval" since that matches the name of the provided argument. (Tagging @hildeweerts since she mentioned this before.)
riedgar-ms
left a comment
There was a problem hiding this comment.
@MiroDudik I think I've updated to reflect your key points (am waiting on the builds, though)
Signed-off-by: Richard Edgar <[email protected]>
Signed-off-by: Richard Edgar <[email protected]>
|
Ping.... @MiroDudik ..... |
Signed-off-by: Richard Edgar <[email protected]>
Signed-off-by: Richard Edgar <[email protected]>
Signed-off-by: Richard Edgar <[email protected]>
Add a plotting method (along with example code) which shows estimated error bars for
MetricFrame.Related to #235