You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
ValueError Traceback (most recent call last)
Cell In[51], line 3
1 df_estimator = LmerRegressor("DV ~ IV2 + (IV2|Group)", X_cols=df.columns)
2 df_estimator.fit(data=train)
----> 3 df_preds = df_estimator.predict(test)
File ~/.conda/envs/sklmer/lib/python3.12/site-packages/sklmer/_estimators.py:126, in LmerRegressor.predict(self, X, data, **kwargs)
124 except KeyError:
125 use_rfx = self.predict_rfx
--> 126 return self.model.predict(data, use_rfx, **kwargs)
File ~/.conda/envs/sklmer/lib/python3.12/site-packages/pymer4/models/Lmer.py:986, in Lmer.predict(self, data, use_rfx, pred_type, skip_data_checks, verify_predictions, verbose)
984 preds = predict_func(self.model_obj, pandas2R(data))
985 if verify_predictions:
--> 986 self._verify_preds(preds, use_rfx)
987 return preds
File ~/.conda/envs/sklmer/lib/python3.12/site-packages/pymer4/models/Lmer.py:1008, in Lmer._verify_preds(self, preds, use_rfx)
1003 training_preds = self.predict(
1004 self.data, use_rfx=use_rfx, skip_data_checks=True, verify_predictions=False
1005 )
1006 mess = "(using rfx)" if use_rfx else "(without rfx)"
-> 1008 if np.allclose(training_preds, preds):
1009 raise ValueError(
1010 f"Predictions are identitical to fitted values {mess}!!\nYou can ignore this error if you intended to predict using the same data the model was trained on by setting verify_predictions=False. If you didn't, then its likely that some or all of the column names in your test data don't match the column names from the data the model was trained on and you set skip_data_checks=True."
1011 )
File ~/.conda/envs/sklmer/lib/python3.12/site-packages/numpy/core/numeric.py:2241, in allclose(a, b, rtol, atol, equal_nan)
2170 @array_function_dispatch(_allclose_dispatcher)
2171 def allclose(a, b, rtol=1.e-5, atol=1.e-8, equal_nan=False):
2172 """
2173 Returns True if two arrays are element-wise equal within a tolerance.
2174
(...)
2239
2240 """
-> 2241 res = all(isclose(a, b, rtol=rtol, atol=atol, equal_nan=equal_nan))
2242 return bool(res)
File ~/.conda/envs/sklmer/lib/python3.12/site-packages/numpy/core/numeric.py:2351, in isclose(a, b, rtol, atol, equal_nan)
2349 yfin = isfinite(y)
2350 if all(xfin) and all(yfin):
-> 2351 return within_tol(x, y, atol, rtol)
2352 else:
2353 finite = xfin & yfin
File ~/.conda/envs/sklmer/lib/python3.12/site-packages/numpy/core/numeric.py:2332, in isclose.<locals>.within_tol(x, y, atol, rtol)
2330 def within_tol(x, y, atol, rtol):
2331 with errstate(invalid='ignore'), _no_nep50_warning():
-> 2332 return less_equal(abs(x-y), atol + rtol * abs(y))
ValueError: operands could not be broadcast together with shapes (470,) (94,)
Basically, predict is expecting the same dimensions in test than in training. Is this due to any Python or numpy update?
Thanks!
The text was updated successfully, but these errors were encountered:
Hi, when running the examples provided in the repo, predict, or cross_val_score raises the following error:
`---------------------------------------------------------------------------
Basically, predict is expecting the same dimensions in test than in training. Is this due to any Python or numpy update?
Thanks!
The text was updated successfully, but these errors were encountered: