8000 self.alpha check revision · scikit-learn/scikit-learn@ad8ce25 · GitHub
[go: up one dir, main page]

Skip to content

Commit ad8ce25

Browse files
committed
self.alpha check revision
1 parent 24274cf commit ad8ce25

File tree

1 file changed

+3
-2
lines changed
  • sklearn/linear_model/_glm

1 file changed

+3
-2
lines changed

sklearn/linear_model/_glm/glm.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
# License: BSD 3 clause
88

99
import numbers
10+
from collections.abc import Iterable
1011

1112
import numpy as np
1213
import scipy.optimize
@@ -264,7 +265,7 @@ def fit(self, X, y, sample_weight=None):
264265
y_numeric=True,
265266
multi_output=False,
266267
)
267-
if hasattr(self.alpha, "__iter__") and not isinstance(self.alpha, str):
268+
if isinstance(self.alpha, Iterable):
268269
for i, val in enumerate(self.alpha):
269270
check_scalar(
270271
val,
@@ -273,7 +274,7 @@ def fit(self, X, y, sample_weight=None):
273274
min_val=0.0,
274275
include_boundaries="left",
275276
)
276-
self.alpha = np.asarray(self.alpha, dtype=np.float_).ravel()
277+
self.alpha = np.asarray(self.alpha, dtype=np.float64).ravel()
277278
if self.alpha.size != X.shape[1]:
278279
raise ValueError(
279280
f"X width is {X.shape[1]} while alpha is of length"

0 commit comments

Comments
 (0)
0