Skip to content

Commit

Permalink
use the modelbuilder mixin
Browse files Browse the repository at this point in the history
  • Loading branch information
wd60622 committed Oct 22, 2024
1 parent a0f0d67 commit b97c945
Show file tree
Hide file tree
Showing 2 changed files with 160 additions and 111 deletions.
8 changes: 7 additions & 1 deletion pymc_marketing/model_builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -580,11 +580,17 @@ def fit(
Initializing NUTS using jitter+adapt_diag...
"""
if isinstance(y, pd.Series) and not X.index.equals(y.index):

Check warning on line 583 in pymc_marketing/model_builder.py

View check run for this annotation

Codecov / codecov/patch

pymc_marketing/model_builder.py#L583

Added line #L583 was not covered by tests
raise ValueError( # pragma: no cover
"Index of X and y must match."
)

if predictor_names is None:
predictor_names = []
if y is None:
y = np.zeros(X.shape[0])
y_df = pd.DataFrame({self.output_var: y})

y_df = pd.DataFrame({self.output_var: y}, index=X.index)

Check warning on line 593 in pymc_marketing/model_builder.py

View check run for this annotation

Codecov / codecov/patch

pymc_marketing/model_builder.py#L593

Added line #L593 was not covered by tests
self._generate_and_preprocess_model_data(X, y_df.values.flatten())
if self.X is None or self.y is None:
raise ValueError("X and y must be set before calling build_model!")
Expand Down
Loading

0 comments on commit b97c945

Please sign in to comment.