-
Couldn't load subscription status.
- Fork 17
Add configs and parser for scalar adjustments #235
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
Draft
m-d-bowerman
wants to merge
32
commits into
main
Choose a base branch
from
kpi_forecasting_add_scalar_forecasting
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.
Draft
Changes from 12 commits
Commits
Show all changes
32 commits
Select commit
Hold shift + click to select a range
4c6d618
Add configs and parser for scalar adjustments
m-d-bowerman 67cb204
Remove comment
m-d-bowerman f00ec82
ScalarAdjustments docstring update
m-d-bowerman ae4d1f3
Update to use dataclass and remove classmethod
m-d-bowerman 843c8f2
Add ScalarForecast class
m-d-bowerman eeb2308
Remove unneeded class
m-d-bowerman b7b079d
Remove unused imports
m-d-bowerman cfd7b81
Fillna for scalar columns with 1
m-d-bowerman da13c85
Fix error, caps for module-level variables
m-d-bowerman 4797042
Fix Ruff errors
m-d-bowerman ae6d4a6
Update post_init to remove arguments
m-d-bowerman 5d8797d
Reference alias instead of slug
m-d-bowerman 9971b46
Add base data pull class and class to pull forecast data
m-d-bowerman 6d3fb98
Update link to metric hub github.io
m-d-bowerman b64c21f
Keep metric_hub attribute in BaseForecast
m-d-bowerman 53ab92b
Add scalar model configs and updates
m-d-bowerman 963dd0a
Metric hub query logic updates
m-d-bowerman c169af2
Remove unneeded break and add comment
m-d-bowerman 436a364
Updates to summarize methods for scalars
m-d-bowerman ba6c544
Ad clicks scalar model config
m-d-bowerman df6bac2
Rename config
m-d-bowerman 04d956e
Rename config again
m-d-bowerman 6fde34d
Fix error in inputs
m-d-bowerman fd27d5a
Fix start date for monthly forecasts
m-d-bowerman 809fa2c
Config update
m-d-bowerman 86dff3f
Remove forecast adjustment methods
m-d-bowerman 4b5b5e6
Add tests
m-d-bowerman df69c0f
Update tests
m-d-bowerman 3f1ece7
Remove unneeded variable
m-d-bowerman b75c46a
Fixes error in pulling training data from Prophet model
m-d-bowerman 18dead8
Adjust post_init for testing
m-d-bowerman c619059
Ruff format changes
m-d-bowerman File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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
105 changes: 105 additions & 0 deletions
105
jobs/kpi-forecasting/kpi_forecasting/configs/model_inputs/scalar_adjustments.yaml
This file contains hidden or 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,105 @@ | ||
| --- | ||
| search_forecasting_revenue_per_ad_click: | ||
| - name: "year_over_year_growth" | ||
| description: "Estimate of YoY growth in RPC, from input from stakeholders." | ||
| adjustments: | ||
| - forecast_start_date: "2024-01-01" | ||
| segments: | ||
| - segment: | ||
| { | ||
| partner: "Google", | ||
| country: "US", | ||
| device: "desktop", | ||
| channel: "all", | ||
| } | ||
| adjustments: | ||
| - start_date: "2024-01-01" | ||
| value: 1.03 | ||
| - segment: | ||
| { | ||
| partner: "Google", | ||
| country: "ROW", | ||
| device: "desktop", | ||
| channel: "all", | ||
| } | ||
| adjustments: | ||
| - start_date: "2024-01-01" | ||
| value: 1.04 | ||
| - segment: | ||
| { | ||
| partner: "Google", | ||
| country: "ROW", | ||
| device: "mobile", | ||
| channel: "all", | ||
| } | ||
| adjustments: | ||
| - start_date: "2024-01-01" | ||
| value: 1.04 | ||
| - forecast_start_date: "2024-04-01" | ||
| segments: | ||
| - segment: | ||
| { | ||
| partner: "Google", | ||
| country: "US", | ||
| device: "desktop", | ||
| channel: "all", | ||
| } | ||
| adjustments: | ||
| - start_date: "2024-01-01" | ||
| value: 1.10 | ||
| - segment: | ||
| { | ||
| partner: "Google", | ||
| country: "ROW", | ||
| device: "desktop", | ||
| channel: "all", | ||
| } | ||
| adjustments: | ||
| - start_date: "2024-01-01" | ||
| value: 1.10 | ||
| - segment: | ||
| { | ||
| partner: "Google", | ||
| country: "ROW", | ||
| device: "mobile", | ||
| channel: "all", | ||
| } | ||
| adjustments: | ||
| - start_date: "2024-01-01" | ||
| value: 1.04 | ||
| - forecast_start_date: "2024-05-01" | ||
| segments: | ||
| - segment: | ||
| { | ||
| partner: "Google", | ||
| country: "US", | ||
| device: "desktop", | ||
| channel: "all", | ||
| } | ||
| adjustments: | ||
| - start_date: "2024-01-01" | ||
| value: 1.10 | ||
| - start_date: "2024-08-01" | ||
| value: 1.03 | ||
| - segment: | ||
| { | ||
| partner: "Google", | ||
| country: "ROW", | ||
| device: "desktop", | ||
| channel: "all", | ||
| } | ||
| adjustments: | ||
| - start_date: "2024-01-01" | ||
| value: 1.10 | ||
| - start_date: "2024-08-01" | ||
| value: 1.04 | ||
| - segment: | ||
| { | ||
| partner: "Google", | ||
| country: "ROW", | ||
| device: "mobile", | ||
| channel: "all", | ||
| } | ||
| adjustments: | ||
| - start_date: "2024-01-01" | ||
| value: 1.04 |
31 changes: 31 additions & 0 deletions
31
jobs/kpi-forecasting/kpi_forecasting/configs/search_forecasting_revenue_per_ad_click.yaml
This file contains hidden or 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,31 @@ | ||
| --- | ||
| metric_hub: | ||
| app_name: "multi_product" | ||
| slug: "search_forecasting_revenue_per_ad_click" | ||
| alias: "search_forecasting_revenue_per_ad_click" | ||
| start_date: "2020-01-01" | ||
| end_date: "last complete month" | ||
| segments: | ||
| device: "device" | ||
| channel: "'all'" | ||
| country: "CASE WHEN country = 'US' THEN 'US' ELSE 'ROW' END" | ||
| partner: "partner" | ||
| where: "partner = 'Google'" | ||
|
|
||
| forecast_model: | ||
| model_type: "scalar" | ||
| start_date: NULL | ||
| end_date: NULL | ||
| use_holidays: False | ||
| parameters: | ||
| formula: "search_forecasting_revenue_per_ad_click:YOY * scalar" | ||
|
|
||
| summarize: | ||
| requires_summarization: False | ||
| periods: ["month"] | ||
|
|
||
| write_results: | ||
| project: "moz-fx-data-shared-prod" | ||
| dataset: "revenue_derived" | ||
| table: "search_revenue_forecasts_v1" | ||
| components_table: "search_revenue_model_components_v1" |
This file contains hidden or 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
Oops, something went wrong.
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.
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.
Is the idea that
matched_adjustmentis the most recent element ofsorted_parsed_name_adjustments? If so, it looks likemaxtakes a key function.