Skip to content

[MRG+1] DOC adding a warning on the relation between C and alpha #7860

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

Merged
merged 8 commits into from
Nov 29, 2016

Conversation

dalmia
Copy link
Contributor

@dalmia dalmia commented Nov 12, 2016

Reference Issue

Fixes #6919

What does this implement/fix? Explain your changes.

Added the note on varying equivalence between C and alpha depending on the estimator. Also, made a note in the linear models module warning about this dependence.

@dalmia
Copy link
Contributor Author

dalmia commented Nov 16, 2016

@jnothman Could you please help me understand why circleci is giving an error and maybe provide a review of my changes?
Thank you.

@jnothman
Copy link
Member

I've requested a rebuild. Let's see if that's enough.

@jnothman
Copy link
Member

All green from the CI's perspective. Is this still WIP? WIP means you're not really ready for review yet.

@dalmia dalmia changed the title [WIP] DOC adding a warning on the relation between C and alpha [MRG] DOC adding a warning on the relation between C and alpha Nov 16, 2016
@dalmia
Copy link
Contributor Author

dalmia commented Nov 16, 2016

Sorry was stuck in class! Ready for review I suppose.

@@ -266,6 +266,11 @@ They also tend to break when the problem is badly conditioned

* :ref:`sphx_glr_auto_examples_linear_model_plot_lasso_model_selection.py`

.. note:: **Comparison with the regularization parameter of SVM**
Copy link
Member

Choose a reason for hiding this comment

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

wouldn't it be better to mention that directly after alpha is introduces? Also, there are only two possiblities, right? alpha = 1/C or alpha = n_samples / C?

Copy link
Member

Choose a reason for hiding this comment

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

I think @amueller is saying that the current description here is not specific enough, or not very helpful to the reader.

Copy link
Contributor Author

@dalmia dalmia Nov 18, 2016

Choose a reason for hiding this comment

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

Thanks for clearing it up. Yes, I should add that only 2 variances of C exist (with respect to alpha). As per the positioning, I felt that since this could be critical to getting a correct result, it should be mentioned separately to draw more attention as it's importance could really be overlooked when mentioned under the same heading .
Also, I felt it was better that readers first understand what alpha does, so that they can make sense of what we are trying to add. I also had a suggestion that we link the issue there because at first I didn't know about this discontinuity but reading the comments on the thread made it clear for me, which could easily be the case with any new contributor.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added the change mentioning the two values of C, but am skeptical about mentioning it at the top. Please let me know what you feel.

equivalence between the amount of regularization of two models depends on
the exact objective function optimized by the model. For example, when the
estimator used is ``Ridge Regression``, the relation between both is given as
:math:`C = \frac{n\_samples}{alpha}`.
Copy link
Member

@TomDLT TomDLT Nov 21, 2016

Choose a reason for hiding this comment

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

It should be \frac{1}{alpha}

regularization parameter, most other estimators use ``alpha``. The exact
equivalence between the amount of regularization of two models depends on
the exact objective function optimized by the model. For example, when the
estimator used is ``Ridge Regression``, the relation between both is given as
Copy link
Member

@TomDLT TomDLT Nov 21, 2016

Choose a reason for hiding this comment

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

estimator used is :class:`Ridge` regression, the relation between both is given as

Copy link
Member

Choose a reason for hiding this comment

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

"between both" -> "between them"

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 review, making the change.

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.

otherwise LGTM

regularization parameter, most other estimators use ``alpha``. The exact
equivalence between the amount of regularization of two models depends on
the exact objective function optimized by the model. For example, when the
estimator used is :class:`Ridge` regression, the relation between them is given as
Copy link
Member

Choose a reason for hiding this comment

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

you need to qualify the reference to ridge with linear_model. or maybe even sklearn.linear_model.

@dalmia
Copy link
Contributor Author

dalmia commented Nov 23, 2016

@jnothman Please have a look now.

regularization parameter, most other estimators use ``alpha``. The exact
equivalence between the amount of regularization of two models depends on
the exact objective function optimized by the model. For example, when the
estimator used is :class:`sklearn.linear_model.Ridge` regression, the relation between them is given as
Copy link
Member

Choose a reason for hiding this comment

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

would look better as

:class:`sklearn.linear_model.Ridge <ridge>`

but the link works at least

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Actually, I was referencing how GridSearchCV is being. I thought it would be good to follow the common pattern of how the links are being inserted.

Proper choice of ``C`` and ``gamma`` is critical to the SVM's performance.  One
is advised to use :class:`sklearn.model_selection.GridSearchCV` with 
``C`` and ``gamma`` spaced exponentially far apart to choose good values.

Copy link
Member

Choose a reason for hiding this comment

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

Yes, except that here "used is Ridge regression" is a syntactic use of "ridge" not just a mention of the estimator.

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 clearing it up! I'll make the change then.

@jnothman jnothman changed the title [MRG] DOC adding a warning on the relation between C and alpha [MRG+1] DOC adding a warning on the relation between C and alpha Nov 23, 2016
regularization parameter, most other estimators use ``alpha``. The exact
equivalence between the amount of regularization of two models depends on
the exact objective function optimized by the model. For example, when the
estimator used is :class:`sklearn.linear_model.Ridge <ridge>` regression, the relation between them is given as
Copy link
Member

Choose a reason for hiding this comment

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

mind your line length, please

@dalmia
Copy link
Contributor Author

dalmia commented Nov 24, 2016

I was looking to check if the link's working but for some reason, CircleCI is not showing the built artifact.

@dalmia
Copy link
Contributor Author

dalmia commented Nov 26, 2016

@jnothman Please let me know if there is anything I need to change. Thanks.

@jnothman
Copy link
Member

I've marked this as LGTM, but - although sometimes one approval suffices for simple documentation changes - I'd appreciate the review of another core dev.

@TomDLT
Copy link
Member

TomDLT commented Nov 29, 2016

This looks good to me

@TomDLT TomDLT merged commit 8793ec9 into scikit-learn:master Nov 29, 2016
@dalmia dalmia deleted the 6919 branch November 29, 2016 20:39
sergeyf pushed a commit to sergeyf/scikit-learn that referenced this pull request Feb 28, 2017
…kit-learn#7860)

* DOC adding a warning on the relation between C and alpha

* DOC removing extra character

* DOC: changes to the relation described

* DOC fixing typo

* DOC fixing typo

* DOC fixing link to Ridge

* DOC link enhancement

* DOC fixing line length
Sundrique pushed a commit to Sundrique/scikit-learn that referenced this pull request Jun 14, 2017
…kit-learn#7860)

* DOC adding a warning on the relation between C and alpha

* DOC removing extra character

* DOC: changes to the relation described

* DOC fixing typo

* DOC fixing typo

* DOC fixing link to Ridge

* DOC link enhancement

* DOC fixing line length
NelleV pushed a commit to NelleV/scikit-learn that referenced this pull request Aug 11, 2017
…kit-learn#7860)

* DOC adding a warning on the relation between C and alpha

* DOC removing extra character

* DOC: changes to the relation described

* DOC fixing typo

* DOC fixing typo

* DOC fixing link to Ridge

* DOC link enhancement

* DOC fixing line length
paulha pushed a commit to paulha/scikit-learn that referenced this pull request Aug 19, 2017
…kit-learn#7860)

* DOC adding a warning on the relation between C and alpha

* DOC removing extra character

* DOC: changes to the relation described

* DOC fixing typo

* DOC fixing typo

* DOC fixing link to Ridge

* DOC link enhancement

* DOC fixing line length
maskani-moh pushed a commit to maskani-moh/scikit-learn that referenced this pull request Nov 15, 2017
…kit-learn#7860)

* DOC adding a warning on the relation between C and alpha

* DOC removing extra character

* DOC: changes to the relation described

* DOC fixing typo

* DOC fixing typo

* DOC fixing link to Ridge

* DOC link enhancement

* DOC fixing line length
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Improve doc on C vs alpha equivalence between estimators
4 participants