Skip to content
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

Merged
merged 2 commits into from Apr 12, 2018

Conversation

syashakash
Copy link
Contributor

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.

@syashakash syashakash changed the title [WIP] Update Readme and docstring for perceptron Update Readme and docstring for perceptron Jan 31, 2018
Copy link
Contributor

@rsivapr rsivapr left a 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:

@@ -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:
Copy link
Contributor

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:

Copy link
Contributor Author

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

@@ -96,6 +96,7 @@ class Perceptron(BaseSGDClassifier):
Notes
-----

`Perceptron` is a binary classifier.
`Perceptron` and `SGDClassifier` share the same underlying implementation.
Copy link
Contributor

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.

Copy link
Member

@jnothman jnothman left a 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

@glemaitre
Copy link
Member

@syashakash Please fix PEP8

@syashakash syashakash force-pushed the edit-doc-perceptron branch 3 times, most recently from 2057933 to 37c8de1 Compare February 14, 2018 19:54
@syashakash
Copy link
Contributor Author

@glemaitre please review

Copy link
Member

@qinhanmin2014 qinhanmin2014 left a 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.

@@ -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_``.
Copy link
Contributor

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.

@@ -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
Copy link
Contributor

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.

:align: center
:scale: 50%
:scale: 50%
Copy link
Contributor

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.

@@ -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
Copy link
Contributor

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.

:align: center
:scale: 50%
:scale: 50%
Copy link
Contributor

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.

:align: center
:scale: 50%
:scale: 50%
Copy link
Contributor

Choose a reason for hiding this comment

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

avoid this


The loss function that :class:`HuberRegressor` minimizes is given by
The loss function that :class:`HuberRegressor` minimizes is given by
Copy link
Contributor

Choose a reason for hiding this comment

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

avoid this as well.


This figure is created using the :class:`PolynomialFeatures` preprocessor.
This figure is created using the :class:`PolynomialFeatures` preprocessor.
Copy link
Contributor

Choose a reason for hiding this comment

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

avoid this

@@ -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
Copy link
Contributor

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

:align: center
:scale: 50%
:scale: 50%
Copy link
Contributor

Choose a reason for hiding this comment

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

avoid this change.

@mohamed-ali
Copy link
Contributor

@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?

@qinhanmin2014
Copy link
Member

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.

@mohamed-ali
Copy link
Contributor

@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 :)

@syashakash syashakash force-pushed the edit-doc-perceptron branch 2 times, most recently from 8ed4ca1 to 6be37b1 Compare March 4, 2018 11:11
@syashakash
Copy link
Contributor Author

@qinhanmin2014 @mohamed-ali I hope the changes you have suggested are done properly. The mess was created because I used autopep8. I have tried to rectify manually so please if you could review so that this PR is done with.
PS. Sorry for late reply.

@qinhanmin2014
Copy link
Member

@syashakash There's still many unrelevant changes. Please revert all of them or simply open another PR.

@mohamed-ali
Copy link
Contributor

@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.

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:
Copy link
Member

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?

Copy link
Contributor Author

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.

Copy link
Member

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.

Copy link
Member

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

Copy link
Member

@qinhanmin2014 qinhanmin2014 left a 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.

@qinhanmin2014 qinhanmin2014 merged commit 07a0b18 into scikit-learn:master Apr 12, 2018
@syashakash syashakash deleted the edit-doc-perceptron branch April 12, 2018 11:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Neither the user guide nor the docstring says that Perceptron is a classifier
6 participants