[scikit-learn] question about class_weights in LogisticRegression

Johnson, Jeremiah Jeremiah.Johnson at unh.edu
Tue Aug 1 12:30:22 EDT 2017

Right, I know how the class_weight calculation is performed. But then
those class weights are utilized during the model fit process in some way
in liblinear, and that¹s what I am interested in. libSVM does
class_weight[I] * C (https://www.csie.ntu.edu.tw/~cjlin/libsvm/); is the
implementation in liblinear the same?


On 8/1/17, 12:19 PM, "scikit-learn on behalf of Stuart Reynolds"
<scikit-learn-bounces+jeremiah.johnson=unh.edu at python.org on behalf of
stuart at stuartreynolds.net> wrote:

>I hope not. And not accoring to the docs...
>class_weight : dict or 'balanced', optional
>Weights associated with classes in the form ``{class_label: weight}``.
>If not given, all classes are supposed to have weight one.
>The "balanced" mode uses the values of y to automatically adjust
>weights inversely proportional to class frequencies in the input data
>as ``n_samples / (n_classes * np.bincount(y))``.
>Note that these weights will be multiplied with sample_weight (passed
>through the fit method) if sample_weight is specified.
>On Tue, Aug 1, 2017 at 9:03 AM, Johnson, Jeremiah
><Jeremiah.Johnson at unh.edu> wrote:
>> Hello all,
>> I¹m looking for confirmation on an implementation detail that is
>> in liblinear, but I haven¹t found documentation for yet. When the
>> class_weights=Œbalanced¹ parameter is set in LogisticRegression, then
>> regularisation parameter for an observation from class I is
>> * C, where C is the usual regularization parameter ­ is this correct?
>> Thanks,
>> Jeremiah
>> _______________________________________________
>> scikit-learn mailing list
>> scikit-learn at python.org
>scikit-learn mailing list
>scikit-learn at python.org

More information about the scikit-learn mailing list