@@ -164,7 +164,7 @@ def _preprocess_data(
164164 sample_weight_sqrt : ndarray of shape (n_samples, ) or None
165165 `np.sqrt(sample_weight)`
166166 """
167- xp , _ , device_ = get_namespace_and_device (X , y , sample_weight )
167+ xp , _ , device = get_namespace_and_device (X , y , sample_weight )
168168 n_samples , n_features = X .shape
169169 X_is_sparse = sp .issparse (X )
170170
@@ -173,7 +173,7 @@ def _preprocess_data(
173173 X ,
174174 copy = copy ,
175175 accept_sparse = ["csr" , "csc" ],
176- dtype = supported_float_dtypes (xp , device = device_ ),
176+ dtype = supported_float_dtypes (xp , device = device ),
177177 )
178178 y = check_array (y , dtype = X .dtype , copy = True , ensure_2d = False )
179179 else :
@@ -198,15 +198,15 @@ def _preprocess_data(
198198 y_offset = _average (y , axis = 0 , weights = sample_weight , xp = xp )
199199 y -= y_offset
200200 else :
201- X_offset = xp .zeros (n_features , dtype = X .dtype , device = device_ )
201+ X_offset = xp .zeros (n_features , dtype = X .dtype , device = device )
202202 if y .ndim == 1 :
203- y_offset = xp .asarray (0.0 , dtype = dtype_ , device = device_ )
203+ y_offset = xp .asarray (0.0 , dtype = dtype_ , device = device )
204204 else :
205- y_offset = xp .zeros (y .shape [1 ], dtype = dtype_ , device = device_ )
205+ y_offset = xp .zeros (y .shape [1 ], dtype = dtype_ , device = device )
206206
207207 # X_scale is no longer needed. It is a historic artifact from the
208208 # time where linear model exposed the normalize parameter.
209- X_scale = xp .ones (n_features , dtype = X .dtype , device = device_ )
209+ X_scale = xp .ones (n_features , dtype = X .dtype , device = device )
210210
211211 if sample_weight is not None and rescale_with_sw :
212212 # Sample weight can be implemented via a simple rescaling.
@@ -410,7 +410,7 @@ def predict(self, X):
410410 Vector containing the class labels for each sample.
411411 """
412412 check_same_namespace (X , self , attribute = "coef_" , method = "predict" )
413- xp , _ , device_ = get_namespace_and_device (X )
413+ xp , _ , device = get_namespace_and_device (X )
414414 scores = self .decision_function (X )
415415 if len (scores .shape ) == 1 :
416416 indices = xp .astype (scores > 0 , indexing_dtype (xp ))
@@ -424,7 +424,7 @@ def predict(self, X):
424424 if isinstance (y_pred [0 ], str ):
425425 return y_pred
426426 else :
427- return move_to (y_pred , xp = xp , device = device_ )
427+ return move_to (y_pred , xp = xp , device = device )
428428
429429 def _predict_proba_lr (self , X ):
430430 """Probability estimation for OvR logistic regression.
0 commit comments