@@ -473,11 +473,13 @@ def logistic_regression_path(X, y, pos_class=None, Cs=10, fit_intercept=True,
473473 is called repeatedly with the same data, as y is modified
474474 along the path.
475475
476- class_weight : {dict, 'auto'}, optional
477- Over-/undersamples the samples of each class according to the given
478- weights. If not given, all classes are supposed to have weight one.
479- The 'auto' mode selects weights inversely proportional to class
480- frequencies in the training set.
476+ class_weight : dict or 'balanced', optional
477+ Weights associated with classes in the form ``{class_label: weight}``.
478+ If not given, all classes are supposed to have weight one.
479+
480+ The "balanced" mode uses the values of y to automatically adjust
481+ weights inversely proportional to class frequencies in the input data
482+ as ``n_samples / (n_classes * np.bincount(y))``
481483
482484 dual : bool
483485 Dual or primal formulation. Dual formulation is only implemented for
@@ -734,11 +736,13 @@ def _log_reg_scoring_path(X, y, train, test, pos_class=None, Cs=10,
734736 tol : float
735737 Tolerance for stopping criteria.
736738
737- class_weight : {dict, 'auto'}, optional
738- Over-/undersamples the samples of each class according to the given
739- weights. If not given, all classes are supposed to have weight one.
740- The 'auto' mode selects weights inversely proportional to class
741- frequencies in the training set.
739+ class_weight : dict or 'balanced', optional
740+ Weights associated with classes in the form ``{class_label: weight}``.
741+ If not given, all classes are supposed to have weight one.
742+
743+ The "balanced" mode uses the values of y to automatically adjust
744+ weights inversely proportional to class frequencies in the input data
745+ as ``n_samples / (n_classes * np.bincount(y))``
742746
743747 verbose : int
744748 For the liblinear and lbfgs solvers set verbose to any positive
@@ -903,11 +907,13 @@ class LogisticRegression(BaseEstimator, LinearClassifierMixin,
903907 To lessen the effect of regularization on synthetic feature weight
904908 (and therefore on the intercept) intercept_scaling has to be increased.
905909
906- class_weight : {dict, 'auto'}, optional
907- Over-/undersamples the samples of each class according to the given
908- weights. If not given, all classes are supposed to have weight one.
909- The 'auto' mode selects weights inversely proportional to class
910- frequencies in the training set.
910+ class_weight : dict or 'balanced', optional
911+ Weights associated with classes in the form ``{class_label: weight}``.
912+ If not given, all classes are supposed to have weight one.
913+
914+ The "balanced" mode uses the values of y to automatically adjust
915+ weights inversely proportional to class frequencies in the input data
916+ as ``n_samples / (n_classes * np.bincount(y))``
911917
912918 max_iter : int
913919 Useful only for the newton-cg and lbfgs solvers. Maximum number of
@@ -1150,11 +1156,13 @@ class LogisticRegressionCV(LogisticRegression, BaseEstimator,
11501156 Specifies if a constant (a.k.a. bias or intercept) should be
11511157 added the decision function.
11521158
1153- class_weight : {dict, 'auto'}, optional
1154- Over-/undersamples the samples of each class according to the given
1155- weights. If not given, all classes are supposed to have weight one.
1156- The 'auto' mode selects weights inversely proportional to class
1157- frequencies in the training set.
1159+ class_weight : dict or 'balanced', optional
1160+ Weights associated with classes in the form ``{class_label: weight}``.
1161+ If not given, all classes are supposed to have weight one.
1162+
1163+ The "balanced" mode uses the values of y to automatically adjust
1164+ weights inversely proportional to class frequencies in the input data
1165+ as ``n_samples / (n_classes * np.bincount(y))``
11581166
11591167 cv : integer or cross-validation generator
11601168 The default cross-validation generator used is Stratified K-Folds.
@@ -1185,11 +1193,13 @@ class LogisticRegressionCV(LogisticRegression, BaseEstimator,
11851193 max_iter : int, optional
11861194 Maximum number of iterations of the optimization algorithm.
11871195
1188- class_weight : {dict, 'auto'}, optional
1189- Over-/undersamples the samples of each class according to the given
1190- weights. If not given, all classes are supposed to have weight one.
1191- The 'auto' mode selects weights inversely proportional to class
1192- frequencies in the training set.
1196+ class_weight : dict or 'balanced', optional
1197+ Weights associated with classes in the form ``{class_label: weight}``.
1198+ If not given, all classes are supposed to have weight one.
1199+
1200+ The "balanced" mode uses the values of y to automatically adjust
1201+ weights inversely proportional to class frequencies in the input data
1202+ as ``n_samples / (n_classes * np.bincount(y))``
11931203
11941204 n_jobs : int, optional
11951205 Number of CPU cores used during the cross-validation loop. If given
@@ -1363,9 +1373,9 @@ def fit(self, X, y):
13631373 iter_labels = [None ]
13641374
13651375 if self .class_weight and not (isinstance (self .class_weight , dict ) or
1366- self .class_weight == ' auto' ):
1376+ self .class_weight in [ 'balanced' , ' auto'] ):
13671377 raise ValueError ("class_weight provided should be a "
1368- "dict or 'auto '" )
1378+ "dict or 'balanced '" )
13691379
13701380 path_func = delayed (_log_reg_scoring_path )
13711381
0 commit comments