2012/1/24 Jieyun Fu <[email protected]>:
> Hi all,
>
> Is there a way to give observation weights to LogisticRegression module? I
> am referring to the weights for different observations. i.e., if we are
> feeding N samples into the regression, we should give N weights. >From the
> APIs, looks like we can only give weights based on the classes.

There is no support for sample weights on the
sklearn.linear_model.LogisticRegresion class. But you can use
SGDClassifier with a log loss instead. It accepts a "sample_weight"
argument on the fit method. The objective function will be the same as
LogisticRegression (except that the intercept won't be regularized :).
The difference is that the optimizer of SGDClassifier is Stochastic
Gradient Descent instead of liblinear's optimizer for the
LogisticRegresion class.

http://scikit-learn.org/stable/modules/generated/sklearn.linear_model.SGDClassifier.html#sklearn.linear_model.SGDClassifier

-- 
Olivier
http://twitter.com/ogrisel - http://github.com/ogrisel

------------------------------------------------------------------------------
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