Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit d78bf25

Browse filesBrowse files
author
andy
committed
letting intercept_init be of shape (), reshape to (1,) for consistency
1 parent 05fdfa8 commit d78bf25
Copy full SHA for d78bf25

File tree

Expand file treeCollapse file tree

1 file changed

+2
-2
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+2
-2
lines changed

‎sklearn/linear_model/base.py

Copy file name to clipboardExpand all lines: sklearn/linear_model/base.py
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -262,10 +262,10 @@ def _allocate_parameter_mem(self, n_classes, n_features, coef_init=None,
262262
if intercept_init is not None:
263263
intercept_init = np.asanyarray(intercept_init,
264264
dtype=np.float64)
265-
if intercept_init.shape != (1,):
265+
if intercept_init.shape != (1,) and intercept_init.shape !=():
266266
raise ValueError("Provided intercept_init " \
267267
"does not match dataset.")
268-
self.intercept_ = intercept_init
268+
self.intercept_ = intercept_init.reshape(1,)
269269
else:
270270
self.intercept_ = np.zeros(1, dtype=np.float64, order="C")
271271

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.