On 07/23/2014 03:21 AM, Mathieu Blondel wrote:
from sklearn.multiclass import OneVsRestClassifier
clf = OneVsRestClassifier(ElasticNet())
But that would be trained using rmse loss. Why would you do that if we
have logistic loss and hinge loss in SGDClassifier?
should work.
This is tested here:
https://github.com/scikit-learn/scikit-learn/blob/master/sklearn/tests/test_multiclass.py#L168
For setting the parameters by grid-search, you need to use the
"estimator__" prefix in your parameter grid.
parameter_grid = {"estimator__alpha": [1, 0.1, 0.01]}
On the implementation side, this relies on the fact that linear models
(ElasticNet included) implement "decision_function", which is in this
case just an alias for "predict".
Some people have opposed regressors implementing "decision_function".
I would be OK with removing it but we need a reliable way to tell
whether an estimator is a regressor or not so that the multiclass
module can decide whether to call predict (for regressors) or
decision_function (for classifiers)
(we have an is_classifier function in base.py but not an is_regressor
one).
# Andreas used to oppose but changed his mind IIRC :-)
I don't remember what the outcome of the discussion was but I don't
think I have a very strong opinion ;)
I find the current situation a bit confusing. It probably would be good
to have a way to introspect whether something is a regressor or classifier.
Though I find it still odd to use a regression loss for classification.
Mathieu
On Wed, Jul 23, 2014 at 12:02 AM, Michael Eickenberg
<[email protected] <mailto:[email protected]>>
wrote:
Conflicting messages, no, there is no explicit
ElasticNetClassifier, but Manoj's proposition creates one:
Concerning Manoj's point 2), you may also want to trying weighting
in a different way, by centering the target variable y, i.e. if y
is in {-1, 1}, then do y <- y - y.mean(). This can help with the
inevitable class imbalance in the OvR setting.
Michael
On Tue, Jul 22, 2014 at 4:56 PM, Vlad Niculae <[email protected]
<mailto:[email protected]>> wrote:
Hi,
The SGDClassifier supports elastic net regularization. You can
make it
solve the SVM loss function or the logistic loss function by
changing
the `loss=` parameter.
Hope this helps,
Vlad
On Tue, Jul 22, 2014 at 4:17 PM, Sheila the angel
<[email protected] <mailto:[email protected]>> wrote:
> Hello All,
>
> Is it possible to perform classification using linear models
such as
> ElasticNet?
>
> I tried the following -
>
>
>
> from sklearn.linear_model import ElasticNet
>
> iris = datasets.load_iris()
>
> X= iris.data
>
> y= iris.target
>
>
> clf= ElasticNet()
>
> clf.fit(X,y).predict(X[0])
>
>
> Which gives output value in decimal points.
>
> Any suggestion or link to an example will be very helpful.
>
>
>
> Thanks
>
> --
>
> Sheila
>
>
>
>
>
------------------------------------------------------------------------------
> Want fast and easy access to all the code in your
enterprise? Index and
> search up to 200,000 lines of code with a free copy of Black
Duck
> Code Sight - the same software that powers the world's
largest code
> search on Ohloh, the Black Duck Open Hub! Try it now.
> http://p.sf.net/sfu/bds
> _______________________________________________
> Scikit-learn-general mailing list
> [email protected]
<mailto:[email protected]>
>
https://lists.sourceforge.net/lists/listinfo/scikit-learn-general
>
------------------------------------------------------------------------------
Want fast and easy access to all the code in your enterprise?
Index and
search up to 200,000 lines of code with a free copy of Black Duck
Code Sight - the same software that powers the world's largest
code
search on Ohloh, the Black Duck Open Hub! Try it now.
http://p.sf.net/sfu/bds
_______________________________________________
Scikit-learn-general mailing list
[email protected]
<mailto:[email protected]>
https://lists.sourceforge.net/lists/listinfo/scikit-learn-general
------------------------------------------------------------------------------
Want fast and easy access to all the code in your enterprise?
Index and
search up to 200,000 lines of code with a free copy of Black Duck
Code Sight - the same software that powers the world's largest code
search on Ohloh, the Black Duck Open Hub! Try it now.
http://p.sf.net/sfu/bds
_______________________________________________
Scikit-learn-general mailing list
[email protected]
<mailto:[email protected]>
https://lists.sourceforge.net/lists/listinfo/scikit-learn-general
------------------------------------------------------------------------------
Want fast and easy access to all the code in your enterprise? Index and
search up to 200,000 lines of code with a free copy of Black Duck
Code Sight - the same software that powers the world's largest code
search on Ohloh, the Black Duck Open Hub! Try it now.
http://p.sf.net/sfu/bds
_______________________________________________
Scikit-learn-general mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/scikit-learn-general
------------------------------------------------------------------------------
Want fast and easy access to all the code in your enterprise? Index and
search up to 200,000 lines of code with a free copy of Black Duck
Code Sight - the same software that powers the world's largest code
search on Ohloh, the Black Duck Open Hub! Try it now.
http://p.sf.net/sfu/bds
_______________________________________________
Scikit-learn-general mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/scikit-learn-general