thanks for all the helpful remarks! That's exactly what I wanted to 
know. However I am a bit surprised by the low performance of Elastic Net 
in comparison to logit (both using L1 regularization and test/training 
on the full dataset). Am I overseeing something obvious here?

acc enet: 69.0
acc logit: 100.0

iris = datasets.load_iris()
X = iris.data
y = iris.target

idx=np.where(y!=2)[0] # select only labels 0 & 1
X=X[idx,:]
y=y[idx,:]
X /= X.std(0)

clf = OneVsRestClassifier(ElasticNet(alpha=0., rho=0.))
y_pred = clf.fit(X,y).predict(X)
print 'acc enet:',zero_one_score(y,y_pred)*100

clf = LogisticRegression(C=1., penalty='l1')
y_pred = clf.fit(X,y).predict(X)
print ' acc logit:', zero_one_score(y,y_pred)*100

Thanks in advance!
  Matthias

On 2/27/12 10:13 AM, Mathieu Blondel wrote:
> On Mon, Feb 27, 2012 at 6:06 PM, Matthias Ekman
> <[email protected]>  wrote:
>
>> do I use Elastic Net for classification in practice?
> from sklearn.multiclass import OneVsRestClassifier
>
> clf = OneVsRestClassifier(ElasticNet(alpha=0.1, rho=0.7))
>
> will work even for binary classification.
>
> Mathieu
>
> ------------------------------------------------------------------------------
> Try before you buy = See our experts in action!
> The most comprehensive online learning library for Microsoft developers
> is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
> Metro Style Apps, more. Free future releases when you subscribe now!
> http://p.sf.net/sfu/learndevnow-dev2
> _______________________________________________
> Scikit-learn-general mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/scikit-learn-general

------------------------------------------------------------------------------
Try before you buy = See our experts in action!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-dev2
_______________________________________________
Scikit-learn-general mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/scikit-learn-general

Reply via email to