Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use ModelBuilder for incrementality model #1101

Merged
merged 4 commits into from
Oct 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion pymc_marketing/model_builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -580,11 +580,15 @@ def fit(
Initializing NUTS using jitter+adapt_diag...

"""
if isinstance(y, pd.Series) and not X.index.equals(y.index):
wd60622 marked this conversation as resolved.
Show resolved Hide resolved
raise ValueError("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)
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