DOC Rework voting classifier example#30985
Conversation
There was a problem hiding this comment.
Thanks for the PR. It's a nice improvement.
Co-authored-by: Olivier Grisel <olivier.grisel@ensta.org>
Co-authored-by: Olivier Grisel <olivier.grisel@ensta.org>
Co-authored-by: Olivier Grisel <olivier.grisel@ensta.org>
|
Sorry for close, mis-click. Merged main so CI runs again and we can see the rendered docs. |
There was a problem hiding this comment.
Some nits, feel free to ignore.
No idea why the figure is not rendering properly in CI, maybe it's just me?
|
|
||
| from itertools import product | ||
| # %% | ||
| # We first generate a noisy XOR dataset, which is a binary classification task. |
There was a problem hiding this comment.
Is it worth adding that it is not linearly separable?
| print(f"Predicted class of VotingClassifier: {eclf.predict(test_sample).ravel()}") | ||
|
|
||
| # %% | ||
| # Soft votes can be thresholded as for any other probabilistic classifier. |
There was a problem hiding this comment.
Maybe it would be nice to add a sentence about thresholding here, e.g.
This allows you to set a threshold probability at which the positive class will be predicted, instead of simply selecting the class with the highest predicted probability.
| # To convert soft predictions into hard predictions when weights are provided, | ||
| # the weighted average predicted probabilities are computed for each class. | ||
| # Then, the final class label is then derived from the class label with the | ||
| # highest average probability. |
There was a problem hiding this comment.
Maybe it would be nice to have the sentence:
"Which corresponds to the default threshold at 0.5 in the case of binary
classification."
here instead?
doc/modules/ensemble.rst
Outdated
| .. figure:: ../auto_examples/ensemble/images/sphx_glr_plot_voting_decision_regions_001.png | ||
| :target: ../auto_examples/ensemble/plot_voting_decision_regions.html |
There was a problem hiding this comment.
This doesn't seem to have rendered properly:
The voting regressor figure below is rendered fine, and it seems to have the same syntax ? 🤷
Also I think we don't want the first figure now, as that just shows the XOR dataset? i.e. ..plot_voting_decision_regions_001.png -> ..plot_voting_decision_regions_002.png ?
There was a problem hiding this comment.
The render is working now. The problem was the special marker :: that was previously used to introduce a literal code block.
Co-authored-by: Lucy Liu <jliu176@gmail.com>
There was a problem hiding this comment.
Thank you, this is great and we get to remove a redundant example!
Co-authored-by: Lucy Liu <jliu176@gmail.com>
|
Thank you!! |

Reference Issues/PRs
Related to #27151.
What does this implement/fix? Explain your changes.
This PR reworks the Plot the decision boundaries of a VotingClassifier example, introducing a notebook style (see #22406).
The narrative is extended to better cover the use of weights, therefore making the Plot class probabilities calculated by the VotingClassifier example obsolete.
Any other comments?
Extrapolating seemed to me a more interesting use-case for
VotingClassifierother than just using different model families.