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
Update Readme and docstring for perceptron #10559
Update Readme and docstring for perceptron #10559
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note that BaseSGDClassifier
will combine binary classifiers under-the-hood when there are greater than 2 classes.
Refer:
if n_classes > 2: |
doc/modules/linear_model.rst
Outdated
@@ -838,7 +838,7 @@ Perceptron | |||
========== | |||
|
|||
The :class:`Perceptron` is another simple algorithm suitable for large scale | |||
learning. By default: | |||
learning. It is a binary classifier. By default: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would just say:
The Perceptron is another simple classification algorithm suitable for large scale learning. By default:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the suggestion. I have done the necessary changes
sklearn/linear_model/perceptron.py
Outdated
@@ -96,6 +96,7 @@ class Perceptron(BaseSGDClassifier): | |||
Notes | |||
----- | |||
|
|||
`Perceptron` is a binary classifier. | |||
`Perceptron` and `SGDClassifier` share the same underlying implementation. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And here:
Perceptron and SGDClassifier are both classifiers that share the same underlying implementation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please keep line lengths under 80 characters. Thanks @rsivapr for your review
0f4f91b
to
298f869
Compare
@syashakash Please fix PEP8 |
2057933
to
37c8de1
Compare
@glemaitre please review |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please avoid unrelevant changes.
doc/modules/linear_model.rst
Outdated
@@ -14,7 +14,7 @@ value. | |||
.. math:: \hat{y}(w, x) = w_0 + w_1 x_1 + ... + w_p x_p | |||
|
|||
Across the module, we designate the vector :math:`w = (w_1, | |||
..., w_p)` as ``coef_`` and :math:`w_0` as ``intercept_``. | |||
..., w_p)` as ``coef_`` and :math:`w_0` as ``intercept_``. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is an irrelevant change. Please avoid it.
doc/modules/linear_model.rst
Outdated
@@ -34,9 +34,9 @@ solves a problem of the form: | |||
.. math:: \underset{w}{min\,} {|| X w - y||_2}^2 | |||
|
|||
.. figure:: ../auto_examples/linear_model/images/sphx_glr_plot_ols_001.png | |||
:target: ../auto_examples/linear_model/plot_ols.html | |||
:target: ../auto_examples/linear_model/plot_ols.html |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is an irrelevant change. Please avoid it.
doc/modules/linear_model.rst
Outdated
:align: center | ||
:scale: 50% | ||
:scale: 50% |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is an irrelevant change. Please avoid it.
doc/modules/linear_model.rst
Outdated
@@ -91,12 +91,12 @@ of shrinkage: the larger the value of :math:`\alpha`, the greater the amount | |||
of shrinkage and thus the coefficients become more robust to collinearity. | |||
|
|||
.. figure:: ../auto_examples/linear_model/images/sphx_glr_plot_ridge_path_001.png | |||
:target: ../auto_examples/linear_model/plot_ridge_path.html | |||
:target: ../auto_examples/linear_model/plot_ridge_path.html |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is an irrelevant change. Please avoid it.
doc/modules/linear_model.rst
Outdated
:align: center | ||
:scale: 50% | ||
:scale: 50% |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is an irrelevant change. Please avoid it.
doc/modules/linear_model.rst
Outdated
:align: center | ||
:scale: 50% | ||
:scale: 50% |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
avoid this
doc/modules/linear_model.rst
Outdated
|
||
The loss function that :class:`HuberRegressor` minimizes is given by | ||
The loss function that :class:`HuberRegressor` minimizes is given by |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
avoid this as well.
doc/modules/linear_model.rst
Outdated
|
||
This figure is created using the :class:`PolynomialFeatures` preprocessor. | ||
This figure is created using the :class:`PolynomialFeatures` preprocessor. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
avoid this
doc/modules/linear_model.rst
Outdated
@@ -1194,11 +1194,11 @@ Here is an example of applying this idea to one-dimensional data, using | |||
polynomial features of varying degrees: | |||
|
|||
.. figure:: ../auto_examples/linear_model/images/sphx_glr_plot_polynomial_interpolation_001.png | |||
:target: ../auto_examples/linear_model/plot_polynomial_interpolation.html | |||
:target: ../auto_examples/linear_model/plot_polynomial_interpolation.html |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
avoid this change as well
doc/modules/linear_model.rst
Outdated
:align: center | ||
:scale: 50% | ||
:scale: 50% |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
avoid this change.
@syashakash, I see that this pull request is pending, waiting for some edits from your behalf. I reviewed the code to help you see the changes that you need to undo, since they are irrelevant for this PR. @qinhanmin2014, can you confirm that I didn't forget any other change that need to be done? |
Thanks @mohamed-ali for the review. I'm not sure what's happening here but it seems that the best way is to open another PR instead of modifying this one. @mohamed-ali you can take it if @syashakash still don't reply after a couple of days. |
@qinhanmin2014 yes sure, just after I finish working on this #10711. It would be helpful if you review the work on progress and give me your recommendations :) |
8ed4ca1
to
6be37b1
Compare
@qinhanmin2014 @mohamed-ali I hope the changes you have suggested are done properly. The mess was created because I used |
@syashakash There's still many unrelevant changes. Please revert all of them or simply open another PR. |
@syashakash, I don't know if you have already done that, but you can look at the file differences here: https://github.com/scikit-learn/scikit-learn/pull/10559/files just undo anything green from the right side that is not subject to this issue. |
6be37b1
to
6080581
Compare
doc/modules/linear_model.rst
Outdated
The :class:`Perceptron` is another simple algorithm suitable for large scale | ||
learning. By default: | ||
The :class:`Perceptron` is another simple classification algorithm suitable for | ||
large scale learning. It is a binary classifier. By default: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's not a binary classifier?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't get you. It says perceptron is a binary classifier.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You say perceptron is a binary classifier, but it's not a binary classifier.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It supports multi-class classification
6080581
to
a594359
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, will merge when green.
Reference Issues/PRs
What does this implement/fix? Explain your changes.
Fixes #10544
Any other comments?
Haven't checked by generating doc locally due to internal issues. Please review and recommend change. The edited description is direct but could be better.