%3CLINGO-SUB%20id%3D%22lingo-sub-1119974%22%20slang%3D%22en-US%22%3ETime-series%20and%20Deep%20Learning%20models%3A%20A%20Capstone%20Project%20with%20Massachusetts%20Institute%20of%20Technology%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1119974%22%20slang%3D%22en-US%22%3E%3CP%20style%3D%22text-align%3A%20justify%3B%22%3EIn%20the%20past%20few%20months%2C%20we%20have%20been%20collaborating%20on%20a%20machine%20learning%20and%20deep%20learning%20Capstone%20Project%20with%20Massachusetts%20Institute%20of%20Technology%20(MIT)%E2%80%99s%20%3CA%20href%3D%22https%3A%2F%2Fmitsloan.mit.edu%2Fmaster-of-business-analytics%23tour-welcome%22%20target%3D%22_self%22%20rel%3D%22nofollow%20noopener%20noreferrer%22%3EMaster%20of%20Business%20Analytics%3C%2FA%3E%3A%20as%20we%20discussed%20in%20our%20previous%20blog%20post%20%3CA%20id%3D%22link_9%22%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Feducator-developer-blog%2Fmachine-learning-for-sales-forecasting-a-capstone-project-with%2Fba-p%2F1091578%22%20target%3D%22_self%22%3EMachine%20Learning%20for%20Sales%20Forecasting%3A%20A%20Capstone%20Project%20with%20Columbia%20University%2C%3C%2FA%3E%26nbsp%3Bcapstone%20projects%20are%20applied%20and%20experimental%20projects%20where%20students%20take%20what%20they%20have%20learned%20throughout%20the%20course%20of%20their%20graduate%20program%20and%20apply%20it%20to%20examine%20a%20specific%20area%20of%20study.%3C%2FP%3E%0A%3CP%20style%3D%22text-align%3A%20justify%3B%22%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%20style%3D%22text-align%3A%20justify%3B%22%3EMIT's%20Master%20of%20Business%20Analytics%26nbsp%3Bis%20a%2012-month%20program%20focused%20on%20applying%20the%20tools%20of%20modern%20data%20science%2C%20optimization%2C%20and%20machine%20learning%20to%20solve%20real-world%20business%20problems.%20Students%20built%20an%20end-to-end%20time%20series%20solution%20using%20%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fazure%2Fmachine-learning%2Foverview-what-is-azure-ml%3FWT.mc_id%3Dtechcommunity-article-lazzeri%22%20target%3D%22_self%22%20rel%3D%22noopener%20noreferrer%22%3EAzure%20Machine%20Learning%3C%2FA%3E%2C%20which%26nbsp%3Bis%20a%20cloud-based%20environment%20that%20you%20can%20use%20to%20train%2C%20deploy%2C%20automate%2C%20manage%2C%20and%20track%20ML%20models.%3C%2FP%3E%0A%3CP%20style%3D%22text-align%3A%20justify%3B%22%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%20style%3D%22text-align%3A%20justify%3B%22%3E%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fazure%2Fmachine-learning%2Foverview-what-is-azure-ml%3FWT.mc_id%3Dtechcommunity-article-lazzeri%22%20target%3D%22_self%22%20rel%3D%22noopener%20noreferrer%22%3EAzure%20Machine%20Learning%3C%2FA%3E%20can%20be%20used%20for%20any%20kind%20of%20machine%20learning%2C%20from%20classical%20machine%20learning%20to%20deep%20learning%2C%20supervised%2C%20and%20unsupervised%20learning.%20Whether%20you%20prefer%20to%20write%20Python%20or%20R%20code%20or%20zero-code%2Flow-code%20options%20such%20as%20the%20designer%2C%20you%20can%20build%2C%20train%2C%20and%20track%20highly%20accurate%20machine%20learning%20and%20deep-learning%20models%20in%20an%20%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fazure%2Fmachine-learning%2Ftutorial-1st-experiment-sdk-setup%3FWT.mc_id%3Dtechcommunity-article-lazzeri%22%20target%3D%22_self%22%20rel%3D%22noopener%20noreferrer%22%3EAzure%20Machine%20Learning%20Workspace%3C%2FA%3E%3A%3C%2FP%3E%0A%3CP%20style%3D%22text-align%3A%20justify%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-center%22%20style%3D%22width%3A%20999px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F166273i1206490332761E1B%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20alt%3D%22create-workspace.gif%22%20title%3D%22create-workspace.gif%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%20style%3D%22text-align%3A%20justify%3B%22%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%20style%3D%22text-align%3A%20justify%3B%22%3EIn%20this%20article%2C%20we%20use%20an%20approach%20also%20used%20by%20MIT%20students%20and%20we%20will%20show%20you%20how%20configure%20and%20auto-train%20a%20time-series%20forecasting%20model.%26nbsp%3BConfiguring%20a%20forecasting%20model%20is%20similar%20to%20setting%20up%20a%20standard%20regression%20model%20using%20a%3CSPAN%3Eutomated%20machine%20learning%20(%3C%2FSPAN%3E%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fazure%2Fmachine-learning%2Fservice%2Fconcept-automated-ml%3FWT.mc_id%3Dtechcommunity-article-lazzeri%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3Eautomated%20ML%3C%2FA%3E%3CSPAN%3E%26nbsp%3Bor%20AutoML)%3C%2FSPAN%3E%2C%20but%20certain%20configuration%20options%20and%20pre-processing%20steps%20exist%20for%20working%20with%20time-series%20data.%20The%20following%20examples%20show%20you%20how%20to%3A%3C%2FP%3E%0A%3CUL%20style%3D%22text-align%3A%20justify%3B%22%3E%0A%3CLI%3EPrepare%20data%20for%20time%20series%20modeling%3C%2FLI%3E%0A%3CLI%3EConfigure%20specific%20time-series%20parameters%20in%20an%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fpython%2Fapi%2Fazureml-train-automl-client%2Fazureml.train.automl.automlconfig.automlconfig%3Fview%3Dazure-ml-py%26amp%3BWT.mc_id%3Dtechcommunity-article-lazzeri%22%20target%3D%22_self%22%20data-linktype%3D%22absolute-path%22%20rel%3D%22noopener%20noreferrer%22%3E%3CCODE%3EAutoMLConfig%3C%2FCODE%3E%3C%2FA%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Eobject%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3CP%20style%3D%22text-align%3A%20justify%3B%22%3EYou%20can%20find%20the%20full%20tutorial%20on%20how%20to%20train%20a%20time%20series%20forecasting%20model%20%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fazure%2Fmachine-learning%2Fhow-to-auto-train-forecast%3FWT.mc_id%3Dtechcommunity-article-lazzeri%22%20target%3D%22_self%22%20rel%3D%22noopener%20noreferrer%22%3Ehere%3C%2FA%3E.%20You%20can%20use%20%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fazure%2Fmachine-learning%2Fconcept-automated-ml%3FWT.mc_id%3Dtechcommunity-article-lazzeri%22%20target%3D%22_self%22%20rel%3D%22noopener%20noreferrer%22%3Eautomated%20ML%3C%2FA%3E%20to%20combine%20techniques%20and%20approaches%20and%20get%20a%20recommended%2C%20high-quality%20time-series%20forecast.%20An%20automated%20time-series%20experiment%20is%20treated%20as%20a%20multivariate%20regression%20problem.%20Past%20time-series%20values%20are%20%E2%80%9Cpivoted%E2%80%9D%20to%20become%20additional%20dimensions%20for%20the%20regressor%20together%20with%20other%20predictors.%3C%2FP%3E%0A%3CP%20style%3D%22text-align%3A%20justify%3B%22%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%20style%3D%22text-align%3A%20justify%3B%22%3EYou%20can%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fazure%2Fmachine-learning%2Fhow-to-auto-train-forecast%23config%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%20data-linktype%3D%22self-bookmark%22%3Econfigure%3C%2FA%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Ehow%20far%20into%20the%20future%20the%20forecast%20should%20extend%20(the%20forecast%20horizon)%2C%20as%20well%20as%20lags%20and%20more.%20%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fazure%2Fmachine-learning%2Fconcept-automated-ml%3FWT.mc_id%3Dtechcommunity-article-lazzeri%22%20target%3D%22_self%22%20rel%3D%22noopener%20noreferrer%22%3EAutomated%20ML%3C%2FA%3E%20learns%20a%20single%2C%20but%20often%20internally%20branched%20model%20for%20all%20items%20in%20the%20dataset%20and%20prediction%20horizons.%20More%20data%20is%20thus%20available%20to%20estimate%20model%20parameters%20and%20generalization%20to%20unseen%20series%20becomes%20possible.%3C%2FP%3E%0A%3CP%20style%3D%22text-align%3A%20justify%3B%22%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%20style%3D%22text-align%3A%20justify%3B%22%3EFeatures%20extracted%20from%20the%20training%20data%20play%20a%20critical%20role.%20And%2C%20%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fazure%2Fmachine-learning%2Fconcept-automated-ml%3FWT.mc_id%3Dtechcommunity-article-lazzeri%22%20target%3D%22_self%22%20rel%3D%22noopener%20noreferrer%22%3Eautomated%20ML%3C%2FA%3E%20performs%20standard%20pre-processing%20steps%20and%20generates%20additional%20time-series%20features%20to%20capture%20seasonal%20effects%20and%20maximize%20predictive%20accuracy.%3C%2FP%3E%0A%3CP%20style%3D%22text-align%3A%20justify%3B%22%3E%26nbsp%3B%3C%2FP%3E%0A%3CH2%20id%3D%22time-series-and-deep-learning-models%22%20style%3D%22text-align%3A%20justify%3B%22%20id%3D%22toc-hId--1415265874%22%20id%3D%22toc-hId--1414619307%22%3ETime-series%20and%20Deep%20Learning%20models%3C%2FH2%3E%0A%3CP%20style%3D%22text-align%3A%20justify%3B%22%3E%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fazure%2Fmachine-learning%2Fconcept-automated-ml%3FWT.mc_id%3Dtechcommunity-article-lazzeri%22%20target%3D%22_self%22%20rel%3D%22noopener%20noreferrer%22%3EAutomated%20ML%3C%2FA%3E%20provides%20users%20with%20both%20native%20time-series%20and%20deep%20learning%20models%20as%20part%20of%20the%20recommendation%20system.%20These%20learners%20include%3A%3C%2FP%3E%0A%3CUL%20style%3D%22text-align%3A%20justify%3B%22%3E%0A%3CLI%3EProphet%3C%2FLI%3E%0A%3CLI%3EAuto-ARIMA%3C%2FLI%3E%0A%3CLI%3EForecastTCN%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3CP%20style%3D%22text-align%3A%20justify%3B%22%3EAutomated%20ML's%20deep%20learning%20allows%20for%20forecasting%20univariate%20and%20multivariate%20time%20series%20data.%3C%2FP%3E%0A%3CP%20style%3D%22text-align%3A%20justify%3B%22%3EDeep%20learning%20models%20have%20three%20intrinsic%20capabilities%3A%3C%2FP%3E%0A%3COL%20style%3D%22text-align%3A%20justify%3B%22%3E%0A%3CLI%3EThey%20can%20learn%20from%20arbitrary%20mappings%20from%20inputs%20to%20outputs%3C%2FLI%3E%0A%3CLI%3EThey%20support%20multiple%20inputs%20and%20outputs%3C%2FLI%3E%0A%3CLI%3EThey%20can%20automatically%20extract%20patterns%20in%20input%20data%20that%20spans%20over%20long%20sequences%3C%2FLI%3E%0A%3C%2FOL%3E%0A%3CP%20style%3D%22text-align%3A%20justify%3B%22%3EGiven%20larger%20data%2C%20deep%20learning%20models%2C%20such%20as%20Microsoft's%20ForecastTCN%2C%20can%20improve%20the%20scores%20of%20the%20resulting%20model.%3C%2FP%3E%0A%3CP%20style%3D%22text-align%3A%20justify%3B%22%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%20style%3D%22text-align%3A%20justify%3B%22%3ENative%20time%20series%20learners%20are%20also%20provided%20as%20part%20of%20automated%20ML.%20Prophet%20works%20best%20with%20time%20series%20that%20have%20strong%20seasonal%20effects%20and%20several%20seasons%20of%20historical%20data.%20Prophet%20is%20accurate%20%26amp%3B%20fast%2C%20robust%20to%20outliers%2C%20missing%20data%2C%20and%20dramatic%20changes%20in%20your%20time%20series.%3C%2FP%3E%0A%3CP%20style%3D%22text-align%3A%20justify%3B%22%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%20style%3D%22text-align%3A%20justify%3B%22%3EAutoRegressive%20Integrated%20Moving%20Average%20(ARIMA)%20is%20a%20popular%20statistical%20method%20for%20time%20series%20forecasting.%20This%20technique%20of%20forecasting%20is%20commonly%20used%20in%20short%20term%20forecasting%20scenarios%20where%20data%20shows%20evidence%20of%20trends%20such%20as%20cycles%2C%20which%20can%20be%20unpredictable%20and%20difficult%20to%20model%20or%20forecast.%20Auto-ARIMA%20transforms%20your%20data%20into%20stationary%20data%20to%20receive%20consistent%2C%20reliable%20results.%3C%2FP%3E%0A%3CH2%20style%3D%22text-align%3A%20justify%3B%22%20id%3D%22toc-hId-1072246959%22%20id%3D%22toc-hId-1072893526%22%3E%26nbsp%3B%3C%2FH2%3E%0A%3CH2%20id%3D%22preparing-data%22%20style%3D%22text-align%3A%20justify%3B%22%20id%3D%22toc-hId--735207504%22%20id%3D%22toc-hId--734560937%22%3EPreparing%20data%3C%2FH2%3E%0A%3CP%20style%3D%22text-align%3A%20justify%3B%22%3EThe%20most%20important%20difference%20between%20a%20forecasting%20regression%20task%20type%20and%20regression%20task%20type%20within%20automated%20machine%20learning%20is%20including%20a%20feature%20in%20your%20data%20that%20represents%20a%20valid%20time%20series.%20A%20regular%20time%20series%20has%20a%20well-defined%20and%20consistent%20frequency%20and%20has%20a%20value%20at%20every%20sample%20point%20in%20a%20continuous%20time%20span.%20Consider%20the%20following%20snapshot%20of%20a%20file%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CCODE%3Esample.csv%3C%2FCODE%3E.%3C%2FP%3E%0A%3CPRE%20class%3D%22has-inner-focus%22%20tabindex%3D%220%22%3E%3CCODE%20data-author-content%3D%22day_datetime%2Cstore%2Csales_quantity%2Cweek_of_year%0A9%2F3%2F2018%2CA%2C2000%2C36%0A9%2F3%2F2018%2CB%2C600%2C36%0A9%2F4%2F2018%2CA%2C2300%2C36%0A9%2F4%2F2018%2CB%2C550%2C36%0A9%2F5%2F2018%2CA%2C2100%2C36%0A9%2F5%2F2018%2CB%2C650%2C36%0A9%2F6%2F2018%2CA%2C2400%2C36%0A9%2F6%2F2018%2CB%2C700%2C36%0A9%2F7%2F2018%2CA%2C2450%2C36%0A9%2F7%2F2018%2CB%2C650%2C36%0A%22%3Eday_datetime%2Cstore%2Csales_quantity%2Cweek_of_year%0A9%2F3%2F2018%2CA%2C2000%2C36%0A9%2F3%2F2018%2CB%2C600%2C36%0A9%2F4%2F2018%2CA%2C2300%2C36%0A9%2F4%2F2018%2CB%2C550%2C36%0A9%2F5%2F2018%2CA%2C2100%2C36%0A9%2F5%2F2018%2CB%2C650%2C36%0A9%2F6%2F2018%2CA%2C2400%2C36%0A9%2F6%2F2018%2CB%2C700%2C36%0A9%2F7%2F2018%2CA%2C2450%2C36%0A9%2F7%2F2018%2CB%2C650%2C36%0A%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CP%20style%3D%22text-align%3A%20justify%3B%22%3EThis%20data%20set%20is%20a%20simple%20example%20of%20daily%20sales%20data%20for%20a%20company%20that%20has%20two%20different%20stores%2C%20A%20and%20B.%20Additionally%2C%20there%20is%20a%20feature%20for%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CCODE%3Eweek_of_year%3C%2FCODE%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Ethat%20will%20allow%20the%20model%20to%20detect%20weekly%20seasonality.%20The%20field%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CCODE%3Eday_datetime%3C%2FCODE%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Erepresents%20a%20clean%20time%20series%20with%20daily%20frequency%2C%20and%20the%20field%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CCODE%3Esales_quantity%3C%2FCODE%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Eis%20the%20target%20column%20for%20running%20predictions.%20Read%20the%20data%20into%20a%20Pandas%20dataframe%2C%20then%20use%20the%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CCODE%3Eto_datetime%3C%2FCODE%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Efunction%20to%20ensure%20the%20time%20series%20is%20a%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CCODE%3Edatetime%3C%2FCODE%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Etype.%3C%2FP%3E%0A%3CPRE%20class%3D%22has-inner-focus%22%20tabindex%3D%220%22%3E%3CCODE%20class%3D%22lang-python%22%20data-author-content%3D%22import%20pandas%20as%20pd%0Adata%20%3D%20pd.read_csv(%26quot%3Bsample.csv%26quot%3B)%0Adata%5B%26quot%3Bday_datetime%26quot%3B%5D%20%3D%20pd.to_datetime(data%5B%26quot%3Bday_datetime%26quot%3B%5D)%0A%22%3E%3CSPAN%20class%3D%22hljs-keyword%22%3Eimport%3C%2FSPAN%3E%20pandas%20%3CSPAN%20class%3D%22hljs-keyword%22%3Eas%3C%2FSPAN%3E%20pd%0Adata%20%3D%20pd.read_csv(%3CSPAN%20class%3D%22hljs-string%22%3E%22sample.csv%22%3C%2FSPAN%3E)%0Adata%5B%3CSPAN%20class%3D%22hljs-string%22%3E%22day_datetime%22%3C%2FSPAN%3E%5D%20%3D%20pd.to_datetime(data%5B%3CSPAN%20class%3D%22hljs-string%22%3E%22day_datetime%22%3C%2FSPAN%3E%5D)%0A%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CP%20style%3D%22text-align%3A%20justify%3B%22%3EIn%20this%20case%2C%20the%20data%20is%20already%20sorted%20ascending%20by%20the%20time%20field%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CCODE%3Eday_datetime%3C%2FCODE%3E.%20However%2C%20when%20setting%20up%20an%20experiment%2C%20ensure%20the%20desired%20time%20column%20is%20sorted%20in%20ascending%20order%20to%20build%20a%20valid%20time%20series.%20Assume%20the%20data%20contains%201%2C000%20records%2C%20and%20make%20a%20deterministic%20split%20in%20the%20data%20to%20create%20training%20and%20test%20data%20sets.%20Identify%20the%20label%20column%20name%20and%20set%20it%20to%20label.%20In%20this%20example%2C%20the%20label%20will%20be%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CCODE%3Esales_quantity%3C%2FCODE%3E.%20Then%20separate%20the%20label%20field%20from%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CCODE%3Etest_data%3C%2FCODE%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Eto%20form%20the%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CCODE%3Etest_target%3C%2FCODE%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Eset.%3C%2FP%3E%0A%3CPRE%20class%3D%22has-inner-focus%22%20tabindex%3D%220%22%3E%3CCODE%20class%3D%22lang-python%22%20data-author-content%3D%22train_data%20%3D%20data.iloc%5B%3A950%5D%0Atest_data%20%3D%20data.iloc%5B-50%3A%5D%0A%0Alabel%20%3D%20%20%26quot%3Bsales_quantity%26quot%3B%0A%20%0Atest_labels%20%3D%20test_data.pop(label).values%0A%22%3Etrain_data%20%3D%20data.iloc%5B%3A%3CSPAN%20class%3D%22hljs-number%22%3E950%3C%2FSPAN%3E%5D%0Atest_data%20%3D%20data.iloc%5B%3CSPAN%20class%3D%22hljs-number%22%3E-50%3C%2FSPAN%3E%3A%5D%0A%0Alabel%20%3D%20%20%3CSPAN%20class%3D%22hljs-string%22%3E%22sales_quantity%22%3C%2FSPAN%3E%0A%20%0Atest_labels%20%3D%20test_data.pop(label).values%0A%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CDIV%20class%3D%22alert%20is-info%22%20style%3D%22text-align%3A%20justify%3B%22%3E%0A%3CP%20class%3D%22alert-title%22%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EWhen%20training%20a%20model%20for%20forecasting%20future%20values%2C%20ensure%20all%20the%20features%20used%20in%20training%20can%20be%20used%20when%20running%20predictions%20for%20your%20intended%20horizon.%20For%20example%2C%20when%20creating%20a%20demand%20forecast%2C%20including%20a%20feature%20for%20current%20stock%20price%20could%20massively%20increase%20training%20accuracy.%20However%2C%20if%20you%20intend%20to%20forecast%20with%20a%20long%20horizon%2C%20you%20may%20not%20be%20able%20to%20accurately%20predict%20future%20stock%20values%20corresponding%20to%20future%20time-series%20points%2C%20and%20model%20accuracy%20could%20suffer.%3C%2FP%3E%0A%3C%2FDIV%3E%0A%3CH2%20style%3D%22text-align%3A%20justify%3B%22%20id%3D%22toc-hId-1752305329%22%20id%3D%22toc-hId-1752951896%22%3E%26nbsp%3B%3C%2FH2%3E%0A%3CH2%20id%3D%22configure-and-run-experiment%22%20style%3D%22text-align%3A%20justify%3B%22%20id%3D%22toc-hId--55149134%22%20id%3D%22toc-hId--54502567%22%3EConfigure%20and%20run%20experiment%3C%2FH2%3E%0A%3CP%20style%3D%22text-align%3A%20justify%3B%22%3EFor%20forecasting%20tasks%2C%20automated%20machine%20learning%20uses%20pre-processing%20and%20estimation%20steps%20that%20are%20specific%20to%20time-series%20data.%20The%20following%20pre-processing%20steps%20will%20be%20executed%3A%3C%2FP%3E%0A%3CUL%20style%3D%22text-align%3A%20justify%3B%22%3E%0A%3CLI%3EDetect%20time-series%20sample%20frequency%20(for%20example%2C%20hourly%2C%20daily%2C%20weekly)%20and%20create%20new%20records%20for%20absent%20time%20points%20to%20make%20the%20series%20continuous.%3C%2FLI%3E%0A%3CLI%3EImpute%20missing%20values%20in%20the%20target%20(via%20forward-fill)%20and%20feature%20columns%20(using%20median%20column%20values)%3C%2FLI%3E%0A%3CLI%3ECreate%20grain-based%20features%20to%20enable%20fixed%20effects%20across%20different%20series%3C%2FLI%3E%0A%3CLI%3ECreate%20time-based%20features%20to%20assist%20in%20learning%20seasonal%20patterns%3C%2FLI%3E%0A%3CLI%3EEncode%20categorical%20variables%20to%20numeric%20quantities%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3CP%20style%3D%22text-align%3A%20justify%3B%22%3EThe%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fpython%2Fapi%2Fazureml-train-automl-client%2Fazureml.train.automl.automlconfig.automlconfig%3Fview%3Dazure-ml-py%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%20data-linktype%3D%22external%22%3E%3CCODE%3EAutoMLConfig%3C%2FCODE%3E%3C%2FA%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Eobject%20defines%20the%20settings%20and%20data%20necessary%20for%20an%20automated%20machine%20learning%20task.%20Similar%20to%20a%20regression%20problem%2C%20you%20define%20standard%20training%20parameters%20like%20task%20type%2C%20number%20of%20iterations%2C%20training%20data%2C%20and%20number%20of%20cross-validations.%20For%20forecasting%20tasks%2C%20there%20are%20additional%20parameters%20that%20must%20be%20set%20that%20affect%20the%20experiment.%20The%20following%20table%20explains%20each%20parameter%20and%20its%20usage.%3C%2FP%3E%0A%3CDIV%20class%3D%22table-scroll-wrapper%22%20style%3D%22text-align%3A%20justify%3B%22%3E%0A%3CTABLE%20style%3D%22height%3A%20704px%3B%20width%3A%20681px%3B%20border-style%3A%20double%3B%22%3E%0A%3CTHEAD%3E%0A%3CTR%20style%3D%22height%3A%2037px%3B%22%3E%0A%3CTH%20style%3D%22height%3A%2037px%3B%20width%3A%20225px%3B%22%3EParam%3C%2FTH%3E%0A%3CTH%20style%3D%22height%3A%2037px%3B%20width%3A%20455px%3B%22%3EDescription%3C%2FTH%3E%0A%3C%2FTR%3E%0A%3C%2FTHEAD%3E%0A%3CTBODY%3E%0A%3CTR%20style%3D%22height%3A%2057px%3B%22%3E%0A%3CTD%20style%3D%22height%3A%2057px%3B%20width%3A%20225px%3B%22%3E%3CCODE%3Etime_column_name%3C%2FCODE%3E%3C%2FTD%3E%0A%3CTD%20style%3D%22height%3A%2057px%3B%20width%3A%20455px%3B%22%3EUsed%20to%20specify%20the%20datetime%20column%20in%20the%20input%20data%20used%20for%20building%20the%20time%20series%20and%20inferring%20its%20frequency.%3C%2FTD%3E%0A%3C%2FTR%3E%0A%3CTR%20style%3D%22height%3A%2084px%3B%22%3E%0A%3CTD%20style%3D%22height%3A%2084px%3B%20width%3A%20225px%3B%22%3E%3CCODE%3Egrain_column_names%3C%2FCODE%3E%3C%2FTD%3E%0A%3CTD%20style%3D%22height%3A%2084px%3B%20width%3A%20455px%3B%22%3EName(s)%20defining%20individual%20series%20groups%20in%20the%20input%20data.%20If%20grain%20is%20not%20defined%2C%20the%20data%20set%20is%20assumed%20to%20be%20one%20time-series.%3C%2FTD%3E%0A%3C%2FTR%3E%0A%3CTR%20style%3D%22height%3A%20111px%3B%22%3E%0A%3CTD%20style%3D%22height%3A%20111px%3B%20width%3A%20225px%3B%22%3E%3CCODE%3Emax_horizon%3C%2FCODE%3E%3C%2FTD%3E%0A%3CTD%20style%3D%22height%3A%20111px%3B%20width%3A%20455px%3B%22%3EDefines%20the%20maximum%20desired%20forecast%20horizon%20in%20units%20of%20time-series%20frequency.%20Units%20are%20based%20on%20the%20time%20interval%20of%20your%20training%20data%2C%20for%20example%2C%20monthly%2C%20weekly%20that%20the%20forecaster%20should%20predict%20out.%3C%2FTD%3E%0A%3C%2FTR%3E%0A%3CTR%20style%3D%22height%3A%20273px%3B%22%3E%0A%3CTD%20style%3D%22height%3A%20273px%3B%20width%3A%20225px%3B%22%3E%3CCODE%3Etarget_lags%3C%2FCODE%3E%3C%2FTD%3E%0A%3CTD%20style%3D%22height%3A%20273px%3B%20width%3A%20455px%3B%22%3ENumber%20of%20rows%20to%20lag%20the%20target%20values%20based%20on%20the%20frequency%20of%20the%20data.%20The%20lag%20is%20represented%20as%20a%20list%20or%20single%20integer.%20Lag%20should%20be%20used%20when%20the%20relationship%20between%20the%20independent%20variables%20and%20dependent%20variable%20doesn't%20match%20up%20or%20correlate%20by%20default.%20For%20example%2C%20when%20trying%20to%20forecast%20demand%20for%20a%20product%2C%20the%20demand%20in%20any%20month%20may%20depend%20on%20the%20price%20of%20specific%20commodities%203%20months%20prior.%20In%20this%20example%2C%20you%20may%20want%20to%20lag%20the%20target%20(demand)%20negatively%20by%203%20months%20so%20that%20the%20model%20is%20training%20on%20the%20correct%20relationship.%3C%2FTD%3E%0A%3C%2FTR%3E%0A%3CTR%20style%3D%22height%3A%20111px%3B%22%3E%0A%3CTD%20style%3D%22height%3A%20111px%3B%20width%3A%20225px%3B%22%3E%3CCODE%3Etarget_rolling_window_size%3C%2FCODE%3E%3C%2FTD%3E%0A%3CTD%20style%3D%22height%3A%20111px%3B%20width%3A%20455px%3B%22%3E%3CEM%3En%3C%2FEM%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Ehistorical%20periods%20to%20use%20to%20generate%20forecasted%20values%2C%20%26lt%3B%3D%20training%20set%20size.%20If%20omitted%2C%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CEM%3En%3C%2FEM%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Eis%20the%20full%20training%20set%20size.%20Specify%20this%20parameter%20when%20you%20only%20want%20to%20consider%20a%20certain%20amount%20of%20history%20when%20training%20the%20model.%3C%2FTD%3E%0A%3C%2FTR%3E%0A%3CTR%20style%3D%22height%3A%2031px%3B%22%3E%0A%3CTD%20style%3D%22height%3A%2031px%3B%20width%3A%20225px%3B%22%3E%3CCODE%3Eenable_dnn%3C%2FCODE%3E%3C%2FTD%3E%0A%3CTD%20style%3D%22height%3A%2031px%3B%20width%3A%20455px%3B%22%3EEnable%20Forecasting%20DNNs.%3C%2FTD%3E%0A%3C%2FTR%3E%0A%3C%2FTBODY%3E%0A%3C%2FTABLE%3E%0A%3C%2FDIV%3E%0A%3CP%20style%3D%22text-align%3A%20justify%3B%22%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%20style%3D%22text-align%3A%20justify%3B%22%3ESee%20the%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fpython%2Fapi%2Fazureml-train-automl-client%2Fazureml.train.automl.automlconfig.automlconfig%3Fview%3Dazure-ml-py%3FWT.mc_id%3Dtechcommunity-article-lazzeri%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%20data-linktype%3D%22absolute-path%22%3Ereference%20documentation%3C%2FA%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Efor%20more%20information.%20Create%20the%20time-series%20settings%20as%20a%20dictionary%20object.%20Set%20the%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CCODE%3Etime_column_name%3C%2FCODE%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Eto%20the%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CCODE%3Eday_datetime%3C%2FCODE%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Efield%20in%20the%20data%20set.%20Define%20the%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CCODE%3Egrain_column_names%3C%2FCODE%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Eparameter%20to%20ensure%20that%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Etwo%20separate%20time-series%20groups%26nbsp%3Bare%20created%20for%20the%20data%3B%20one%20for%20store%20A%20and%20B.%20Lastly%2C%20set%20the%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CCODE%3Emax_horizon%3C%2FCODE%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Eto%2050%20in%20order%20to%20predict%20for%20the%20entire%20test%20set.%20Set%20a%20forecast%20window%20to%2010%20periods%20with%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CCODE%3Etarget_rolling_window_size%3C%2FCODE%3E%2C%20and%20specify%20a%20single%20lag%20on%20the%20target%20values%20for%20two%20periods%20ahead%20with%20the%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CCODE%3Etarget_lags%3C%2FCODE%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Eparameter.%20It%20is%20recommended%20to%20set%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CCODE%3Emax_horizon%3C%2FCODE%3E%2C%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CCODE%3Etarget_rolling_window_size%3C%2FCODE%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Eand%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CCODE%3Etarget_lags%3C%2FCODE%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Eto%20%22auto%22%20which%20will%20automatically%20detect%20these%20values%20for%20you.%20In%20the%20example%20below%2C%20%22auto%22%20settings%20have%20been%20used%20for%20these%20paramaters.%3C%2FP%3E%0A%3CPRE%20class%3D%22has-inner-focus%22%20tabindex%3D%220%22%3E%3CCODE%20class%3D%22lang-python%22%20data-author-content%3D%22time_series_settings%20%3D%20%7B%0A%20%20%20%20%26quot%3Btime_column_name%26quot%3B%3A%20%26quot%3Bday_datetime%26quot%3B%2C%0A%20%20%20%20%26quot%3Bgrain_column_names%26quot%3B%3A%20%5B%26quot%3Bstore%26quot%3B%5D%2C%0A%20%20%20%20%26quot%3Bmax_horizon%26quot%3B%3A%20%26quot%3Bauto%26quot%3B%2C%0A%20%20%20%20%26quot%3Btarget_lags%26quot%3B%3A%20%26quot%3Bauto%26quot%3B%2C%0A%20%20%20%20%26quot%3Btarget_rolling_window_size%26quot%3B%3A%20%26quot%3Bauto%26quot%3B%2C%0A%20%20%20%20%26quot%3Bpreprocess%26quot%3B%3A%20True%2C%0A%7D%0A%22%3Etime_series_settings%20%3D%20%7B%0A%20%20%20%20%3CSPAN%20class%3D%22hljs-string%22%3E%22time_column_name%22%3C%2FSPAN%3E%3A%20%3CSPAN%20class%3D%22hljs-string%22%3E%22day_datetime%22%3C%2FSPAN%3E%2C%0A%20%20%20%20%3CSPAN%20class%3D%22hljs-string%22%3E%22grain_column_names%22%3C%2FSPAN%3E%3A%20%5B%3CSPAN%20class%3D%22hljs-string%22%3E%22store%22%3C%2FSPAN%3E%5D%2C%0A%20%20%20%20%3CSPAN%20class%3D%22hljs-string%22%3E%22max_horizon%22%3C%2FSPAN%3E%3A%20%3CSPAN%20class%3D%22hljs-string%22%3E%22auto%22%3C%2FSPAN%3E%2C%0A%20%20%20%20%3CSPAN%20class%3D%22hljs-string%22%3E%22target_lags%22%3C%2FSPAN%3E%3A%20%3CSPAN%20class%3D%22hljs-string%22%3E%22auto%22%3C%2FSPAN%3E%2C%0A%20%20%20%20%3CSPAN%20class%3D%22hljs-string%22%3E%22target_rolling_window_size%22%3C%2FSPAN%3E%3A%20%3CSPAN%20class%3D%22hljs-string%22%3E%22auto%22%3C%2FSPAN%3E%2C%0A%20%20%20%20%3CSPAN%20class%3D%22hljs-string%22%3E%22preprocess%22%3C%2FSPAN%3E%3A%20%3CSPAN%20class%3D%22hljs-literal%22%3ETrue%3C%2FSPAN%3E%2C%0A%7D%3CBR%20%2F%3E%3CBR%20%2F%3E%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CP%20style%3D%22text-align%3A%20justify%3B%22%3EBy%20defining%20the%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CCODE%3Egrain_column_names%3C%2FCODE%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Ein%20the%20code%20snippet%20above%2C%20AutoML%20will%20create%20two%20separate%20time-series%20groups%2C%20also%20known%20as%20multiple%20time-series.%20If%20no%20grain%20is%20defined%2C%20AutoML%20will%20assume%20that%20the%20dataset%20is%20a%20single%20time-series.%20Now%20create%20a%20standard%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CCODE%3EAutoMLConfig%3C%2FCODE%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Eobject%2C%20specifying%20the%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CCODE%3Eforecasting%3C%2FCODE%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Etask%20type%2C%20and%20submit%20the%20experiment.%20After%20the%20model%20finishes%2C%20retrieve%20the%20best%20run%20iteration%3A%3CCODE%20class%3D%22lang-python%22%20data-author-content%3D%22time_series_settings%20%3D%20%7B%0A%20%20%20%20%26quot%3Btime_column_name%26quot%3B%3A%20%26quot%3Bday_datetime%26quot%3B%2C%0A%20%20%20%20%26quot%3Bgrain_column_names%26quot%3B%3A%20%5B%26quot%3Bstore%26quot%3B%5D%2C%0A%20%20%20%20%26quot%3Bmax_horizon%26quot%3B%3A%20%26quot%3Bauto%26quot%3B%2C%0A%20%20%20%20%26quot%3Btarget_lags%26quot%3B%3A%20%26quot%3Bauto%26quot%3B%2C%0A%20%20%20%20%26quot%3Btarget_rolling_window_size%26quot%3B%3A%20%26quot%3Bauto%26quot%3B%2C%0A%20%20%20%20%26quot%3Bpreprocess%26quot%3B%3A%20True%2C%0A%7D%0A%22%3E%3C%2FCODE%3E%3C%2FP%3E%0A%3CPRE%20class%3D%22has-inner-focus%22%20tabindex%3D%220%22%3E%3CCODE%20class%3D%22lang-python%22%20data-author-content%3D%22from%20azureml.core.workspace%20import%20Workspace%0Afrom%20azureml.core.experiment%20import%20Experiment%0Afrom%20azureml.train.automl%20import%20AutoMLConfig%0Aimport%20logging%0A%0Aautoml_config%20%3D%20AutoMLConfig(task%3D'forecasting'%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20primary_metric%3D'normalized_root_mean_squared_error'%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20experiment_timeout_minutes%3D15%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20enable_early_stopping%3DTrue%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20training_data%3Dtrain_data%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20label_column_name%3Dlabel%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20n_cross_validations%3D5%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20enable_ensembling%3DFalse%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20verbosity%3Dlogging.INFO%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20**time_series_settings)%0A%0Aws%20%3D%20Workspace.from_config()%0Aexperiment%20%3D%20Experiment(ws%2C%20%26quot%3Bforecasting_example%26quot%3B)%0Alocal_run%20%3D%20experiment.submit(automl_config%2C%20show_output%3DTrue)%0Abest_run%2C%20fitted_model%20%3D%20local_run.get_output()%0A%22%3E%3CSPAN%20class%3D%22hljs-keyword%22%3Efrom%3C%2FSPAN%3E%20azureml.core.workspace%20%3CSPAN%20class%3D%22hljs-keyword%22%3Eimport%3C%2FSPAN%3E%20Workspace%0A%3CSPAN%20class%3D%22hljs-keyword%22%3Efrom%3C%2FSPAN%3E%20azureml.core.experiment%20%3CSPAN%20class%3D%22hljs-keyword%22%3Eimport%3C%2FSPAN%3E%20Experiment%0A%3CSPAN%20class%3D%22hljs-keyword%22%3Efrom%3C%2FSPAN%3E%20azureml.train.automl%20%3CSPAN%20class%3D%22hljs-keyword%22%3Eimport%3C%2FSPAN%3E%20AutoMLConfig%0A%3CSPAN%20class%3D%22hljs-keyword%22%3Eimport%3C%2FSPAN%3E%20logging%0A%0Aautoml_config%20%3D%20AutoMLConfig(task%3D%3CSPAN%20class%3D%22hljs-string%22%3E'forecasting'%3C%2FSPAN%3E%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20primary_metric%3D%3CSPAN%20class%3D%22hljs-string%22%3E'normalized_root_mean_squared_error'%3C%2FSPAN%3E%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20experiment_timeout_minutes%3D%3CSPAN%20class%3D%22hljs-number%22%3E15%3C%2FSPAN%3E%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20enable_early_stopping%3D%3CSPAN%20class%3D%22hljs-literal%22%3ETrue%3C%2FSPAN%3E%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20training_data%3Dtrain_data%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20label_column_name%3Dlabel%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20n_cross_validations%3D%3CSPAN%20class%3D%22hljs-number%22%3E5%3C%2FSPAN%3E%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20enable_ensembling%3D%3CSPAN%20class%3D%22hljs-literal%22%3EFalse%3C%2FSPAN%3E%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20verbosity%3Dlogging.INFO%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20**time_series_settings)%0A%0Aws%20%3D%20Workspace.from_config()%0Aexperiment%20%3D%20Experiment(ws%2C%20%3CSPAN%20class%3D%22hljs-string%22%3E%22forecasting_example%22%3C%2FSPAN%3E)%0Alocal_run%20%3D%20experiment.submit(automl_config%2C%20show_output%3D%3CSPAN%20class%3D%22hljs-literal%22%3ETrue%3C%2FSPAN%3E)%0Abest_run%2C%20fitted_model%20%3D%20local_run.get_output()%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CH2%20style%3D%22text-align%3A%20justify%3B%22%20id%3D%22toc-hId--1862603597%22%20id%3D%22toc-hId--1861957030%22%3E%26nbsp%3B%3C%2FH2%3E%0A%3CH2%20id%3D%22toc-hId--657654732%22%20style%3D%22text-align%3A%20justify%3B%22%20id%3D%22toc-hId-624909236%22%20id%3D%22toc-hId-625555803%22%3EFinal%20resources%20to%20learn%20more%3C%2FH2%3E%0A%3CP%20style%3D%22text-align%3A%20justify%3B%22%3ETo%20learn%20more%2C%20you%20can%20read%20the%20following%20articles%20and%20notebooks%3A%3C%2FP%3E%0A%3CUL%20style%3D%22text-align%3A%20justify%3B%22%3E%0A%3CLI%3EYou%20can%20find%20the%20full%20tutorial%20on%20how%20to%20train%20a%20time%20series%20forecasting%20model%20%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fazure%2Fmachine-learning%2Fhow-to-auto-train-forecast%3FWT.mc_id%3Dtechcommunity-article-lazzeri%22%20target%3D%22_self%22%20rel%3D%22noopener%20noreferrer%22%3Ehere%3C%2FA%3E%3C%2FLI%3E%0A%3CLI%3EAzure%20Machine%20Learning%20Notebooks%3A%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Faka.ms%2FAzureMLServiceGithub%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3Eaka.ms%2FAzureMLServiceGithub%3C%2FA%3E%3C%2FLI%3E%0A%3CLI%3EAzure%20Machine%20Learning%20Service%3A%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Faka.ms%2FAzureMLservice%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3Eaka.ms%2FAzureMLservice%3C%2FA%3E%3C%2FLI%3E%0A%3CLI%3EGet%20started%20with%20Azure%20ML%3A%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Faka.ms%2FGetStartedAzureML%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3Eaka.ms%2FGetStartedAzureML%3C%2FA%3E%3C%2FLI%3E%0A%3CLI%3EAutomated%20Machine%20Learning%20Documentation%3A%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Faka.ms%2FAutomatedMLDocs%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3Ehttps%3A%2F%2Faka.ms%2FAutomatedMLDocs%3C%2FA%3E%3C%2FLI%3E%0A%3CLI%3EWhat%20is%20Automated%20Machine%20Learning%3F%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Faka.ms%2FAutomatedML%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3Ehttps%3A%2F%2Faka.ms%2FAutomatedML%3C%2FA%3E%3C%2FLI%3E%0A%3CLI%3EModel%20Interpretability%20with%20Azure%20ML%20Service%3A%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Faka.ms%2FAutomatedML%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3Ehttps%3A%2F%2Faka.ms%2F%3C%2FA%3E%3CA%20href%3D%22https%3A%2F%2Faka.ms%2FAzureMLModelInterpretability%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3EAzureMLModelInterpretability%3C%2FA%3E%3C%2FLI%3E%0A%3CLI%3EAzure%20Notebooks%3A%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Faka.ms%2FAzureNB%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3Ehttps%3A%2F%2Faka.ms%2FAzureNB%3C%2FA%3E%3C%2FLI%3E%0A%3CLI%3EPython%20Microsoft%3A%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Faka.ms%2FPythonMS%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3Ehttps%3A%2F%2Faka.ms%2FPythonMS%3C%2FA%3E%3C%2FLI%3E%0A%3CLI%3EAzure%20ML%20for%20VS%20Code%3A%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Faka.ms%2FAzureMLforVSCode%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3Eaka.ms%2FAzureMLforVSCode%3C%2FA%3E%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3CP%20style%3D%22text-align%3A%20justify%3B%22%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%20style%3D%22text-align%3A%20justify%3B%22%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%20style%3D%22text-align%3A%20justify%3B%22%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%20style%3D%22text-align%3A%20justify%3B%22%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-TEASER%20id%3D%22lingo-teaser-1119974%22%20slang%3D%22en-US%22%3E%3CP%3EIn%20this%20article%2C%20we%20will%20use%20an%20approach%20also%20used%20by%20MIT%20students%20and%20we%20will%20show%20you%20how%20to%20auto-train%20a%20time-series%20forecasting%20model.%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-TEASER%3E

In the past few months, we have been collaborating on a machine learning and deep learning Capstone Project with Massachusetts Institute of Technology (MIT)’s Master of Business Analytics: as we discussed in our previous blog post Machine Learning for Sales Forecasting: A Capstone Project with Columbia University, capstone projects are applied and experimental projects where students take what they have learned throughout the course of their graduate program and apply it to examine a specific area of study.

 

MIT's Master of Business Analytics is a 12-month program focused on applying the tools of modern data science, optimization, and machine learning to solve real-world business problems. Students built an end-to-end time series solution using Azure Machine Learning, which is a cloud-based environment that you can use to train, deploy, automate, manage, and track ML models.

 

Azure Machine Learning can be used for any kind of machine learning, from classical machine learning to deep learning, supervised, and unsupervised learning. Whether you prefer to write Python or R code or zero-code/low-code options such as the designer, you can build, train, and track highly accurate machine learning and deep-learning models in an Azure Machine Learning Workspace:

create-workspace.gif

 

In this article, we use an approach also used by MIT students and we will show you how configure and auto-train a time-series forecasting model. Configuring a forecasting model is similar to setting up a standard regression model using automated machine learning (automated ML or AutoML), but certain configuration options and pre-processing steps exist for working with time-series data. The following examples show you how to:

  • Prepare data for time series modeling
  • Configure specific time-series parameters in an AutoMLConfig object

You can find the full tutorial on how to train a time series forecasting model here. You can use automated ML to combine techniques and approaches and get a recommended, high-quality time-series forecast. An automated time-series experiment is treated as a multivariate regression problem. Past time-series values are “pivoted” to become additional dimensions for the regressor together with other predictors.

 

You can configure how far into the future the forecast should extend (the forecast horizon), as well as lags and more. Automated ML learns a single, but often internally branched model for all items in the dataset and prediction horizons. More data is thus available to estimate model parameters and generalization to unseen series becomes possible.

 

Features extracted from the training data play a critical role. And, automated ML performs standard pre-processing steps and generates additional time-series features to capture seasonal effects and maximize predictive accuracy.

 

Time-series and Deep Learning models

Automated ML provides users with both native time-series and deep learning models as part of the recommendation system. These learners include:

  • Prophet
  • Auto-ARIMA
  • ForecastTCN

Automated ML's deep learning allows for forecasting univariate and multivariate time series data.

Deep learning models have three intrinsic capabilities:

  1. They can learn from arbitrary mappings from inputs to outputs
  2. They support multiple inputs and outputs
  3. They can automatically extract patterns in input data that spans over long sequences

Given larger data, deep learning models, such as Microsoft's ForecastTCN, can improve the scores of the resulting model.

 

Native time series learners are also provided as part of automated ML. Prophet works best with time series that have strong seasonal effects and several seasons of historical data. Prophet is accurate & fast, robust to outliers, missing data, and dramatic changes in your time series.

 

AutoRegressive Integrated Moving Average (ARIMA) is a popular statistical method for time series forecasting. This technique of forecasting is commonly used in short term forecasting scenarios where data shows evidence of trends such as cycles, which can be unpredictable and difficult to model or forecast. Auto-ARIMA transforms your data into stationary data to receive consistent, reliable results.

 

Preparing data

The most important difference between a forecasting regression task type and regression task type within automated machine learning is including a feature in your data that represents a valid time series. A regular time series has a well-defined and consistent frequency and has a value at every sample point in a continuous time span. Consider the following snapshot of a file sample.csv.

day_datetime,store,sales_quantity,week_of_year
9/3/2018,A,2000,36
9/3/2018,B,600,36
9/4/2018,A,2300,36
9/4/2018,B,550,36
9/5/2018,A,2100,36
9/5/2018,B,650,36
9/6/2018,A,2400,36
9/6/2018,B,700,36
9/7/2018,A,2450,36
9/7/2018,B,650,36

This data set is a simple example of daily sales data for a company that has two different stores, A and B. Additionally, there is a feature for week_of_year that will allow the model to detect weekly seasonality. The field day_datetime represents a clean time series with daily frequency, and the field sales_quantity is the target column for running predictions. Read the data into a Pandas dataframe, then use the to_datetime function to ensure the time series is a datetime type.

import pandas as pd
data = pd.read_csv("sample.csv")
data["day_datetime"] = pd.to_datetime(data["day_datetime"])

In this case, the data is already sorted ascending by the time field day_datetime. However, when setting up an experiment, ensure the desired time column is sorted in ascending order to build a valid time series. Assume the data contains 1,000 records, and make a deterministic split in the data to create training and test data sets. Identify the label column name and set it to label. In this example, the label will be sales_quantity. Then separate the label field from test_data to form the test_target set.

train_data = data.iloc[:950]
test_data = data.iloc[-50:]

label =  "sales_quantity"
 
test_labels = test_data.pop(label).values

 

When training a model for forecasting future values, ensure all the features used in training can be used when running predictions for your intended horizon. For example, when creating a demand forecast, including a feature for current stock price could massively increase training accuracy. However, if you intend to forecast with a long horizon, you may not be able to accurately predict future stock values corresponding to future time-series points, and model accuracy could suffer.

 

Configure and run experiment

For forecasting tasks, automated machine learning uses pre-processing and estimation steps that are specific to time-series data. The following pre-processing steps will be executed:

  • Detect time-series sample frequency (for example, hourly, daily, weekly) and create new records for absent time points to make the series continuous.
  • Impute missing values in the target (via forward-fill) and feature columns (using median column values)
  • Create grain-based features to enable fixed effects across different series
  • Create time-based features to assist in learning seasonal patterns
  • Encode categorical variables to numeric quantities

The AutoMLConfig object defines the settings and data necessary for an automated machine learning task. Similar to a regression problem, you define standard training parameters like task type, number of iterations, training data, and number of cross-validations. For forecasting tasks, there are additional parameters that must be set that affect the experiment. The following table explains each parameter and its usage.

Param Description
time_column_name Used to specify the datetime column in the input data used for building the time series and inferring its frequency.
grain_column_names Name(s) defining individual series groups in the input data. If grain is not defined, the data set is assumed to be one time-series.
max_horizon Defines the maximum desired forecast horizon in units of time-series frequency. Units are based on the time interval of your training data, for example, monthly, weekly that the forecaster should predict out.
target_lags Number of rows to lag the target values based on the frequency of the data. The lag is represented as a list or single integer. Lag should be used when the relationship between the independent variables and dependent variable doesn't match up or correlate by default. For example, when trying to forecast demand for a product, the demand in any month may depend on the price of specific commodities 3 months prior. In this example, you may want to lag the target (demand) negatively by 3 months so that the model is training on the correct relationship.
target_rolling_window_size n historical periods to use to generate forecasted values, <= training set size. If omitted, n is the full training set size. Specify this parameter when you only want to consider a certain amount of history when training the model.
enable_dnn Enable Forecasting DNNs.

 

See the reference documentation for more information. Create the time-series settings as a dictionary object. Set the time_column_name to the day_datetime field in the data set. Define the grain_column_names parameter to ensure that two separate time-series groups are created for the data; one for store A and B. Lastly, set the max_horizon to 50 in order to predict for the entire test set. Set a forecast window to 10 periods with target_rolling_window_size, and specify a single lag on the target values for two periods ahead with the target_lags parameter. It is recommended to set max_horizon, target_rolling_window_size and target_lags to "auto" which will automatically detect these values for you. In the example below, "auto" settings have been used for these paramaters.

time_series_settings = {
    "time_column_name": "day_datetime",
    "grain_column_names": ["store"],
    "max_horizon": "auto",
    "target_lags": "auto",
    "target_rolling_window_size": "auto",
    "preprocess": True,
}

By defining the grain_column_names in the code snippet above, AutoML will create two separate time-series groups, also known as multiple time-series. If no grain is defined, AutoML will assume that the dataset is a single time-series. Now create a standard AutoMLConfig object, specifying the forecasting task type, and submit the experiment. After the model finishes, retrieve the best run iteration:

from azureml.core.workspace import Workspace
from azureml.core.experiment import Experiment
from azureml.train.automl import AutoMLConfig
import logging

automl_config = AutoMLConfig(task='forecasting',
                             primary_metric='normalized_root_mean_squared_error',
                             experiment_timeout_minutes=15,
                             enable_early_stopping=True,
                             training_data=train_data,
                             label_column_name=label,
                             n_cross_validations=5,
                             enable_ensembling=False,
                             verbosity=logging.INFO,
                             **time_series_settings)

ws = Workspace.from_config()
experiment = Experiment(ws, "forecasting_example")
local_run = experiment.submit(automl_config, show_output=True)
best_run, fitted_model = local_run.get_output()

 

Final resources to learn more

To learn more, you can read the following articles and notebooks: