Skip to content

Commit a9d42c6

Browse files
ENH error msg fit_intercept (#69)
Co-authored-by: Badr MOUFAD <[email protected]>
1 parent 3b80cf6 commit a9d42c6

File tree

3 files changed

+12
-12
lines changed

3 files changed

+12
-12
lines changed

skglm/solvers/cd_solver.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -228,12 +228,12 @@ def cd_solver(
228228
if len(w) != n_features + fit_intercept:
229229
if fit_intercept:
230230
val_error_message = (
231-
"Inconsistent size of coefficients with n_features + 1\n"
232-
f"expected {n_features + 1}, got {len(w)}")
231+
"w should be of size n_features + 1 when using fit_intercept=True: "
232+
f"expected {n_features + 1}, got {len(w)}.")
233233
else:
234234
val_error_message = (
235-
"Inconsistent size of coefficients with n_features\n"
236-
f"expected {n_features}, got {len(w)}")
235+
"w should be of size n_features: "
236+
f"expected {n_features}, got {len(w)}.")
237237
raise ValueError(val_error_message)
238238

239239
for t in range(max_iter):

skglm/solvers/group_bcd_solver.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -72,12 +72,12 @@ def group_bcd_solver(
7272
if len(w) != n_features + fit_intercept:
7373
if fit_intercept:
7474
val_error_message = (
75-
"Inconsistent size of coefficients with n_features + 1\n"
76-
f"expected {n_features + 1}, got {len(w)}")
75+
"w should be of size n_features + 1 when using fit_intercept=True: "
76+
f"expected {n_features + 1}, got {len(w)}.")
7777
else:
7878
val_error_message = (
79-
"Inconsistent size of coefficients with n_features\n"
80-
f"expected {n_features}, got {len(w)}")
79+
"w should be of size n_features: "
80+
f"expected {n_features}, got {len(w)}.")
8181
raise ValueError(val_error_message)
8282

8383
datafit.initialize(X, y)

skglm/solvers/multitask_bcd_solver.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -222,12 +222,12 @@ def multitask_bcd_solver(
222222
if W.shape[0] != n_features + fit_intercept:
223223
if fit_intercept:
224224
val_error_message = (
225-
"Inconsistent size of coefficients with n_features + 1\n"
226-
f"expected {n_features + 1}, got {W.shape[0]}")
225+
"W.shape[0] should be n_features + 1 when using fit_intercept=True: "
226+
f"expected {n_features + 1}, got {W.shape[0]}.")
227227
else:
228228
val_error_message = (
229-
"Inconsistent size of coefficients with n_features\n"
230-
f"expected {n_features}, got {W.shape[0]}")
229+
"W.shape[0] should be of size n_features: "
230+
f"expected {n_features}, got {W.shape[0]}.")
231231
raise ValueError(val_error_message)
232232

233233
is_sparse = sparse.issparse(X)

0 commit comments

Comments
 (0)