-
Notifications
You must be signed in to change notification settings - Fork 287
Fix BudgetOptimizer docstrings #1705
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
base: main
Are you sure you want to change the base?
Fix BudgetOptimizer docstrings #1705
Conversation
budgets_to_optimize : xarray.DataArray, optional | ||
Mask defining a subset of budgets to optimize. Non-optimized budgets remain fixed at 0. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This perhaps would need an example to specify the required shape for the mask.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Take a look here:
import numpy as np
import pandas as pd
import xarray as xr
# Create simulated data with only date and channel dimensions
channels = ['TV', 'Radio', 'Social', 'Display', 'Search'] # All available channels
dates = pd.date_range('2023-01-01', periods=10, freq='W')
# Create sample channel_data (shape: date, channel)
channel_data = xr.DataArray(
np.random.rand(len(dates), len(channels)),
coords={
'date': dates,
'channel': channels
},
dims=['date', 'channel']
)
# Select which channels to optimize
channels_to_optimize = ['TV', 'Search'] # Only optimize these 2 channels
# Create the budget mask (removing date dimension)
# First, take the max across dates to get a template with only channel dimension
channel_template = channel_data.max('date') # Shape: (channel)
# Create boolean mask - True only for channels we want to optimize
budgets_to_optimize = xr.DataArray(
[ch in channels_to_optimize for ch in channels],
coords={'channel': channels},
dims=['channel']
)
print("Channel data shape:", channel_data.shape)
print("Budgets to optimize mask:")
print(budgets_to_optimize)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@TeemuSailynoja Are you planning to add the example? if so, we can merge after otherwise, we can just add an issue and merge this one!
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #1705 +/- ##
=======================================
Coverage 91.59% 91.59%
=======================================
Files 60 60
Lines 6778 6778
=======================================
Hits 6208 6208
Misses 570 570 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Description
Related Issue
BudgetOptimizer
docstring #1661Checklist
pre-commit.ci autofix
to auto-fix.📚 Documentation preview 📚: https://pymc-marketing--1705.org.readthedocs.build/en/1705/