-
Notifications
You must be signed in to change notification settings - Fork 344
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
Exposure fitting, curve calibration & reach and frequency allocator #1132
Open
gufengzhou
wants to merge
26
commits into
main
Choose a base branch
from
reach_and_frequency
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- in order to use real exposure metrics in modeling, fit_spend_exposure must be inverted into spend ~ exposure - adapted vmax start value to avoid 0 denominator in the inverted equation - adapted spend exposure plots - the impact on saturation curve and budget allocation needs to be reassessed
- now only warns weak relationship when both rsq_nls and rsq_lm are smaller than threshold
- exposure_handling function for better R&F integration and readability - better col readability in dt_plotNLS - simplify dt_transform ETL
This is the proof of concept of a R&F allocator that includes - Simulated R&F data - Implemented multiplicative model - visualisation of surface - R&F allocator with nlopt - constrain validation
- Imp/GRP will be used for parent model fitting. This addition aims to decompose saturated imp into its R&F component with separated saturation - R&F will obtain the same adstock param as imp and be transformed. No separated adstock param estimation - Then adstocked R&F will be fitted with different hill transformations (diff set of alphas /gammas) - The R&F hill params are estimated using a multiplicative equation with Nevergrad - First simulated results shows close to perfect R&F->Imp fitting.
- Deprecate function fit_spend_exposure, incl. Michaelis Menten. Nonlinear fitting between spend and exposure wasn't improving fitting significantly. Instead, future curve calibration feature will aim to improve curve identification. - Use linear model only: cpm as ratio for spend to exposure translation. - remove minpack.lm / nlsLM dependency - robyn_input() works - to-do: export InputCollect$ExposureCollect$plot_spend_exposure
- update exposure handling, esp. introduce metric "cost per exposure" as linear scaler between expo and spend. - use cpe_window to scale the whole dataset in order to obtain the right spend scale for modeling period. - simplify check_varnames - update check_paidmedia - update check_factorvars
- exposure_handling with scaled spend will now replace respective media exposure vars in dt_transform - adapt model.R, incl. reset run_transformations params to have clearer overview of params needed. - simplify transformation.R by removing unnecessary checks - remove documentation for fit_spend_exposure - include rlang::`:=` operater for easier dynamic variable assignment in the future - check with document update successful. no error /no warning/ no notes
- In model.R & pareto.R: remove decompSpendDist from both scripts to reduce memory leak. Use xDecompAgg subsets instead - In transformation.R & response.R: unify transformation namings in run_transformation and robyn_response - In response.R: remove exposure extrapolation because it's already done in robyn_input. Also add inflexion point to output. - In plots.R: fix onepager saturation plot issues - In pareto.R: rewrite run_dt_resp() as response_wrapper and align transformation logic & naming. - In pareto: Replace foreach response loop with lapply for simplicity. - In pareto.R: Simplify plot data generation process, esp for saturation curve plot, actual vs predicted plot & immediate vs carryover plot. - In pareto.R: Remove redundancy in xDecompVecCollect -> remove type rawMedia, rawSpend, predictedExposure, saturatedMedia & saturatedSpendReversed. Only keep adstockedMedia & decompMedia for response curve plotting.
- add titles and change y axis.
- use reach Halo cumulative reach and simulated spend - curve fitting with Hill using Nevergrad - early stop convergence with while loop - CI range for alpha & gamma - plotting
- Create robyn_calibrate that consumes curve input and outputs hyperparameter ranges as input. - Rename previous internal robyn_calibrate function as lift_calibration - add support function .dot_product, .qti, .mse_loss, geom_density_ci, check_qti - to-do: Dataframe input df_curve_sot needs to be extended for multiple campaigns. Plot needs to be exported. New checks needed too.
- include inflexion into resultHypParam for better curve calibration handling - fix plot warning
- replace paid_media_spend with paid_media_selected in script - clean up variable retrieval and sorting - deprecate get_hill_params because inflexions are now included in resultHypParam
- fix transformation loop error - add set_default_hyppar for easier testing
…mental/Robyn into reach_and_frequency
- add param force_curve in robyn_calibrate to allow c or s shape control - change inflexion calculation to sum(x) * gamma to increase flexibility of inflexion point
facebook-github-bot
added
the
CLA Signed
This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed.
label
Nov 12, 2024
simplfy allocator checks
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
CLA Signed
This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Type of change
Unit test (tbc)