8000 DOC Clarify what the decision function in SVM calculates by JanSellner · Pull Request #12708 · scikit-learn/scikit-learn · GitHub
[go: up one dir, main page]

Skip to content

DOC Clarify what the decision function in SVM calculates #12708

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 4 commits into from
Dec 10, 2018

Conversation

JanSellner
Copy link
Contributor

What does this implement/fix? Explain your changes.

Strictly speaking, the decision function of an SVM does not calculate the distance to the hyperplane. Instead the function value is only proportional to this distance. Since I stumbled over this, I made this small clarification and added a note for users who need the exact distance.

If this simplification was intentional, I would suggest to keep at least the note.


Notes
------
The function values are proportional to the distance of the samples X to the separating hyperplane. If the exact distances are required, divide the function values by the norm of the weight vector (``coef_``). See also `this question <https://stats.stackexchange.com/questions/14876/interpreting-distance-from-hyperplane-in-svm>`_ for further details.
Copy link
Contributor

Choose a reason for hiding this comment

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

take care pep8

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 note. Is fixed. This is a nice CI system you have here :-)

@eamanu
Copy link
Contributor
eamanu commented Dec 1, 2018

Great clarification


Notes
------
The function values are proportional to the distance of the samples X
Copy link
Member

Choose a reason for hiding this comment

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

This is only relevant to decision_function_shape='ovo' isn't it? For ovr it does something more complicated

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good point. As far as I understand the code, the decision values are somehow weighted up together and then scaled to a defined range. It does probably not make any sense to derive to the real distances based on the confidence values. So, yes, the note is only relevant to 'ovo' decision functions.

I would suggest changing the intro of the note to
If decision_function_shape=’ovo’, the function values are proportional...
is that ok?

Copy link
Member

Choose a reason for hiding this comment

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

Yes, just qualifying the statement like that s fine.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ok, done :-)

@jnothman jnothman merged commit 01b37f8 into scikit-learn:master Dec 10, 2018
@jnothman
Copy link
Member

Thanks @Milania1

amueller pushed a commit to amueller/scikit-learn that referenced this pull request Dec 14, 2018
amueller pushed a commit to amueller/scikit-learn that referenced this pull request Dec 17, 2018
adrinjalali pushed a commit to adrinjalali/scikit-learn that referenced this pull request Jan 7, 2019
xhluca pushed a commit to xhluca/scikit-learn that referenced this pull request Apr 28, 2019
xhluca pushed a commit to xhluca/scikit-learn that referenced this pull request Apr 28, 2019
xhluca pushed a commit to xhluca/scikit-learn that referenced this pull request Apr 28, 2019
koenvandevelde pushed a commit to koenvandevelde/scikit-learn that referenced this pull request Jul 12, 2019
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.

4 participants
0