forked from oracle-samples/oracle-db-examples
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Time Series Forecasting .json
1 lines (1 loc) · 16.2 KB
/
Time Series Forecasting .json
1
{"paragraphs":[{"text":"%md\n## Oracle Machine Learning notebook for Time Series Forecasting \n\n#### Oracle Machine Learning supports Time Series forecasting based on a state of the art version of the Exponential Smoothing algorithm. \n\n#### This example is based on the SH.Sales example data.\n\n##### See <https://docs.oracle.com/en/database/oracle/oracle-database/18/dmcon/time-series.html#GUID-0D6954B9-9D66-42E2-A62F-F3FFE84B827E> for Documentation details and related links.\n\n##### Created by Charlie Berger, April 14, 2019","user":"CHARLIE","dateUpdated":"2019-04-14T23:26:36+0000","config":{"colWidth":8,"graph":{"mode":"table","height":300,"optionOpen":false,"keys":[],"values":[],"groups":[],"scatter":{}},"enabled":true,"editorMode":"ace/mode/markdown","results":{},"editorSetting":{"language":"md","editOnDblClick":false},"editorHide":true,"tableHide":false},"settings":{"params":{},"forms":{}},"results":{"code":"SUCCESS","msg":[{"type":"HTML","data":"<h2>Oracle Machine Learning notebook for Time Series Forecasting</h2>\n<h4>Oracle Machine Learning supports Time Series forecasting based on a state of the art version of the Exponential Smoothing algorithm.</h4>\n<h4>This example is based on the SH.Sales example data.</h4>\n<h5>See <a href=\"https://docs.oracle.com/en/database/oracle/oracle-database/18/dmcon/time-series.html#GUID-0D6954B9-9D66-42E2-A62F-F3FFE84B827E\">https://docs.oracle.com/en/database/oracle/oracle-database/18/dmcon/time-series.html#GUID-0D6954B9-9D66-42E2-A62F-F3FFE84B827E</a> for Documentation details and related links.</h5>\n<h5>Created by Charlie Berger, April 14, 2019</h5>\n"}]},"jobName":"paragraph_1547503253209_-1136017592","id":"20190114-220053_1142514109","dateCreated":"2019-01-14T22:00:57+0000","dateStarted":"2019-04-14T23:26:32+0000","dateFinished":"2019-04-14T23:26:32+0000","status":"FINISHED","progressUpdateIntervalMs":500,"commited":true,"focus":true,"$$hashKey":"object:187"},{"text":"%md\n![tiny arrow](http://www.oracle.com/technetwork/database/options/advanced-analytics/timeseriesgraph-5461847.jpg \"tiny arrow\")\n","user":"CHARLIE","dateUpdated":"2019-04-14T23:24:50+0000","config":{"colWidth":4,"enabled":true,"results":{"0":{"graph":{"mode":"table","height":253.313,"optionOpen":false}}},"editorSetting":{"language":"md","editOnDblClick":false},"editorMode":"ace/mode/markdown","editorHide":true},"settings":{"params":{},"forms":{}},"jobName":"paragraph_1555283559318_2095925514","id":"20190414-231239_986953278","dateCreated":"2019-04-14T23:12:39+0000","status":"FINISHED","progressUpdateIntervalMs":500,"commited":false,"$$hashKey":"object:188","dateFinished":"2019-04-14T23:21:16+0000","dateStarted":"2019-04-14T23:21:16+0000","results":{"code":"SUCCESS","msg":[{"type":"HTML","data":"<p><img src=\"http://www.oracle.com/technetwork/database/options/advanced-analytics/timeseriesgraph-5461847.jpg\" alt=\"tiny arrow\" title=\"tiny arrow\" /></p>\n"}]}},{"text":"%script\n\nRem\nRem $Header: rdbms/demo/dmesmdemo.sql /main/1 2017/04/24 15:14:32 dbai Exp $\nRem\nRem dmesmdemo.sql\nRem\nRem Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.\nRem\nRem NAME\nRem dmesmdemo.sql - ESM Demo\nRem\nRem DESCRIPTION\nRem This demo creates an Exponential Smoothing Model \nRem using data in the SH (Sales History) schema in the RDBMS.\nRem\nRem NOTES\nRem\nRem BEGIN SQL_FILE_METADATA\nRem SQL_SOURCE_FILE: rdbms/demo/dmesmdemo.sql\nRem SQL_SHIPPED_FILE:\nRem SQL_PHASE:\nRem SQL_STARTUP_MODE: NORMAL\nRem SQL_IGNORABLE_ERRORS: NONE\nRem END SQL_FILE_METADATA\nRem\nRem MODIFIED (MM/DD/YY)\nRem dbai 04/17/17 - Created\nRem\n \nSET ECHO ON\nSET FEEDBACK 1\nSET NUMWIDTH 10\nSET LINESIZE 80\nSET TRIMSPOOL ON\nSET TAB OFF\nSET PAGESIZE 100\n\n-----------------------------------------------------------------------\n-- SET UP THE DATA\n-----------------------------------------------------------------------\n-- Cleanup old settings table\nBEGIN EXECUTE IMMEDIATE 'DROP TABLE esm_sh_settings';\nEXCEPTION WHEN OTHERS THEN NULL; END;\n/\n\n-- Cleanup old model with the same name\nBEGIN DBMS_DATA_MINING.DROP_MODEL('ESM_SH_SAMPLE');\nEXCEPTION WHEN OTHERS THEN NULL; END;\n/\n\n-- Create input time series\ncreate or replace view esm_sh_data \n as select time_id, amount_sold \n from sh.sales;\n\nCREATE TABLE esm_sh_settings(setting_name VARCHAR2(30), \n setting_value VARCHAR2(128));\nbegin\n -- Select ESM as the algorithm\n insert into esm_sh_settings \n values(dbms_data_mining.algo_name,\n dbms_data_mining.algo_exponential_smoothing);\n -- Set accumulation interval to be quarter\n insert into esm_sh_settings \n values(dbms_data_mining.exsm_interval,\n dbms_data_mining.exsm_interval_qtr);\n -- Set prediction step to be 4 quarters (one year)\n INSERT INTO esm_sh_settings \n VALUES(dbms_data_mining.exsm_prediction_step,\n '4');\n -- Set ESM model to be Holt-Winters\n INSERT INTO esm_sh_settings \n VALUES(dbms_data_mining.exsm_model,\n dbms_data_mining.exsm_hw);\n -- Set seasonal cycle to be 4 quarters\n insert into esm_sh_settings \n values(dbms_data_mining.exsm_seasonality,\n '4');\nend;\n/\n\n-- Build the ESM model\nBEGIN\n dbms_data_mining.create_model(model_name => 'ESM_SH_SAMPLE',\n mining_function => 'TIME_SERIES',\n data_table_name => 'esm_sh_data',\n case_id_column_name => 'time_id',\n target_column_name => 'amount_sold',\n settings_table_name => 'ESM_SH_SETTINGS');\nEND;\n/\n\n-- output setting table\ncolumn setting_name format a30\ncolumn setting_value format a30\nSELECT setting_name, setting_value\n FROM user_mining_model_settings\n WHERE model_name = upper('ESM_SH_SAMPLE')\nORDER BY setting_name;\n\n-- get signature\ncolumn attribute_name format a40\ncolumn attribute_type format a20\nSELECT attribute_name, attribute_type\nFROM user_mining_model_attributes\n WHERE model_name=upper('ESM_SH_SAMPLE')\n ORDER BY attribute_name;\n\n\n-- get global diagnostics\ncolumn name format a20\ncolumn numeric_value format a20\ncolumn string_value format a15\nSELECT name, \nto_char(numeric_value, '99999.99EEEE') numeric_value, \nstring_value FROM DM$VGESM_SH_SAMPLE\n ORDER BY name;\n\n\n\n\n","user":"CHARLIE","dateUpdated":"2019-04-14T23:04:12+0000","config":{"colWidth":12,"enabled":true,"results":{},"editorSetting":{"language":"plsql","editOnDblClick":false},"editorMode":"ace/mode/plsql"},"settings":{"params":{},"forms":{}},"results":{"code":"SUCCESS","msg":[{"type":"TEXT","data":"\n---------------------------\n\n---------------------------\n\n---------------------------\n\n---------------------------\n\n---------------------------\n\n---------------------------\n\n---------------------------\n\n---------------------------\n\n---------------------------\n\n---------------------------\n\n---------------------------\n\n---------------------------\n\n---------------------------\n\n---------------------------\n\n---------------------------\n\n---------------------------\n\n---------------------------\n\n---------------------------\n\n---------------------------\n\n---------------------------\n\n---------------------------\n\n---------------------------\n\n---------------------------\n\n---------------------------\n\n---------------------------\n\n---------------------------\n\n---------------------------\nError in command - \nSET ECHO ON\nError report -\n\nUnknown Command.\n\n---------------------------\n\n---------------------------\n\n---------------------------\n\n---------------------------\n\n---------------------------\n\n---------------------------\n\n---------------------------\n\nPL/SQL procedure successfully completed.\n\n\n---------------------------\n\nPL/SQL procedure successfully completed.\n\n\n---------------------------\n\nView ESM_SH_DATA created.\n\n\n---------------------------\n\nTable ESM_SH_SETTINGS created.\n\n\n---------------------------\n\nPL/SQL procedure successfully completed.\n\n\n---------------------------\n\nPL/SQL procedure successfully completed.\n\n\n---------------------------\n\n---------------------------\n\n---------------------------\nSETTING_NAME SETTING_VALUE \nALGO_NAME ALGO_EXPONENTIAL_SMOOTHING \nEXSM_ACCUMULATE EXSM_ACCU_TOTAL \nEXSM_CONFIDENCE_LEVEL .95 \nEXSM_INTERVAL EXSM_INTERVAL_QTR \nEXSM_MODEL EXSM_WINTERS \nEXSM_NMSE 3 \nEXSM_OPTIMIZATION_CRIT EXSM_OPT_CRIT_LIK \nEXSM_PREDICTION_STEP 4 \nEXSM_SEASONALITY 4 \nEXSM_SETMISSING EXSM_MISS_AUTO \nODMS_DETAILS ODMS_ENABLE \nODMS_MISSING_VALUE_TREATMENT ODMS_MISSING_VALUE_AUTO \nODMS_SAMPLING ODMS_SAMPLING_DISABLE \nPREP_AUTO ON \n\n\n14 rows selected. \n\n\n---------------------------\n\n---------------------------\n\n---------------------------\nATTRIBUTE_NAME ATTRIBUTE_TYPE \nAMOUNT_SOLD UNDEFINED \n\n\n1 row selected. \n\n\n---------------------------\n\n---------------------------\n\n---------------------------\n\n---------------------------\nNAME NUMERIC_VALUE STRING_VALUE \n-2 LOG-LIKELIHOOD 4.51E+02 \nAIC 4.67E+02 \nAICC 4.87E+02 \nALPHA 4.52E-01 \nAMSE 1.58E+11 \nBETA 4.19E-01 \nBIC 4.73E+02 \nCONVERGED YES \nGAMMA 1.00E-04 \nINITIAL LEVEL 6.11E+06 \nINITIAL SEASON 1 9.94E-01 \nINITIAL SEASON 2 1.02E+00 \nINITIAL SEASON 3 9.37E-01 \nINITIAL SEASON 4 1.05E+00 \nINITIAL TREND 5.55E+04 \nMAE 4.24E-02 \nMSE 1.04E+11 \nNUM_ROWS 9.19E+05 \nSIGMA 5.40E-02 \nSTD 3.23E+05 \n\n\n20 rows selected. \n\n\n---------------------------\n"}]},"jobName":"paragraph_1547503280202_-37859131","id":"20190114-220120_2026303479","dateCreated":"2019-01-14T22:01:20+0000","dateStarted":"2019-04-14T23:04:12+0000","dateFinished":"2019-04-14T23:04:15+0000","status":"FINISHED","progressUpdateIntervalMs":500,"commited":true,"$$hashKey":"object:189"},{"title":"Show Forecasted Values","text":"%sql\n\nSelect case_id, value, prediction, lower, upper \nfrom DM$VPESM_SH_SAMPLE\nORDER BY case_id;","user":"CHARLIE","dateUpdated":"2019-04-14T23:04:21+0000","config":{"colWidth":12,"enabled":true,"results":{},"editorSetting":{"language":"sql","editOnDblClick":false},"editorMode":"ace/mode/osql","title":true},"settings":{"params":{},"forms":{}},"results":{"code":"SUCCESS","msg":[{"type":"TABLE","data":"CASE_ID\tVALUE\tPREDICTION\tLOWER\tUPPER\n1998-01-01 00:00:00.0\t6480684.0000011446\t6452375.7547972426\t\t\n1998-04-01 00:00:00.0\t5593994.1400007578\t5848724.7899289858\t\t\n1998-07-01 00:00:00.0\t6071823.1000010688\t6214546.3091883212\t\t\n1998-10-01 00:00:00.0\t5937413.7100012964\t5869219.4188763853\t\t\n1999-01-01 00:00:00.0\t6093747.209999715\t6132016.4107704591\t\t\n1999-04-01 00:00:00.0\t4925471.6299999086\t5385954.0785577698\t\t\n1999-07-01 00:00:00.0\t5827050.1500000218\t5350240.2541007437\t\t\n1999-10-01 00:00:00.0\t5373678.6700002998\t5304626.0456131948\t\t\n2000-01-01 00:00:00.0\t5984889.4899995513\t5541123.2442563046\t\t\n2000-04-01 00:00:00.0\t5371730.9200002486\t5236126.0962816272\t\t\n2000-07-01 00:00:00.0\t6121239.2899996703\t5955258.7436273666\t\t\n2000-10-01 00:00:00.0\t6287646.9199997969\t6089446.4024044033\t\t\n2001-01-01 00:00:00.0\t6547097.4400001625\t6837567.1739474228\t\t\n2001-04-01 00:00:00.0\t6922468.3900004178\t6188944.0536807217\t\t\n2001-07-01 00:00:00.0\t7195998.6300003789\t7663836.7748832135\t\t\n2001-10-01 00:00:00.0\t7470897.5199997798\t7573926.9609732395\t\t\n2002-01-01 00:00:00.0\t\t8232820.5109822853\t7360847.4855491659\t9104793.5364154056\n2002-04-01 00:00:00.0\t\t7642694.935394275\t6584565.2377711721\t8700824.6330173779\n2002-07-01 00:00:00.0\t\t8648402.5429529846\t7019914.2807409838\t10276890.805164985\n2002-10-01 00:00:00.0\t\t8692842.4634345472\t6523676.3295608778\t10862008.597308217\n"}]},"jobName":"paragraph_1547750100413_768329034","id":"20190117-183500_1264825666","dateCreated":"2019-01-17T18:35:00+0000","dateStarted":"2019-04-14T23:04:21+0000","dateFinished":"2019-04-14T23:04:21+0000","status":"FINISHED","progressUpdateIntervalMs":500,"commited":true,"$$hashKey":"object:190"},{"title":"Show Forecasted Values","text":"%sql\n\nSelect case_id, value, prediction, lower, upper \nfrom DM$VPESM_SH_SAMPLE\nORDER BY case_id;","user":"CHARLIE","dateUpdated":"2019-04-14T23:04:25+0000","config":{"colWidth":12,"enabled":true,"results":{"0":{"graph":{"mode":"lineChart","height":300,"optionOpen":false,"setting":{"lineChart":{}},"commonSetting":{},"keys":[{"name":"CASE_ID","index":0,"aggr":"sum"}],"groups":[],"values":[{"name":"PREDICTION","index":2,"aggr":"sum"},{"name":"VALUE","index":1,"aggr":"sum"}]},"helium":{}}},"editorSetting":{"language":"sql","editOnDblClick":false},"editorMode":"ace/mode/osql","title":true,"editorHide":false},"settings":{"params":{},"forms":{}},"results":{"code":"SUCCESS","msg":[{"type":"TABLE","data":"CASE_ID\tVALUE\tPREDICTION\tLOWER\tUPPER\n1998-01-01 00:00:00.0\t6480684.0000011446\t6452375.7547972426\t\t\n1998-04-01 00:00:00.0\t5593994.1400007578\t5848724.7899289858\t\t\n1998-07-01 00:00:00.0\t6071823.1000010688\t6214546.3091883212\t\t\n1998-10-01 00:00:00.0\t5937413.7100012964\t5869219.4188763853\t\t\n1999-01-01 00:00:00.0\t6093747.209999715\t6132016.4107704591\t\t\n1999-04-01 00:00:00.0\t4925471.6299999086\t5385954.0785577698\t\t\n1999-07-01 00:00:00.0\t5827050.1500000218\t5350240.2541007437\t\t\n1999-10-01 00:00:00.0\t5373678.6700002998\t5304626.0456131948\t\t\n2000-01-01 00:00:00.0\t5984889.4899995513\t5541123.2442563046\t\t\n2000-04-01 00:00:00.0\t5371730.9200002486\t5236126.0962816272\t\t\n2000-07-01 00:00:00.0\t6121239.2899996703\t5955258.7436273666\t\t\n2000-10-01 00:00:00.0\t6287646.9199997969\t6089446.4024044033\t\t\n2001-01-01 00:00:00.0\t6547097.4400001625\t6837567.1739474228\t\t\n2001-04-01 00:00:00.0\t6922468.3900004178\t6188944.0536807217\t\t\n2001-07-01 00:00:00.0\t7195998.6300003789\t7663836.7748832135\t\t\n2001-10-01 00:00:00.0\t7470897.5199997798\t7573926.9609732395\t\t\n2002-01-01 00:00:00.0\t\t8232820.5109822853\t7360847.4855491659\t9104793.5364154056\n2002-04-01 00:00:00.0\t\t7642694.935394275\t6584565.2377711721\t8700824.6330173779\n2002-07-01 00:00:00.0\t\t8648402.5429529846\t7019914.2807409838\t10276890.805164985\n2002-10-01 00:00:00.0\t\t8692842.4634345472\t6523676.3295608778\t10862008.597308217\n"}]},"jobName":"paragraph_1555282979619_76134995","id":"20190414-230259_400878610","dateCreated":"2019-04-14T23:02:59+0000","dateStarted":"2019-04-14T23:04:25+0000","dateFinished":"2019-04-14T23:04:25+0000","status":"FINISHED","progressUpdateIntervalMs":500,"commited":true,"$$hashKey":"object:191"},{"text":"%sql\n","user":"CHARLIE","dateUpdated":"2019-04-14T23:01:11+0000","config":{"colWidth":12,"enabled":true,"results":{},"editorSetting":{"language":"sql","editOnDblClick":false},"editorMode":"ace/mode/osql"},"settings":{"params":{},"forms":{}},"jobName":"paragraph_1555282871962_-2004941157","id":"20190414-230111_1707676956","dateCreated":"2019-04-14T23:01:11+0000","status":"READY","progressUpdateIntervalMs":500,"commited":false,"$$hashKey":"object:192"}],"name":"Time Series Forecasting ","id":"104002","angularObjects":{"ORAB45381C728:shared_process":[],"ORACA3BE4B5AB:shared_process":[],"ORACFE2D7596B:shared_process":[],"MDW381939C745:shared_process":[]},"config":{"looknfeel":"default","personalizedMode":"false"},"info":{}}