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
def execute_cross_validation_and_performance_loop(cross_valid_params, metric = 'mse'): | |
""" Execute Cross Validation and Performance Loop | |
To complement Medium Blog Post: Prophet Auto Selection with Cross-Validation | |
Link https://medium.com/@jeanphilippemallette/prophet-auto-selection-with-cross-validation-7ba2c0a3beef | |
Parameters | |
---------- | |
cross_valid_params: List of dict | |
dict value same as cross_validation function argument | |
model, horizon, period, initial |
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
from itertools import product | |
from fbprophet import Prophet | |
m = Prophet() | |
param_grid = { | |
'model' : [m] | |
, 'initial' : ['730 days','500 days'] | |
, 'period' : ['180 days'] |
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
# Create params grid object | |
from sklearn.model_selection import ParameterGrid | |
param_grid = { | |
'model' : [m] | |
, 'initial' : ['730 days','500 days'] | |
, 'period' : ['180 days'] | |
, 'horizon' : ['365 days'] | |
} |