Files
OpenBB/assets/js/ab0ad801.145f0659.js
github-actions[bot] 919f51cfe0 deploy: d2622528e5
2022-11-28 17:30:55 +00:00

1 line
73 KiB
JavaScript

"use strict";(self.webpackChunkdocs=self.webpackChunkdocs||[]).push([[84857],{3905:(e,t,n)=>{n.d(t,{Zo:()=>c,kt:()=>u});var a=n(67294);function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function r(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?i(Object(n),!0).forEach((function(t){o(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):i(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function l(e,t){if(null==e)return{};var n,a,o=function(e,t){if(null==e)return{};var n,a,o={},i=Object.keys(e);for(a=0;a<i.length;a++)n=i[a],t.indexOf(n)>=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(a=0;a<i.length;a++)n=i[a],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}var s=a.createContext({}),p=function(e){var t=a.useContext(s),n=t;return e&&(n="function"==typeof e?e(t):r(r({},t),e)),n},c=function(e){var t=p(e.components);return a.createElement(s.Provider,{value:t},e.children)},d={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},m=a.forwardRef((function(e,t){var n=e.components,o=e.mdxType,i=e.originalType,s=e.parentName,c=l(e,["components","mdxType","originalType","parentName"]),m=p(n),u=o,h=m["".concat(s,".").concat(u)]||m[u]||d[u]||i;return n?a.createElement(h,r(r({ref:t},c),{},{components:n})):a.createElement(h,r({ref:t},c))}));function u(e,t){var n=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var i=n.length,r=new Array(i);r[0]=m;var l={};for(var s in t)hasOwnProperty.call(t,s)&&(l[s]=t[s]);l.originalType=e,l.mdxType="string"==typeof e?e:o,r[1]=l;for(var p=2;p<i;p++)r[p]=n[p];return a.createElement.apply(null,r)}return a.createElement.apply(null,n)}m.displayName="MDXCreateElement"},25508:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>s,contentTitle:()=>r,default:()=>d,frontMatter:()=>i,metadata:()=>l,toc:()=>p});var a=n(87462),o=(n(67294),n(3905));const i={title:"Forecast",keywords:["machine learning","statistics","deep learning","neural networks","time series","research","feature engineering","hyperparameters"],excerpt:"The introduction to Forecasting explains how to use the menu"},r=void 0,l={unversionedId:"guides/intros/forecast",id:"guides/intros/forecast",title:"Forecast",description:"The Forecast menu is a machine learning toolkit that provides practitioners with high-level components that can quickly provide state-of-the-art results, be it with with classical or deep learning models, while also providing researchers with low-level components that can be mixed, matched and fine tuned to build new approaches and custom tuned models. Bring in multiple datasets and train machine learning models with unlimited external factors to see how underlying data may change future forecasting predictions and accuracy.",source:"@site/content/terminal/guides/intros/forecast.md",sourceDirName:"guides/intros",slug:"/guides/intros/forecast",permalink:"/terminal/guides/intros/forecast",draft:!1,editUrl:"https://github.com/OpenBB-finance/OpenBBTerminal/edit/main/website/content/terminal/guides/intros/forecast.md",tags:[],version:"current",frontMatter:{title:"Forecast",keywords:["machine learning","statistics","deep learning","neural networks","time series","research","feature engineering","hyperparameters"],excerpt:"The introduction to Forecasting explains how to use the menu"},sidebar:"tutorialSidebar",previous:{title:"ETF",permalink:"/terminal/guides/intros/etf"},next:{title:"Forex",permalink:"/terminal/guides/intros/forex"}},s={},p=[{value:"Accessing the Forecast menu",id:"accessing-the-forecast-menu",level:3},{value:"How to Use",id:"how-to-use",level:3},{value:"Loading Data",id:"loading-data",level:4},{value:"Understanding the structure of the menu",id:"understanding-the-structure-of-the-menu",level:4},{value:"Exploration",id:"exploration",level:5},{value:"Feature Engineering",id:"feature-engineering",level:5},{value:"imeSeries Forecasting",id:"imeseries-forecasting",level:5},{value:"Sample workflow #1 (beginner)",id:"sample-workflow-1-beginner",level:3},{value:"Sample workflow #2 (advanced)",id:"sample-workflow-2-advanced",level:3}],c={toc:p};function d(e){let{components:t,...n}=e;return(0,o.kt)("wrapper",(0,a.Z)({},c,n,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("p",null,"The Forecast menu is a machine learning toolkit that provides practitioners with high-level components that can quickly provide state-of-the-art results, be it with with classical or deep learning models, while also providing researchers with low-level components that can be mixed, matched and fine tuned to build new approaches and custom tuned models. Bring in multiple datasets and train machine learning models with unlimited external factors to see how underlying data may change future forecasting predictions and accuracy."),(0,o.kt)("h3",{id:"accessing-the-forecast-menu"},"Accessing the Forecast menu"),(0,o.kt)("p",null,"The Forecast menu is called upon by typing ",(0,o.kt)("inlineCode",{parentName:"p"},"forecast")," which opens the following menu:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"(\ud83e\udd8b) / $ forecast\n")),(0,o.kt)("img",{width:"1244",alt:"image",src:"https://user-images.githubusercontent.com/105685594/192546554-d75280d1-8d43-4c42-b1ba-e2f42bf5dc96.png"}),(0,o.kt)("h3",{id:"how-to-use"},"How to Use"),(0,o.kt)("p",null,"To begin any machine learning, you must first load in data. The menu supports importing both terminal datasets found in ",(0,o.kt)("inlineCode",{parentName:"p"},"stocks")," and ",(0,o.kt)("inlineCode",{parentName:"p"},"cryptocurrency"),", along with external datasets in the form of ",(0,o.kt)("inlineCode",{parentName:"p"},".csv")," that can be placed in the following location: ",(0,o.kt)("inlineCode",{parentName:"p"},"~/OpenBBUserData/custom_imports/forecast/")),(0,o.kt)("p",null,"It is important to note, if you ever have troubles on running a command, please read the help commands to guide you on what is available. You can do this by trailing any command with a ",(0,o.kt)("inlineCode",{parentName:"p"},"-h")),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"(\ud83e\udd8b) /forecast/ $ <command> -h\n")),(0,o.kt)("h4",{id:"loading-data"},"Loading Data"),(0,o.kt)("p",null,"Importing data from within the terminal can be simply done as follows:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"(\ud83e\udd8b) / $ stocks\n(\ud83e\udd8b) /stocks/ $ load AAPL\n(\ud83e\udd8b) /stocks/ $ forecast\n")),(0,o.kt)("p",null,"The menu can support loading in unlimited datasets. Once the first one is loaded, the menu options should turn blue to allow you to begin working through the menu options."),(0,o.kt)("p",null,"To load external data in the form as ",(0,o.kt)("inlineCode",{parentName:"p"},".csv"),", please place them into the folder shown within your terminal menu and then load them in as follows:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"(\ud83e\udd8b) / $ forecast\n(\ud83e\udd8b) /forecast/ $ load msft.csv\n(\ud83e\udd8b) /forecast/ $ load btc.csv\n")),(0,o.kt)("img",{width:"1244",alt:"image",src:"https://user-images.githubusercontent.com/105685594/192547582-33012e7a-4dbd-412d-a22d-8812d251981e.png"}),(0,o.kt)("h4",{id:"understanding-the-structure-of-the-menu"},"Understanding the structure of the menu"),(0,o.kt)("p",null,"The menu is broken up into three distinct sections. These sections represent the typical order of operations a machine learning professional would have to take in order to complete a project. Once data is loaded in, begin with ",(0,o.kt)("inlineCode",{parentName:"p"},"Exploration"),"."),(0,o.kt)("h5",{id:"exploration"},"Exploration"),(0,o.kt)("p",null,"Explore the datasets loaded into the menu to further understand your data and create unique new datasets by combining and analyzing features. Functions to note: ",(0,o.kt)("inlineCode",{parentName:"p"},"plot"),", ",(0,o.kt)("inlineCode",{parentName:"p"},"combine"),", ",(0,o.kt)("inlineCode",{parentName:"p"},"desc"),", ",(0,o.kt)("inlineCode",{parentName:"p"},"corr"),"."),(0,o.kt)("img",{width:"692",alt:"image",src:"https://user-images.githubusercontent.com/105685594/189729792-079f151e-f2b4-41bf-99d9-c83849c59170.png"}),(0,o.kt)("h5",{id:"feature-engineering"},"Feature Engineering"),(0,o.kt)("p",null,"Manuipulate datasets (addition, deletion, combination, mutation) of your data set to potentially improve machine learning model training, by providing new features and covariates that may leading to better performance and greater accuracy."),(0,o.kt)("img",{width:"694",alt:"image",src:"https://user-images.githubusercontent.com/105685594/189730399-fc4051f2-4d8e-4ff1-8494-44528d8f5513.png"}),(0,o.kt)("h5",{id:"imeseries-forecasting"},"imeSeries Forecasting"),(0,o.kt)("p",null,"Train state of the art models on custom datasets and experiment tuning hyperparameters. For more information on specific model\nimplementations, please see ",(0,o.kt)("a",{parentName:"p",href:"https://unit8co.github.io/darts/generated_api/darts.models.forecasting.html"},"Darts Models"),"\nfor in depth documentation."),(0,o.kt)("img",{width:"694",alt:"image",src:"https://user-images.githubusercontent.com/105685594/189730287-1c5c8141-1801-4a35-b9e9-acb32be35c13.png"}),(0,o.kt)("h3",{id:"sample-workflow-1-beginner"},"Sample workflow #1 (beginner)"),(0,o.kt)("p",null,"Let's begin by using one of the datasets we loaded in previously : ",(0,o.kt)("inlineCode",{parentName:"p"},"AAPL")),(0,o.kt)("p",null,"We will be forecasting ",(0,o.kt)("inlineCode",{parentName:"p"},"5 Business days")," ahead for the remaider of these workflows unless specified."),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Note:")," All models automatically perform Historical backtesting on the test split before providing a prediction."),(0,o.kt)("p",null,"We use ",(0,o.kt)("a",{parentName:"p",href:"https://en.wikipedia.org/wiki/Mean_absolute_percentage_error"},"MAPE")," as it is quite convenient and scale independent since it calculates error as a percentage instead of an absolute value. THere are many more metrics to compare time series. The metrics will compare only common slices of series when the two series are not aligned, and parallelize computation over a large number of pairs of series. More metrics will be released in future versions of the menu."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"(\ud83e\udd8b) /forecast/ $ plot AAPL.close\n")),(0,o.kt)("img",{width:"792",alt:"image",src:"https://user-images.githubusercontent.com/105685594/189739347-476b24d5-ee68-43ac-9fad-e780f64ab72f.png"}),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"(\ud83e\udd8b) /forecast/ $ desc AAPL\n\n Showing Descriptive Statistics for Dataset AAPL\n\u250f\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2533\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2533\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2533\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2533\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2533\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2533\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2513\n\u2503 \u2503 open \u2503 high \u2503 low \u2503 close \u2503 adj_close \u2503 volume \u2503\n\u2521\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2547\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2547\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2547\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2547\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2547\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2547\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2529\n\u2502 count \u2502 758.00 \u2502 758.00 \u2502 758.00 \u2502 758.00 \u2502 758.00 \u2502 758.00 \u2502\n\u251c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2524\n\u2502 mean \u2502 121.57 \u2502 123.07 \u2502 120.15 \u2502 121.68 \u2502 120.72 \u2502 113864153.69 \u2502\n\u251c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2524\n\u2502 std \u2502 36.37 \u2502 36.74 \u2502 35.95 \u2502 36.34 \u2502 36.61 \u2502 56098731.72 \u2502\n\u251c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2524\n\u2502 min \u2502 53.47 \u2502 54.11 \u2502 52.77 \u2502 53.54 \u2502 52.38 \u2502 41000000.00 \u2502\n\u251c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2524\n\u2502 25% \u2502 83.10 \u2502 86.41 \u2502 83.04 \u2502 84.16 \u2502 83.00 \u2502 77032650.00 \u2502\n\u251c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2524\n\u2502 50% \u2502 128.18 \u2502 129.64 \u2502 126.63 \u2502 127.86 \u2502 126.70 \u2502 98135650.00 \u2502\n\u251c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2524\n\u2502 75% \u2502 149.05 \u2502 150.38 \u2502 147.69 \u2502 149.14 \u2502 148.50 \u2502 131152875.00 \u2502\n\u251c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2524\n\u2502 max \u2502 182.63 \u2502 182.94 \u2502 179.12 \u2502 182.01 \u2502 181.26 \u2502 426510000.00 \u2502\n\u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2534\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2534\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2534\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2534\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2534\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2534\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518\n")),(0,o.kt)("p",null,"Let's use a simple ",(0,o.kt)("strong",{parentName:"p"},"Probabilistic Exponential Smoothing Model")," to predict the close price. Keep in mind all models are perform automatic historical backtesting before providing future forecasts. Note that all models forecast ",(0,o.kt)("inlineCode",{parentName:"p"},"close")," by default."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"(\ud83e\udd8b) /forecast/ $ expo AAPL\n100%|\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588| 115/115 [00:17<00:00, 6.44it/s]\nExponential smoothing obtains MAPE: 3.86%\n\n\n Actual price: 157.37\n\u250f\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2533\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2513\n\u2503 Datetime \u2503 Prediction \u2503\n\u2521\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2547\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2529\n\u2502 2022-09-12 \u2502 157.99 \u2502\n\u251c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2524\n\u2502 2022-09-13 \u2502 157.89 \u2502\n\u251c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2524\n\u2502 2022-09-14 \u2502 158.32 \u2502\n\u251c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2524\n\u2502 2022-09-15 \u2502 158.25 \u2502\n\u251c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2524\n\u2502 2022-09-16 \u2502 158.52 \u2502\n\u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2534\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518\n")),(0,o.kt)("img",{width:"792",alt:"image",src:"https://user-images.githubusercontent.com/105685594/189740925-ed0fb214-8b1c-4aff-a149-517d122082c8.png"}),(0,o.kt)("p",null,"That looks great, but we might want to see it a little more up close. Lets set the flag for ",(0,o.kt)("inlineCode",{parentName:"p"},"--forecast-only"),"."),(0,o.kt)("img",{width:"791",alt:"image",src:"https://user-images.githubusercontent.com/105685594/189741811-21832a87-f05f-4191-88f8-6ac30eb3d7b6.png"}),(0,o.kt)("p",null,"We can also play with some models that are bit more advanced. As we go down the list, models begin to become larger in parameter size and complexity. This will play a key role later on when we want to train models with ",(0,o.kt)("inlineCode",{parentName:"p"},"past_covariates")," (aka. external factors)."),(0,o.kt)("p",null,"This time lets test with a ",(0,o.kt)("strong",{parentName:"p"},"Recurrent Neural Network")," which by default uses an ",(0,o.kt)("inlineCode",{parentName:"p"},"LSTM")," backbone. We can also choose to test out a ",(0,o.kt)("inlineCode",{parentName:"p"},"GRU")," backbone to experiment. Let's do both and see if we can improve our accuracy and reduce the overall MAPE."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"(\ud83e\udd8b) /forecast/ $ rnn AAPL --forecast-only\nEpoch 193: 100%|\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588| 25/25 [00:00<00:00, 129.49it/s, loss=-2.74, train_loss=-2.75, val_loss=-2.22]\nPredicting RNN for 5 days\n100%|\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588| 115/115 [00:01<00:00, 86.89it/s]\nRNN model obtains MAPE: 3.69%\n\n\n Actual price: 157.37\n\u250f\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2533\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2513\n\u2503 Datetime \u2503 Prediction \u2503\n\u2521\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2547\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2529\n\u2502 2022-09-12 \u2502 155.71 \u2502\n\u251c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2524\n\u2502 2022-09-13 \u2502 155.42 \u2502\n\u251c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2524\n\u2502 2022-09-14 \u2502 155.11 \u2502\n\u251c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2524\n\u2502 2022-09-15 \u2502 154.81 \u2502\n\u251c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2524\n\u2502 2022-09-16 \u2502 154.51 \u2502\n\u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2534\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518\n")),(0,o.kt)("img",{width:"791",alt:"image",src:"https://user-images.githubusercontent.com/105685594/189743690-2f1be795-437e-4e4f-992e-3e8ad4de62f6.png"}),(0,o.kt)("p",null,"Seems like we improved the performance and reduced MAPE!"),(0,o.kt)("p",null,"Now for the second task, we would like to change the model type from ",(0,o.kt)("inlineCode",{parentName:"p"},"LSTM")," --\x3e ",(0,o.kt)("inlineCode",{parentName:"p"},"GRU"),". Use the ",(0,o.kt)("inlineCode",{parentName:"p"},"-h")," flag to understand the particular parameters one can change for RNN. (Please note that the parameters are different for each model)."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},'(\ud83e\udd8b) /forecast/ $ rnn -h\nusage: rnn [--hidden-dim HIDDEN_DIM] [--training_length TRAINING_LENGTH] [--naive] [-d {AAPL,msft}] [-c TARGET_COLUMN] [-n N_DAYS] [-t TRAIN_SPLIT]\n [-i INPUT_CHUNK_LENGTH] [--force-reset FORCE_RESET] [--save-checkpoints SAVE_CHECKPOINTS] [--model-save-name MODEL_SAVE_NAME]\n [--n-epochs N_EPOCHS] [--model-type MODEL_TYPE] [--dropout DROPOUT] [--batch-size BATCH_SIZE] [--end S_END_DATE] [--start S_START_DATE]\n [--learning-rate LEARNING_RATE] [--residuals] [--forecast-only] [-h] [--export EXPORT]\n\nPerform RNN forecast (Vanilla RNN, LSTM, GRU)\n\noptional arguments:\n --hidden-dim HIDDEN_DIM\n Size for feature maps for each hidden RNN layer (h_n) (default: 20)\n --training_length TRAINING_LENGTH\n The length of both input (target and covariates) and output (target) time series used during training. Generally speaking,\n training_length should have a higher value than input_chunk_length because otherwise during training the RNN is never run for as\n many iterations as it will during training. (default: 20)\n --naive Show the naive baseline for a model. (default: False)\n -d {AAPL,msft}, --target-dataset {AAPL,msft}\n The name of the dataset you want to select (default: None)\n -c TARGET_COLUMN, --target-column TARGET_COLUMN\n The name of the specific column you want to use (default: close)\n -n N_DAYS, --n-days N_DAYS\n prediction days. (default: 5)\n -t TRAIN_SPLIT, --train-split TRAIN_SPLIT\n Start point for rolling training and forecast window. 0.0-1.0 (default: 0.85)\n -i INPUT_CHUNK_LENGTH, --input-chunk-length INPUT_CHUNK_LENGTH\n Number of past time steps for forecasting module at prediction time. (default: 14)\n --force-reset FORCE_RESET\n If set to True, any previously-existing model with the same name will be reset (all checkpoints will be discarded). (default:\n True)\n --save-checkpoints SAVE_CHECKPOINTS\n Whether to automatically save the untrained model and checkpoints. (default: True)\n --model-save-name MODEL_SAVE_NAME\n Name of the model to save. (default: rnn_model)\n --n-epochs N_EPOCHS Number of epochs over which to train the model. (default: 300)\n --model-type MODEL_TYPE\n Either a string specifying the RNN module type ("RNN", "LSTM" or "GRU") (default: LSTM)\n --dropout DROPOUT Fraction of neurons afected by Dropout. (default: 0)\n --batch-size BATCH_SIZE\n Number of time series (input and output) used in each training pass (default: 32)\n --end S_END_DATE The end date (format YYYY-MM-DD) to select for testing (default: None)\n --start S_START_DATE The start date (format YYYY-MM-DD) to select for testing (default: None)\n --learning-rate LEARNING_RATE\n Learning rate during training. (default: 0.001)\n --residuals Show the residuals for the model. (default: False)\n --forecast-only Do not plot the hisotorical data without forecasts. (default: False)\n -h, --help show this help message (default: False)\n --export EXPORT Export figure into png, jpg, pdf, svg (default: )\n')),(0,o.kt)("p",null,"Lets change the ",(0,o.kt)("inlineCode",{parentName:"p"},"--model-type")," parameter to ",(0,o.kt)("inlineCode",{parentName:"p"},"GRU")," and rerun."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"(\ud83e\udd8b) /forecast/ $ rnn AAPL --model-type GRU --forecast-only\nEpoch 35: 100%|\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588| 25/25 [00:00<00:00, 125.85it/s, loss=-2.72, train_loss=-2.74, val_loss=-2.13]\nPredicting RNN for 5 days\n100%|\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588| 115/115 [00:01<00:00, 85.14it/s]\nRNN model obtains MAPE: 3.64%\n\n\n Actual price: 157.37\n\u250f\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2533\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2513\n\u2503 Datetime \u2503 Prediction \u2503\n\u2521\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2547\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2529\n\u2502 2022-09-12 \u2502 155.28 \u2502\n\u251c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2524\n\u2502 2022-09-13 \u2502 155.02 \u2502\n\u251c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2524\n\u2502 2022-09-14 \u2502 154.65 \u2502\n\u251c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2524\n\u2502 2022-09-15 \u2502 154.30 \u2502\n\u251c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2524\n\u2502 2022-09-16 \u2502 153.96 \u2502\n\u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2534\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518\n")),(0,o.kt)("img",{width:"791",alt:"image",src:"https://user-images.githubusercontent.com/105685594/189745500-c079614c-9213-4fcb-8967-01a5b85a5722.png"}),(0,o.kt)("p",null,"Looks like we squeezed out a little bit more accuracy! Good work."),(0,o.kt)("p",null,"The take away for this is that all models should work out of the box when forecasting for a particular Timeseries. One can switch the target by specifying a ",(0,o.kt)("inlineCode",{parentName:"p"},"-c")," for ",(0,o.kt)("inlineCode",{parentName:"p"},"TARGET_COLUMN")," and test out performance with multiple different models with a single command."),(0,o.kt)("h3",{id:"sample-workflow-2-advanced"},"Sample workflow #2 (advanced)"),(0,o.kt)("p",null,"To build successful models and improve accuracy over time, it is important to capture external data related to the timeseries you are training on. This can be seen in everyday applications:"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},"Observed rainfalls and known weather forecasts can help to predict hydro and solar electricity production"),(0,o.kt)("li",{parentName:"ul"},"Recently-observed activity on an e-commerce website can help predict future sales."),(0,o.kt)("li",{parentName:"ul"},"Making the model aware of up-coming holidays can help sales forecasting.")),(0,o.kt)("p",null,"In fact, more often than not, strictly relying on the history of a time series\nto predict its future is missing a lot of valuable information."),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Past covariates")," are time series whose past values are known at prediction\ntime. Those series often contain values that have to be observed to be known."),(0,o.kt)("p",null,(0,o.kt)("img",{parentName:"p",src:"https://user-images.githubusercontent.com/105685594/190244764-ce8cf01f-c959-4827-a326-62b0e172332d.png",alt:"image"})),(0,o.kt)("p",null,"If you would like to explore this topic more, please read the ",(0,o.kt)("a",{parentName:"p",href:"https://medium.com/unit8-machine-learning-publication/time-series-forecasting-using-past-and-future-external-data-with-darts-1f0539585993"},"blog post")," written by the authors of Darts."),(0,o.kt)("p",null,"Note that only the following models can handle ",(0,o.kt)("inlineCode",{parentName:"p"},"past_covariates"),": ",(0,o.kt)("inlineCode",{parentName:"p"},"BlockRNNModel"),", ",(0,o.kt)("inlineCode",{parentName:"p"},"NBEATSModel"),", ",(0,o.kt)("inlineCode",{parentName:"p"},"TCNModel"),", ",(0,o.kt)("inlineCode",{parentName:"p"},"TransformerModel"),", ",(0,o.kt)("inlineCode",{parentName:"p"},"RegressionModel")," (incl. ",(0,o.kt)("inlineCode",{parentName:"p"},"LinearRegressionModel"),"), ",(0,o.kt)("inlineCode",{parentName:"p"},"Temporal Fusion Transformer")),(0,o.kt)("p",null,"In this work flow lets do the following:"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},"add in some correlation analysis"),(0,o.kt)("li",{parentName:"ul"},"combine datasets"),(0,o.kt)("li",{parentName:"ul"},"perform feature engineering"),(0,o.kt)("li",{parentName:"ul"},"train models with ",(0,o.kt)("inlineCode",{parentName:"li"},"past_covariates"))),(0,o.kt)("p",null,"Let's begin by loading in our datasets of AAPL and MSFT once again. In this work flow we are going to test if ",(0,o.kt)("inlineCode",{parentName:"p"},"close")," price of MSFT is at all affected by the ",(0,o.kt)("inlineCode",{parentName:"p"},"close")," of AAPL."),(0,o.kt)("p",null,"For a refresher, we will grab data from the ",(0,o.kt)("inlineCode",{parentName:"p"},"stocks")," menu found on the terminal."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"(\ud83e\udd8b) / $ stocks\n(\ud83e\udd8b) /stocks/ $ load AAPL\n(\ud83e\udd8b) /stocks/ $ forecast\n(\ud83e\udd8b) /forecast/ $ ..\n(\ud83e\udd8b) /stocks/ $ load MSFT\n(\ud83e\udd8b) /stocks/ $ forecast\n")),(0,o.kt)("img",{width:"476",alt:"image",src:"https://user-images.githubusercontent.com/105685594/190245759-758e566f-ad35-49fe-8df1-7d87f5d9f935.png"}),(0,o.kt)("p",null,"Before we go combining them, let's train a simple ",(0,o.kt)("inlineCode",{parentName:"p"},"Block RNN")," model on MSFT ",(0,o.kt)("inlineCode",{parentName:"p"},"close")," price to see how to use ",(0,o.kt)("inlineCode",{parentName:"p"},"past_covariates")),(0,o.kt)("p",null,"Make sure to always check your current data set to know the column names:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"(\ud83e\udd8b) /forecast/ $ show MSFT\nMSFT dataset has shape (row, column): (759, 7)\n\n Dataset MSFT | Showing 10 of 759 rows\n\u250f\u2501\u2501\u2501\u2533\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2533\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2533\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2533\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2533\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2533\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2533\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2513\n\u2503 \u2503 date \u2503 open \u2503 high \u2503 low \u2503 close \u2503 adj_close \u2503 volume \u2503\n\u2521\u2501\u2501\u2501\u2547\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2547\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2547\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2547\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2547\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2547\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2547\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2529\n\u2502 0 \u2502 2019-09-10 00:00:00 \u2502 136.80 \u2502 136.89 \u2502 134.51 \u2502 136.08 \u2502 132.22 \u2502 28903400 \u2502\n\u251c\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2524\n\u2502 1 \u2502 2019-09-11 00:00:00 \u2502 135.91 \u2502 136.27 \u2502 135.09 \u2502 136.12 \u2502 132.26 \u2502 24726100 \u2502\n\u251c\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2524\n\u2502 2 \u2502 2019-09-12 00:00:00 \u2502 137.85 \u2502 138.42 \u2502 136.87 \u2502 137.52 \u2502 133.62 \u2502 27010000 \u2502\n\u251c\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2524\n\u2502 3 \u2502 2019-09-13 00:00:00 \u2502 137.78 \u2502 138.06 \u2502 136.57 \u2502 137.32 \u2502 133.42 \u2502 23363100 \u2502\n\u251c\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2524\n\u2502 4 \u2502 2019-09-16 00:00:00 \u2502 135.83 \u2502 136.70 \u2502 135.66 \u2502 136.33 \u2502 132.46 \u2502 16731400 \u2502\n\u251c\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2524\n\u2502 5 \u2502 2019-09-17 00:00:00 \u2502 136.96 \u2502 137.52 \u2502 136.43 \u2502 137.39 \u2502 133.49 \u2502 17814200 \u2502\n\u251c\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2524\n\u2502 6 \u2502 2019-09-18 00:00:00 \u2502 137.36 \u2502 138.67 \u2502 136.53 \u2502 138.52 \u2502 134.59 \u2502 23982100 \u2502\n\u251c\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2524\n\u2502 7 \u2502 2019-09-19 00:00:00 \u2502 140.30 \u2502 142.37 \u2502 140.07 \u2502 141.07 \u2502 137.07 \u2502 35772100 \u2502\n\u251c\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2524\n\u2502 8 \u2502 2019-09-20 00:00:00 \u2502 141.01 \u2502 141.65 \u2502 138.25 \u2502 139.44 \u2502 135.48 \u2502 39167300 \u2502\n\u251c\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2524\n\u2502 9 \u2502 2019-09-23 00:00:00 \u2502 139.23 \u2502 139.63 \u2502 138.44 \u2502 139.14 \u2502 135.19 \u2502 17139300 \u2502\n\u2514\u2500\u2500\u2500\u2534\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2534\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2534\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2534\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2534\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2534\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2534\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518\n")),(0,o.kt)("p",null,"Without any covariates:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"(\ud83e\udd8b) /forecast/ $ brnn MSFT --forecast-only\nEpoch 87: 100%|\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588| 25/25 [00:00<00:00, 33.84it/s, loss=-2.06, train_loss=-2.27, val_loss=-1.82]\nPredicting Block RNN for 5 days\n100%|\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588| 115/115 [00:06<00:00, 18.76it/s]\nBlock RNN model obtains MAPE: 4.62%\n\n\n Actual price: 251.99\n\u250f\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2533\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2513\n\u2503 Datetime \u2503 Prediction \u2503\n\u2521\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2547\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2529\n\u2502 2022-09-14 \u2502 258.52 \u2502\n\u251c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2524\n\u2502 2022-09-15 \u2502 258.01 \u2502\n\u251c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2524\n\u2502 2022-09-16 \u2502 258.95 \u2502\n\u251c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2524\n\u2502 2022-09-19 \u2502 257.20 \u2502\n\u251c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2524\n\u2502 2022-09-20 \u2502 257.66 \u2502\n\u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2534\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518\n")),(0,o.kt)("img",{width:"792",alt:"image",src:"https://user-images.githubusercontent.com/105685594/190246958-d97ca130-2d4c-448d-b880-81ac3d70e93b.png"}),(0,o.kt)("p",null,"With covariates:"),(0,o.kt)("p",null,"To use any covariates, you have 2 options:"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},"specify specific columns with ",(0,o.kt)("inlineCode",{parentName:"li"},"--past-covariates")),(0,o.kt)("li",{parentName:"ul"},"specify all columns as past covariates except the one you are forecasting\n",(0,o.kt)("inlineCode",{parentName:"li"},"--all-past-covariates"))),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"(\ud83e\udd8b) /forecast/ $ brnn MSFT --forecast-only --past-covariates volume\nCovariate #0: volume\nEpoch 37: 100%|\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588| 25/25 [00:00<00:00, 149.03it/s, loss=-2.16, train_loss=-2.08, val_loss=-1.44]\nPredicting Block RNN for 5 days\n100%|\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588| 115/115 [00:01<00:00, 88.94it/s]\nBlock RNN model obtains MAPE: 5.10%\n\n\n Actual price: 251.99\n\u250f\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2533\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2513\n\u2503 Datetime \u2503 Prediction \u2503\n\u2521\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2547\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2529\n\u2502 2022-09-14 \u2502 257.02 \u2502\n\u251c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2524\n\u2502 2022-09-15 \u2502 255.82 \u2502\n\u251c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2524\n\u2502 2022-09-16 \u2502 260.13 \u2502\n\u251c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2524\n\u2502 2022-09-19 \u2502 258.32 \u2502\n\u251c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2524\n\u2502 2022-09-20 \u2502 258.52 \u2502\n\u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2534\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518\n")),(0,o.kt)("img",{width:"792",alt:"image",src:"https://user-images.githubusercontent.com/105685594/190247412-fe533231-17d9-4dc6-b41f-f5a27b6c2d57.png"}),(0,o.kt)("p",null,"You can see here that adding in the external variable of ",(0,o.kt)("inlineCode",{parentName:"p"},"volume")," negatively affected the accuracy."),(0,o.kt)("p",null,"Let's add in all remaining columns from our dataset as covariates and see what happens to the accuracy."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"(\ud83e\udd8b) /forecast/ $ brnn MSFT --forecast-only --all-past-covariates\nCovariate #0: open\nCovariate #1: high\nCovariate #2: low\nCovariate #3: adj_close\nCovariate #4: volume\nEpoch 50: 100%|\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588| 25/25 [00:00<00:00, 149.29it/s, loss=-2.41, train_loss=-2.53, val_loss=-1.71]\nPredicting Block RNN for 5 days\n100%|\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588| 115/115 [00:01<00:00, 89.43it/s]\nBlock RNN model obtains MAPE: 4.26%\n\n\n Actual price: 251.99\n\u250f\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2533\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2513\n\u2503 Datetime \u2503 Prediction \u2503\n\u2521\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2547\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2529\n\u2502 2022-09-14 \u2502 259.28 \u2502\n\u251c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2524\n\u2502 2022-09-15 \u2502 259.13 \u2502\n\u251c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2524\n\u2502 2022-09-16 \u2502 259.42 \u2502\n\u251c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2524\n\u2502 2022-09-19 \u2502 257.73 \u2502\n\u251c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2524\n\u2502 2022-09-20 \u2502 258.64 \u2502\n\u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2534\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518\n")),(0,o.kt)("img",{width:"792",alt:"image",src:"https://user-images.githubusercontent.com/105685594/190248547-2bd7801e-4ac4-43c0-868b-9aa2f79a3c3c.png"}),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Final Result:")," Using ",(0,o.kt)("inlineCode",{parentName:"p"},"open"),", ",(0,o.kt)("inlineCode",{parentName:"p"},"high"),", ",(0,o.kt)("inlineCode",{parentName:"p"},"low"),", ",(0,o.kt)("inlineCode",{parentName:"p"},"adj_close"),", ",(0,o.kt)("inlineCode",{parentName:"p"},"volume")," as\n",(0,o.kt)("inlineCode",{parentName:"p"},"past_covariates")," improved MAPE from 4.62 --\x3e 4.26."),(0,o.kt)("p",null,"Now that we know how to use covariates and understand their effect, why don't we also use ",(0,o.kt)("inlineCode",{parentName:"p"},"AAPL"),"'s ticker data as ",(0,o.kt)("inlineCode",{parentName:"p"},"past_covariates")," to check whether this correlates and improves our forecasting accuracy."),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Remember: You can use unlimited number of ",(0,o.kt)("inlineCode",{parentName:"strong"},"past_covariates")," but they must all be combined into a single dataframe with the target forecast timeseries before training.")),(0,o.kt)("p",null,"We will combine ",(0,o.kt)("inlineCode",{parentName:"p"},"MSFT")," and ",(0,o.kt)("inlineCode",{parentName:"p"},"AAPL"),"."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"(\ud83e\udd8b) /forecast/ $ combine MSFT -c AAPL\n(\ud83e\udd8b) /forecast/ $ show MSFT\nMSFT dataset has shape (row, column): (759, 13)\nDataframe has more than 10 columns. Please export to see all of the data.\n\n\n Dataset MSFT | Showing 10 of 759 rows\n\u250f\u2501\u2501\u2501\u2533\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2533\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2533\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2533\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2533\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2533\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2533\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2533\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2533\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2533\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2513\n\u2503 \u2503 date \u2503 open \u2503 high \u2503 low \u2503 close \u2503 adj_close \u2503 volume \u2503 AAPL_open \u2503 AAPL_high \u2503 AAPL_low \u2503\n\u2521\u2501\u2501\u2501\u2547\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2547\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2547\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2547\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2547\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2547\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2547\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2547\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2547\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2547\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2529\n\u2502 0 \u2502 2019-09-10 00:00:00 \u2502 136.80 \u2502 136.89 \u2502 134.51 \u2502 136.08 \u2502 132.22 \u2502 28903400 \u2502 53.47 \u2502 54.19 \u2502 52.93 \u2502\n\u251c\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2524\n\u2502 1 \u2502 2019-09-11 00:00:00 \u2502 135.91 \u2502 136.27 \u2502 135.09 \u2502 136.12 \u2502 132.26 \u2502 24726100 \u2502 54.52 \u2502 55.93 \u2502 54.43 \u2502\n\u251c\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2524\n\u2502 2 \u2502 2019-09-12 00:00:00 \u2502 137.85 \u2502 138.42 \u2502 136.87 \u2502 137.52 \u2502 133.62 \u2502 27010000 \u2502 56.20 \u2502 56.60 \u2502 55.72 \u2502\n\u251c\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2524\n\u2502 3 \u2502 2019-09-13 00:00:00 \u2502 137.78 \u2502 138.06 \u2502 136.57 \u2502 137.32 \u2502 133.42 \u2502 23363100 \u2502 55.00 \u2502 55.20 \u2502 54.26 \u2502\n\u251c\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2524\n\u2502 4 \u2502 2019-09-16 00:00:00 \u2502 135.83 \u2502 136.70 \u2502 135.66 \u2502 136.33 \u2502 132.46 \u2502 16731400 \u2502 54.43 \u2502 55.03 \u2502 54.39 \u2502\n\u251c\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2524\n\u2502 5 \u2502 2019-09-17 00:00:00 \u2502 136.96 \u2502 137.52 \u2502 136.43 \u2502 137.39 \u2502 133.49 \u2502 17814200 \u2502 54.99 \u2502 55.21 \u2502 54.78 \u2502\n\u251c\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2524\n\u2502 6 \u2502 2019-09-18 00:00:00 \u2502 137.36 \u2502 138.67 \u2502 136.53 \u2502 138.52 \u2502 134.59 \u2502 23982100 \u2502 55.26 \u2502 55.71 \u2502 54.86 \u2502\n\u251c\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2524\n\u2502 7 \u2502 2019-09-19 00:00:00 \u2502 140.30 \u2502 142.37 \u2502 140.07 \u2502 141.07 \u2502 137.07 \u2502 35772100 \u2502 55.50 \u2502 55.94 \u2502 55.09 \u2502\n\u251c\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2524\n\u2502 8 \u2502 2019-09-20 00:00:00 \u2502 141.01 \u2502 141.65 \u2502 138.25 \u2502 139.44 \u2502 135.48 \u2502 39167300 \u2502 55.35 \u2502 55.64 \u2502 54.37 \u2502\n\u251c\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2524\n\u2502 9 \u2502 2019-09-23 00:00:00 \u2502 139.23 \u2502 139.63 \u2502 138.44 \u2502 139.14 \u2502 135.19 \u2502 17139300 \u2502 54.74 \u2502 54.96 \u2502 54.41 \u2502\n\u2514\u2500\u2500\u2500\u2534\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2534\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2534\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2534\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2534\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2534\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2534\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2534\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2534\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2534\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518\n")),(0,o.kt)("p",null,"Now we can run the same ",(0,o.kt)("inlineCode",{parentName:"p"},"BRNN")," model with all ",(0,o.kt)("inlineCode",{parentName:"p"},"past_covariates")," of both tickers. The output will show the model grabbing all covariates to bring into training to predict ",(0,o.kt)("inlineCode",{parentName:"p"},"close")," of ",(0,o.kt)("inlineCode",{parentName:"p"},"MSFT"),"."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"(\ud83e\udd8b) /forecast/ $ brnn MSFT --forecast-only --all-past-covariates\nCovariate #0: open\nCovariate #1: high\nCovariate #2: low\nCovariate #3: adj_close\nCovariate #4: volume\nCovariate #5: AAPL_open\nCovariate #6: AAPL_high\nCovariate #7: AAPL_low\nCovariate #8: AAPL_close\nCovariate #9: AAPL_adj_close\nCovariate #10: AAPL_volume\nEpoch 116: 100%|\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588| 25/25 [00:00<00:00, 149.26it/s, loss=-2.5, train_loss=-2.61, val_loss=-1.93]\nPredicting Block RNN for 5 days\n100%|\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588| 115/115 [00:01<00:00, 90.26it/s]\nBlock RNN model obtains MAPE: 3.93%\n\n\n Actual price: 251.99\n\u250f\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2533\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2513\n\u2503 Datetime \u2503 Prediction \u2503\n\u2521\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2547\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2529\n\u2502 2022-09-14 \u2502 259.78 \u2502\n\u251c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2524\n\u2502 2022-09-15 \u2502 258.15 \u2502\n\u251c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2524\n\u2502 2022-09-16 \u2502 261.44 \u2502\n\u251c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2524\n\u2502 2022-09-19 \u2502 257.57 \u2502\n\u251c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2524\n\u2502 2022-09-20 \u2502 257.99 \u2502\n\u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2534\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518\n")),(0,o.kt)("img",{width:"792",alt:"image",src:"https://user-images.githubusercontent.com/105685594/190250934-61e55441-dd20-439e-bff1-a54904ecfec9.png"}),(0,o.kt)("p",null,"For one last experiment, we can perform some other feature engineering on ",(0,o.kt)("inlineCode",{parentName:"p"},"MSFT")," and add it to our ",(0,o.kt)("inlineCode",{parentName:"p"},"past_covariates")," to train on."),(0,o.kt)("p",null,"In this case, let's add in ",(0,o.kt)("inlineCode",{parentName:"p"},"Momentum")," over past 10 days of ",(0,o.kt)("inlineCode",{parentName:"p"},"MSFT")," and append it to our ",(0,o.kt)("inlineCode",{parentName:"p"},"past_covariates")),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"(\ud83e\udd8b) /forecast/ $ mom MSFT\nSuccessfully added 'Momentum_10' to 'MSFT' dataset\n\n(\ud83e\udd8b) /forecast/ $ brnn MSFT --forecast-only --all-past-covariates\nThe data contains inf or nan values. They will be removed.\n\nCovariate #0: open\nCovariate #1: high\nCovariate #2: low\nCovariate #3: adj_close\nCovariate #4: volume\nCovariate #5: AAPL_open\nCovariate #6: AAPL_high\nCovariate #7: AAPL_low\nCovariate #8: AAPL_close\nCovariate #9: AAPL_adj_close\nCovariate #10: AAPL_volume\nCovariate #11: Momentum_10\nEpoch 71: 100%|\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588| 24/24 [00:00<00:00, 147.87it/s, loss=-2.52, train_loss=-2.57, val_loss=-1.82]\nPredicting Block RNN for 5 days\n100%|\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588| 114/114 [00:01<00:00, 90.05it/s]\nBlock RNN model obtains MAPE: 3.72%\n\n\n Actual price: 251.99\n\u250f\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2533\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2513\n\u2503 Datetime \u2503 Prediction \u2503\n\u2521\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2547\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2529\n\u2502 2022-09-14 \u2502 255.14 \u2502\n\u251c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2524\n\u2502 2022-09-15 \u2502 256.20 \u2502\n\u251c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2524\n\u2502 2022-09-16 \u2502 256.67 \u2502\n\u251c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2524\n\u2502 2022-09-19 \u2502 258.63 \u2502\n\u251c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2524\n\u2502 2022-09-20 \u2502 256.62 \u2502\n\u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2534\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518\n")),(0,o.kt)("img",{width:"792",alt:"image",src:"https://user-images.githubusercontent.com/105685594/190255025-9f32d6ff-d1d7-4cdf-80a8-2a6ff4c0617d.png"}),(0,o.kt)("p",null,"There we have it. Bringing in another ticker has allowed us to further improve the model accuracy. Furthermore, adding in a new feature to the dataset allowed us to improve the accuracy further."),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"MAPE = 4.62%")," (no past covariates)"),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"MAPE = 4.26%")," (",(0,o.kt)("inlineCode",{parentName:"p"},"open"),",",(0,o.kt)("inlineCode",{parentName:"p"},"high"),",",(0,o.kt)("inlineCode",{parentName:"p"},"low"),",",(0,o.kt)("inlineCode",{parentName:"p"},"adj_close"),",",(0,o.kt)("inlineCode",{parentName:"p"},"volume"),")"),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"MAPE = 3.93%"),"\n(",(0,o.kt)("inlineCode",{parentName:"p"},"open"),",",(0,o.kt)("inlineCode",{parentName:"p"},"high"),",",(0,o.kt)("inlineCode",{parentName:"p"},"low"),",",(0,o.kt)("inlineCode",{parentName:"p"},"adj_close"),",",(0,o.kt)("inlineCode",{parentName:"p"},"volume"),",",(0,o.kt)("inlineCode",{parentName:"p"},"AAPL_open"),",",(0,o.kt)("inlineCode",{parentName:"p"},"AAPL_high"),",",(0,o.kt)("inlineCode",{parentName:"p"},"APPL_low"),",",(0,o.kt)("inlineCode",{parentName:"p"},"APPL_adj_close"),",",(0,o.kt)("inlineCode",{parentName:"p"},"APPL_volume"),",",(0,o.kt)("inlineCode",{parentName:"p"},"APPL_close"),")"),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"MAPE = 3.72%"),"\n(",(0,o.kt)("inlineCode",{parentName:"p"},"open"),",",(0,o.kt)("inlineCode",{parentName:"p"},"high"),",",(0,o.kt)("inlineCode",{parentName:"p"},"low"),",",(0,o.kt)("inlineCode",{parentName:"p"},"adj_close"),",",(0,o.kt)("inlineCode",{parentName:"p"},"volume"),",",(0,o.kt)("inlineCode",{parentName:"p"},"AAPL_open"),",",(0,o.kt)("inlineCode",{parentName:"p"},"AAPL_high"),",",(0,o.kt)("inlineCode",{parentName:"p"},"APPL_low"),",",(0,o.kt)("inlineCode",{parentName:"p"},"APPL_adj_close"),",",(0,o.kt)("inlineCode",{parentName:"p"},"APPL_volume"),",",(0,o.kt)("inlineCode",{parentName:"p"},"APPL_close"),",",(0,o.kt)("inlineCode",{parentName:"p"},"Momentum_10"),")"),(0,o.kt)("p",null,"If you have any questions or would like to request for new feature engineering or model additions, please join us on ",(0,o.kt)("a",{parentName:"p",href:"openbb.co/discord"},"Discord"),". Happy hacking!"))}d.isMDXComponent=!0}}]);