@@ -352,10 +352,11 @@ def logistic_regression_path(X, y, pos_class=None, Cs=10, fit_intercept=True,
352352 temp [- 1 ] = class_weight [n_classes [0 ]]
353353 class_weight = temp .copy ()
354354 else :
355- raise ValueError ("In LogisticRegressionCV the liblinear solver "
356- "cannot handle multiclass with class_weight "
357- "of type dict. Use the lbfgs, newton-cg "
358- "solvers or set class_weight='auto'" )
355+ raise ValueError ("In LogisticRegressionCV the liblinear "
356+ "solver cannot handle multiclass with "
357+ "class_weight of type dict. Use the lbfgs, "
358+ "newton-cg solvers or set "
359+ "class_weight='auto'" )
359360 else :
360361 class_weight_ = compute_class_weight (class_weight , n_classes , y )
361362 sample_weight = class_weight_ [le .fit_transform (y )]
@@ -639,7 +640,7 @@ class LogisticRegression(BaseLibLinear, LinearClassifierMixin,
639640 Intercept (a.k.a. bias) added to the decision function.
640641 If `fit_intercept` is set to False, the intercept is set to zero.
641642
642- ` n_iter_` : int
643+ n_iter_ : int
643644 Maximum of the actual number of iterations across all classes.
644645 Valid only for the liblinear solver.
645646
@@ -942,23 +943,19 @@ def fit(self, X, y):
942943 raise ValueError ("class_weight provided should be a "
943944 "dict or 'auto'" )
944945
946+ path_func = delayed (_log_reg_scoring_path )
945947 fold_coefs_ = Parallel (n_jobs = self .n_jobs , verbose = self .verbose )(
946- delayed (_log_reg_scoring_path )(X , y , train , test ,
947- pos_class = label ,
948- Cs = self .Cs ,
949- fit_intercept = self .fit_intercept ,
950- penalty = self .penalty ,
951- dual = self .dual ,
952- solver = self .solver ,
953- max_iter = self .max_iter ,
954- tol = self .tol ,
955- class_weight = self .class_weight ,
956- verbose = max (0 , self .verbose - 1 ),
957- scoring = self .scoring ,
958- intercept_scaling = self .intercept_scaling )
948+ path_func (X , y , train , test , pos_class = label , Cs = self .Cs ,
949+ fit_intercept = self .fit_intercept , penalty = self .penalty ,
950+ dual = self .dual , solver = self .solver ,
951+ max_iter = self .max_iter , tol = self .tol ,
952+ class_weight = self .class_weight ,
953+ verbose = max (0 , self .verbose - 1 ),
954+ scoring = self .scoring ,
955+ intercept_scaling = self .intercept_scaling )
959956 for label in labels
960- for train , test in folds
961- )
957+ for train , test in folds )
958+
962959 coefs_paths , Cs , scores = zip (* fold_coefs_ )
963960
964961 self .Cs_ = Cs [0 ]
0 commit comments