-
-
Notifications
You must be signed in to change notification settings - Fork 25.9k
[MRG + 1] Add SVR mathematical description to the tutorial and a test for decision_function #4388
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
Conversation
@@ -15,6 +15,9 @@ | |||
from __future__ import print_function | |||
import sys | |||
import os | |||
|
|||
sys.path.insert(0, os.path.abspath('..')) |
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.
Let me elaborate this: I have an old version of scikit-learn (something like 0.14), which ships very old version of six
. Because project dir is not in the path (at least by the moment doc/sphinxext/gen_rst.py
is called), the line below uses system's sklearn, and breaks building the doc. This doesn't look right to me.
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.
8000 option>I don't understand. You build the docs of the development system using the old version?
You should make sure that the version you are building the docs from is the one that gets imported.
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.
@amueller, how can I do this?
I just ran make doc
and it failed with an error of six
module not having PY2
property. I inserted debug output (__version__
and __file__
) into gen_rst.py
, and it turned out, my system's sklearn was used. Can you try the same?
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.
Many ways. For example you could use the ![develop mode][https://pythonhosted.org/setuptools/setuptools.html#develop-deploy-the-project-source-in-development-mode] or change your PYTHONPATH
.
I don't have an "installed" version of scikit-learn, I only have the repo checkout ;)
\textrm {subject to } & e^T (\alpha - \alpha^*) = 0\\ | ||
& 0 \leq \alpha_i, \alpha_i^* \leq C, i=1, ..., n | ||
|
||
where :math:`e`, :math:`C > 0` and :math:`Q` are the same as in the case of SVC. |
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.
As the explanation for the variables is short, I'd copy and paste the explanation from SVC and say "as in the case of the SVC", so people don't have do dereference.
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.
Ok, then, I think, we should also fix
Q
is ann
byn
positive semidefinite matrix,Q_{ij} \equiv K(x_i, x_j)
and\phi (x_i)^T \phi (x)
is the kernel
because the kernel is a function of 2 arguments, and relation between Q
and \phi
is not clear.
e6542db
to
b15941b
Compare
LGTM. |
The fact that we have a Apparently most linear regression models in sklearn (Rdige, SGDRegressor, LinearRegression, Lars, ElasticNet) also have a So I think we should:
Both points should be tackled in dedicated PRs though. WDYT? |
@ogrisel There was a discussion about having |
[MRG + 1] Add SVR mathematical description to the tutorial and a test for decision_function
Alright then. Thanks for the heads on the discussion. I just checked the HTML rendering of this branch and it looks good. The maths look correct to me from what I recall. +1 on my side as well and merging + backporting to 0.16.X. |
@mblondel it would be great if you could quickly check the maths as well if you have 2min. |
Having a is_regressor function would also be my solution of choice. I know
that some core developers feel strongly about duck typing but in practice
everyone inherits from the base class and mixins (have a look at the
third-party gists). So we could just check for RegressorMixin. Another
solution would be to require to set a class variable, e.g., estimator_type
= "regressor". This should be part of our reflexion on utilities for
estimator verification.
|
I agree that we should decide to either rely on inheritance or define a tag like |
We could also set estimator_type = "regressor" in RegressorMixin.
|
That is what I meant. |
+1 on my side And in the scoring API, if estimator_type is not defined, we can resort to the current heuristic. |
This PR adds SVR's description to the tutorial (Mathematical formulation section), adds a test to reproduce its
decision_function
(#4367), and makes sphinx usesix
that comes withsklearn
being built, not the one already installed in a system.