Skip to content

Commit

Permalink
feat: raise value error for shape mismatch on hierarchical
Browse files Browse the repository at this point in the history
  • Loading branch information
FBruzzesi committed Jan 17, 2025
1 parent 9c53551 commit c3e9b4e
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions sklego/meta/hierarchical_predictor.py
Original file line number Diff line number Diff line change
Expand Up @@ -287,6 +287,10 @@ def fit(self, X, y=None):
global_series = nw.new_series(
name=self._GLOBAL_NAME, values=np.ones(n_samples), native_namespace=native_namespace
)
if len(target_series) != n_samples:
msg = f"Found input variables with inconsistent numbers of samples: {[n_samples, len(target_series)]}"
raise ValueError(msg)

frame = X.with_columns(
**{
self._TARGET_NAME: target_series,
Expand Down

0 comments on commit c3e9b4e

Please sign in to comment.