Spaces:
Runtime error
Runtime error
zhang qiao commited on
Commit ·
ebf4fd3
1
Parent(s): b4d2ae2
Upload folder using huggingface_hub
Browse files- .env +2 -0
- __pycache__/demo.cpython-310.pyc +0 -0
- data/multivariate/blow_mold_future.csv +4 -0
- data/multivariate/blow_mold_historical.csv +277 -0
- demo.py +26 -2
- gr_app/__init__.py +1 -1
- gr_app/__pycache__/__init__.cpython-310.pyc +0 -0
- gr_app/__pycache__/args.cpython-310.pyc +0 -0
- gr_app/__pycache__/gr_app.cpython-310.pyc +0 -0
- gr_app/args.py +6 -0
- gr_app/components/__init__.py +1 -0
- gr_app/components/__pycache__/__init__.cpython-310.pyc +0 -0
- gr_app/components/__pycache__/auto_arima.cpython-310.pyc +0 -0
- gr_app/components/auto_arima.py +85 -0
- gr_app/gr_app.py +58 -8
- gr_component_test.ipynb +0 -0
- src/analyser/__pycache__/analyser.cpython-310.pyc +0 -0
- src/analyser/analyser.py +7 -2
- src/forecaster/__pycache__/forecaster.cpython-310.pyc +0 -0
- src/forecaster/forecaster.py +3 -2
- src/forecaster/models/__pycache__/prophet.cpython-310.pyc +0 -0
- src/forecaster/models/prophet.py +14 -9
- src/forecaster/utils/__pycache__/prep_data.cpython-310.pyc +0 -0
- src/forecaster/utils/prep_data.py +7 -4
- src/idsc/IDSC.py +1 -1
- src/idsc/__pycache__/IDSC.cpython-310.pyc +0 -0
- src/idsc/config.yml +2 -2
- temp/20231218165125.csv +4 -0
- temp/20231218165600.csv +4 -0
- temp/20231218165649.csv +4 -0
- temp/20231218165805.csv +4 -0
.env
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
|
|
|
| 1 |
+
IDSC_ACC=sentient_test@idsc.com.sg
|
| 2 |
+
IDSC_PASS=APItest1412
|
__pycache__/demo.cpython-310.pyc
CHANGED
|
Binary files a/__pycache__/demo.cpython-310.pyc and b/__pycache__/demo.cpython-310.pyc differ
|
|
|
data/multivariate/blow_mold_future.csv
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
datetime,gas_regm,global_price_of_rubber
|
| 2 |
+
2023-01-31,3.7405,73.1689
|
| 3 |
+
2023-02-28,3.7726,74.5348
|
| 4 |
+
2023-03-31,3.8121,75.9514
|
data/multivariate/blow_mold_historical.csv
ADDED
|
@@ -0,0 +1,277 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
datetime,price,gas_regm,m_coil_brent_eu,ppi_plastic_resins,global_price_of_rubber,ppi_nonpackaging_plastic
|
| 2 |
+
2000-01-31,41.0,1.289,25.51,139.4,29.207387288305,106.3
|
| 3 |
+
2000-02-29,41.0,1.377,27.78,141.7,33.3910988232947,105.6
|
| 4 |
+
2000-03-31,45.0,1.516,27.49,146.3,30.9419130507091,106.1
|
| 5 |
+
2000-04-30,47.0,1.465,22.76,151.4,31.9301483398313,106.9
|
| 6 |
+
2000-05-31,47.0,1.487,27.74,155.6,31.2017020258803,106.3
|
| 7 |
+
2000-06-30,47.0,1.633,29.8,155.9,30.3866550681669,105.6
|
| 8 |
+
2000-07-31,47.0,1.551,28.68,153.8,29.4021076293167,105.6
|
| 9 |
+
2000-08-31,46.0,1.465,30.2,153.5,30.3085171496012,105.6
|
| 10 |
+
2000-09-30,45.0,1.55,33.14,148.7,29.8124884983428,102.9
|
| 11 |
+
2000-10-31,43.0,1.532,30.96,146.2,30.1277751472933,102.8
|
| 12 |
+
2000-11-30,42.0,1.517,32.55,143.7,28.7437287406289,141.8
|
| 13 |
+
2000-12-31,41.0,1.443,25.66,141.8,28.1258451618706,135.4
|
| 14 |
+
2001-01-31,41.0,1.447,25.62,142.1,27.6103437361532,136.0
|
| 15 |
+
2001-02-28,46.0,1.45,27.5,143.8,27.3004069271481,130.3
|
| 16 |
+
2001-03-31,49.0,1.409,24.5,146.2,26.0187851525231,131.9
|
| 17 |
+
2001-04-30,49.0,1.552,25.66,146.8,26.2534988467767,133.5
|
| 18 |
+
2001-05-31,46.0,1.702,28.31,144.3,27.51473477331,133.6
|
| 19 |
+
2001-06-30,44.0,1.616,27.85,141.5,28.1185662296469,132.6
|
| 20 |
+
2001-07-31,41.0,1.421,24.61,138.8,27.4841214793241,129.9
|
| 21 |
+
2001-08-31,38.0,1.421,25.68,134.1,26.6036904584991,127.3
|
| 22 |
+
2001-09-30,37.0,1.522,25.62,128.7,26.292151018594,128.1
|
| 23 |
+
2001-10-31,36.0,1.315,20.54,131.1,24.3699386646521,126.8
|
| 24 |
+
2001-11-30,35.0,1.171,18.8,129.3,23.3473647814519,126.9
|
| 25 |
+
2001-12-31,34.0,1.086,18.71,126.0,22.1199072290676,126.9
|
| 26 |
+
2002-01-31,33.0,1.107,19.42,123.5,25.7274386290273,124.2
|
| 27 |
+
2002-02-28,32.0,1.114,20.28,122.9,28.3348137073603,123.1
|
| 28 |
+
2002-03-31,35.0,1.249,23.7,125.4,30.4060736454083,123.5
|
| 29 |
+
2002-04-30,37.0,1.397,25.73,129.1,30.5710009457509,132.5
|
| 30 |
+
2002-05-31,37.0,1.392,25.35,131.7,31.9800767861452,132.2
|
| 31 |
+
2002-06-30,40.0,1.382,24.08,134.2,38.1194117462331,133.2
|
| 32 |
+
2002-07-31,42.0,1.397,25.74,140.8,37.7212614451261,130.1
|
| 33 |
+
2002-08-31,42.0,1.396,26.65,141.7,39.1259414196287,130.7
|
| 34 |
+
2002-09-30,42.0,1.4,28.4,142.0,40.4003165097905,132.5
|
| 35 |
+
2002-10-31,41.5,1.445,27.54,143.5,37.4785970122049,133.5
|
| 36 |
+
2002-11-30,41.0,1.419,24.34,142.0,38.1078708057541,131.3
|
| 37 |
+
2002-12-31,40.0,1.386,28.33,139.6,38.4589515238658,131.3
|
| 38 |
+
2003-01-31,42.0,1.458,31.18,142.2,40.8439797087274,131.2
|
| 39 |
+
2003-02-28,45.0,1.613,32.77,148.3,44.3216971632299,134.9
|
| 40 |
+
2003-03-31,51.0,1.693,30.61,158.0,48.0160494131156,154.4
|
| 41 |
+
2003-04-30,51.0,1.589,25.0,162.5,44.6582837198907,153.6
|
| 42 |
+
2003-05-31,49.0,1.497,25.86,160.3,44.7716819472496,148.3
|
| 43 |
+
2003-06-30,47.0,1.493,27.65,156.0,46.0828796324256,143.9
|
| 44 |
+
2003-07-31,46.0,1.513,28.35,150.5,45.0388176923323,143.5
|
| 45 |
+
2003-08-31,46.0,1.62,29.89,149.0,47.2060620748377,146.4
|
| 46 |
+
2003-09-30,49.0,1.679,27.11,150.9,50.1580977467978,143.9
|
| 47 |
+
2003-10-31,50.0,1.564,29.61,152.7,58.8783317878305,143.0
|
| 48 |
+
2003-11-30,50.0,1.512,28.75,152.5,57.317134018561,144.9
|
| 49 |
+
2003-12-31,50.0,1.479,29.81,150.1,56.4615173935601,144.9
|
| 50 |
+
2004-01-31,50.0,1.572,31.28,153.0,56.9385099372127,145.1
|
| 51 |
+
2004-02-29,52.0,1.648,30.86,158.4,58.6985034776252,151.1
|
| 52 |
+
2004-03-31,53.0,1.736,33.63,159.2,60.3278569549401,151.3
|
| 53 |
+
2004-04-30,51.0,1.798,33.59,163.1,62.9846154244917,148.6
|
| 54 |
+
2004-05-31,54.0,1.983,37.57,164.3,60.96288702815,148.4
|
| 55 |
+
2004-06-30,50.0,1.969,35.18,167.9,62.0396301965008,153.3
|
| 56 |
+
2004-07-31,50.0,1.911,38.22,169.3,56.439917731206,155.2
|
| 57 |
+
2004-08-31,54.0,1.878,42.74,172.7,55.5759312370429,158.2
|
| 58 |
+
2004-09-30,54.0,1.87,43.2,178.7,56.4156181110577,164.3
|
| 59 |
+
2004-10-31,59.0,2.0,49.78,184.2,57.687298232154,170.1
|
| 60 |
+
2004-11-30,65.0,1.979,43.11,190.2,55.6841995445927,172.5
|
| 61 |
+
2004-12-31,65.0,1.841,39.6,195.0,53.664361118707,180.7
|
| 62 |
+
2005-01-31,65.0,1.831,44.51,201.5,53.6713810089721,181.0
|
| 63 |
+
2005-02-28,65.0,1.91,45.48,202.2,57.09267223323,184.5
|
| 64 |
+
2005-03-31,65.0,2.079,53.1,203.8,59.7969470723052,180.0
|
| 65 |
+
2005-04-30,63.0,2.243,51.88,203.3,59.5394692790162,180.4
|
| 66 |
+
2005-05-31,59.0,2.161,48.65,200.3,61.6602861264073,183.0
|
| 67 |
+
2005-06-30,55.0,2.156,54.35,195.0,66.0132317175254,181.4
|
| 68 |
+
2005-07-31,55.0,2.29,57.52,193.4,76.7382004284509,177.2
|
| 69 |
+
2005-08-31,61.0,2.486,63.98,191.6,72.5594021150625,174.3
|
| 70 |
+
2005-09-30,70.5,2.903,62.91,197.5,76.9355427981404,182.2
|
| 71 |
+
2005-10-31,79.0,2.717,58.54,217.4,77.175593591121,197.3
|
| 72 |
+
2005-11-30,87.0,2.257,55.24,222.9,72.5295062187588,209.1
|
| 73 |
+
2005-12-31,83.0,2.185,56.86,218.5,76.219808531953,209.1
|
| 74 |
+
2006-01-31,79.0,2.316,62.99,216.8,85.0675702237423,207.8
|
| 75 |
+
2006-02-28,75.0,2.28,60.21,211.5,93.3664304959585,212.2
|
| 76 |
+
2006-03-31,71.0,2.425,62.06,210.2,93.9381054725787,211.5
|
| 77 |
+
2006-04-30,67.0,2.742,70.26,204.0,97.2718057629218,209.5
|
| 78 |
+
2006-05-31,70.0,2.907,69.78,206.1,110.979065175253,198.6
|
| 79 |
+
2006-06-30,73.0,2.885,68.56,209.8,122.556484197039,196.2
|
| 80 |
+
2006-07-31,73.0,2.981,73.67,210.3,112.63143934534,199.2
|
| 81 |
+
2006-08-31,78.0,2.952,73.23,214.0,98.6358399427319,202.5
|
| 82 |
+
2006-09-30,76.0,2.555,61.96,213.8,82.4405112899275,202.6
|
| 83 |
+
2006-10-31,70.0,2.245,57.81,210.3,82.5755091796405,204.7
|
| 84 |
+
2006-11-30,64.0,2.229,58.76,205.3,73.6779209940118,204.6
|
| 85 |
+
2006-12-31,61.0,2.313,62.47,196.2,78.1671886168233,204.6
|
| 86 |
+
2007-01-31,61.0,2.24,53.68,194.0,94.2393268508427,204.5
|
| 87 |
+
2007-02-28,64.0,2.278,57.56,191.4,103.362484237646,192.8
|
| 88 |
+
2007-03-31,67.0,2.563,62.05,193.3,101.723364405822,192.8
|
| 89 |
+
2007-04-30,67.0,2.845,67.49,199.0,105.244894811804,192.8
|
| 90 |
+
2007-05-31,71.0,3.146,67.21,201.4,107.442120464773,192.9
|
| 91 |
+
2007-06-30,71.0,3.056,71.05,204.7,100.30343205675,192.9
|
| 92 |
+
2007-07-31,76.0,2.965,76.93,206.8,94.1669188918148,0.0
|
| 93 |
+
2007-08-31,76.0,2.786,70.76,207.0,95.8627378373185,0.0
|
| 94 |
+
2007-09-30,76.0,2.803,77.17,206.2,98.1121463109289,0.0
|
| 95 |
+
2007-10-31,80.0,2.803,82.34,207.9,105.766033621884,0.0
|
| 96 |
+
2007-11-30,85.0,3.08,92.41,215.6,112.615239598575,0.0
|
| 97 |
+
2007-12-31,85.0,3.018,90.93,217.1,112.390984280604,0.0
|
| 98 |
+
2008-01-31,85.0,3.043,92.18,218.7,119.006285148296,0.0
|
| 99 |
+
2008-02-29,85.0,3.028,94.99,218.7,126.552421732544,0.0
|
| 100 |
+
2008-03-31,85.0,3.244,103.64,220.5,126.643140314431,0.0
|
| 101 |
+
2008-04-30,88.0,3.458,109.07,222.6,128.593589825004,0.0
|
| 102 |
+
2008-05-31,91.0,3.766,122.8,228.5,138.277798441455,0.0
|
| 103 |
+
2008-06-30,96.0,4.054,132.32,231.9,146.170315065635,0.0
|
| 104 |
+
2008-07-31,103.0,4.062,132.72,244.5,144.932795280109,0.0
|
| 105 |
+
2008-08-31,103.0,3.779,113.24,249.4,132.746124912575,0.0
|
| 106 |
+
2008-09-30,96.0,3.703,97.23,240.3,128.710080731291,0.0
|
| 107 |
+
2008-10-31,85.0,3.051,71.58,233.0,87.077467895931,0.0
|
| 108 |
+
2008-11-30,65.0,2.147,52.45,203.5,74.9017971351072,0.0
|
| 109 |
+
2008-12-31,55.0,1.687,39.95,191.2,55.3560842389086,0.0
|
| 110 |
+
2009-01-31,55.0,1.788,43.44,181.5,67.3477472200155,0.0
|
| 111 |
+
2009-02-28,62.0,1.923,43.32,190.5,66.3674465440756,0.0
|
| 112 |
+
2009-03-31,62.0,1.959,46.54,189.0,64.9008981964321,0.0
|
| 113 |
+
2009-04-30,62.0,2.049,50.18,185.0,73.7707013618509,0.0
|
| 114 |
+
2009-05-31,65.0,2.266,57.3,189.0,76.8046193901897,0.0
|
| 115 |
+
2009-06-30,68.0,2.631,68.61,188.8,75.9603180428538,0.0
|
| 116 |
+
2009-07-31,68.0,2.527,64.44,201.2,79.3432605757159,0.0
|
| 117 |
+
2009-08-31,68.0,2.616,72.51,200.8,93.2047030240823,0.0
|
| 118 |
+
2009-09-30,72.0,2.554,67.65,202.7,98.5533685046526,0.0
|
| 119 |
+
2009-10-31,72.0,2.551,72.77,200.4,106.69329944307,0.0
|
| 120 |
+
2009-11-30,72.0,2.651,76.66,201.2,115.713711163267,0.0
|
| 121 |
+
2009-12-31,72.0,2.607,74.46,203.6,127.232811096697,0.0
|
| 122 |
+
2010-01-31,76.0,2.715,76.17,201.0,139.790854789358,0.0
|
| 123 |
+
2010-02-28,84.0,2.644,73.75,217.1,141.865718355091,0.0
|
| 124 |
+
2010-03-31,90.0,2.772,78.83,219.5,151.4369231728,0.0
|
| 125 |
+
2010-04-30,90.0,2.848,84.82,238.8,179.086727788998,0.0
|
| 126 |
+
2010-05-31,84.0,2.836,75.95,226.0,166.911390841138,0.0
|
| 127 |
+
2010-06-30,78.0,2.732,74.76,218.8,161.740922574989,0.0
|
| 128 |
+
2010-07-31,76.0,2.729,75.58,224.8,148.514565693036,0.0
|
| 129 |
+
2010-08-31,76.0,2.73,77.04,222.7,150.415532340762,0.0
|
| 130 |
+
2010-09-30,81.0,2.705,77.84,221.6,160.244065973852,0.0
|
| 131 |
+
2010-10-31,81.0,2.801,82.67,227.7,178.024417122312,0.0
|
| 132 |
+
2010-11-30,85.0,2.859,85.28,221.3,195.323292160842,0.0
|
| 133 |
+
2010-12-31,85.0,2.993,91.45,218.4,215.275194818155,0.0
|
| 134 |
+
2011-01-31,85.0,3.095,96.52,224.1,250.361686346119,0.0
|
| 135 |
+
2011-02-28,88.0,3.211,103.72,231.6,280.787618727944,0.0
|
| 136 |
+
2011-03-31,90.0,3.561,114.64,237.2,245.782276192328,0.0
|
| 137 |
+
2011-04-30,96.0,3.8,123.26,244.3,265.492465821774,0.0
|
| 138 |
+
2011-05-31,96.0,3.906,114.99,258.4,232.074008219104,0.0
|
| 139 |
+
2011-06-30,93.0,3.68,113.83,255.4,223.802741515545,0.0
|
| 140 |
+
2011-07-31,89.0,3.65,116.97,253.2,214.640164744945,0.0
|
| 141 |
+
2011-08-31,89.0,3.639,110.22,248.9,212.113004249518,0.0
|
| 142 |
+
2011-09-30,89.0,3.611,112.83,250.9,206.452812729631,0.0
|
| 143 |
+
2011-10-31,84.0,3.448,109.55,242.5,184.20634848636,0.0
|
| 144 |
+
2011-11-30,84.0,3.384,110.77,245.8,152.945049162992,0.0
|
| 145 |
+
2011-12-31,89.0,3.266,107.87,240.0,153.517440215375,0.0
|
| 146 |
+
2012-01-31,89.0,3.38,110.69,245.3,164.475176292465,0.0
|
| 147 |
+
2012-02-29,92.0,3.579,119.33,249.3,181.551641984733,0.0
|
| 148 |
+
2012-03-31,95.0,3.852,125.45,253.4,178.218715903215,0.0
|
| 149 |
+
2012-04-30,95.0,3.9,119.75,253.5,174.404205713456,0.0
|
| 150 |
+
2012-05-31,88.0,3.732,110.34,252.1,169.105621995462,0.0
|
| 151 |
+
2012-06-30,81.0,3.539,95.16,248.7,145.091411931049,0.0
|
| 152 |
+
2012-07-31,81.0,3.439,102.62,245.0,139.632391811906,0.0
|
| 153 |
+
2012-08-31,86.0,3.722,113.36,246.4,126.692819537845,0.0
|
| 154 |
+
2012-09-30,86.0,3.849,112.86,241.9,137.821937567472,0.0
|
| 155 |
+
2012-10-31,86.0,3.746,111.71,245.5,145.329106397227,0.0
|
| 156 |
+
2012-11-30,84.0,3.452,109.06,245.5,134.905011164865,0.0
|
| 157 |
+
2012-12-31,84.0,3.31,109.49,244.7,141.053787047201,0.0
|
| 158 |
+
2013-01-31,89.0,3.319,112.96,253.6,149.85060298992,0.0
|
| 159 |
+
2013-02-28,93.0,3.67,116.05,258.4,144.509661024979,0.0
|
| 160 |
+
2013-03-31,93.0,3.711,108.47,261.9,135.048216926273,0.0
|
| 161 |
+
2013-04-30,93.0,3.57,102.25,260.2,130.03683999139,0.0
|
| 162 |
+
2013-05-31,93.0,3.615,102.56,257.5,137.803685852783,0.0
|
| 163 |
+
2013-06-30,95.0,3.626,102.92,258.7,127.468679409603,0.0
|
| 164 |
+
2013-07-31,95.0,3.591,107.93,256.8,116.259806974523,225.7
|
| 165 |
+
2013-08-31,95.0,3.574,111.28,258.1,116.525750469469,226.7
|
| 166 |
+
2013-09-30,100.0,3.532,111.6,259.8,119.662129441593,229.1
|
| 167 |
+
2013-10-31,100.0,3.344,109.08,260.2,114.963122896463,231.9
|
| 168 |
+
2013-11-30,100.0,3.243,107.79,262.7,112.925194753356,231.9
|
| 169 |
+
2013-12-31,100.0,3.276,110.76,262.6,116.050665895991,231.9
|
| 170 |
+
2014-01-31,100.0,3.313,108.12,266.1,105.516510565907,231.9
|
| 171 |
+
2014-02-28,104.0,3.356,108.9,269.4,97.2956790739447,234.0
|
| 172 |
+
2014-03-31,104.0,3.533,107.48,271.9,103.477502439682,237.0
|
| 173 |
+
2014-04-30,104.0,3.661,107.76,273.1,99.5787633847708,237.0
|
| 174 |
+
2014-05-31,104.0,3.673,109.54,271.7,94.0184703032722,238.4
|
| 175 |
+
2014-06-30,104.0,3.692,111.8,269.4,94.6475604693347,238.4
|
| 176 |
+
2014-07-31,104.0,3.611,106.77,272.0,91.5742230571997,238.4
|
| 177 |
+
2014-08-31,104.0,3.487,101.61,274.9,83.9125282793579,238.4
|
| 178 |
+
2014-09-30,107.0,3.406,97.09,277.1,74.589230384787,238.4
|
| 179 |
+
2014-10-31,107.0,3.171,87.43,279.7,73.4885312272799,240.9
|
| 180 |
+
2014-11-30,104.0,2.912,79.44,275.3,74.2009960900291,240.7
|
| 181 |
+
2014-12-31,100.0,2.543,62.34,265.4,72.715066954437,238.3
|
| 182 |
+
2015-01-31,72.0,2.116,47.76,254.0,75.0264271868902,234.2
|
| 183 |
+
2015-02-28,67.0,2.216,58.1,248.4,82.0272377502195,233.0
|
| 184 |
+
2015-03-31,67.0,2.464,55.89,241.2,78.7169258606513,226.3
|
| 185 |
+
2015-04-30,67.0,2.469,59.52,240.3,77.1259143677066,224.5
|
| 186 |
+
2015-05-31,72.0,2.718,64.08,242.9,83.5472779889505,225.5
|
| 187 |
+
2015-06-30,72.0,2.802,61.48,244.7,82.9794228656618,223.5
|
| 188 |
+
2015-07-31,72.0,2.794,56.56,242.5,74.3665575019731,221.7
|
| 189 |
+
2015-08-31,67.0,2.636,46.52,238.9,64.4340664508838,223.5
|
| 190 |
+
2015-09-30,63.0,2.365,47.62,231.4,59.5136576825031,220.5
|
| 191 |
+
2015-10-31,63.0,2.29,48.43,228.9,59.0041903737688,218.2
|
| 192 |
+
2015-11-30,63.0,2.158,44.27,227.4,55.4403933557711,216.3
|
| 193 |
+
2015-12-31,63.0,2.038,38.01,228.2,56.59327533392,216.3
|
| 194 |
+
2016-01-31,60.0,1.949,30.7,224.8,55.3269951284122,213.9
|
| 195 |
+
2016-02-29,58.0,1.764,32.18,223.4,57.0405020270829,211.5
|
| 196 |
+
2016-03-31,63.0,1.969,38.21,222.6,65.639017567241,210.8
|
| 197 |
+
2016-04-30,67.0,2.113,41.58,222.7,78.0374201190487,211.5
|
| 198 |
+
2016-05-31,67.0,2.268,46.74,226.3,75.9184932421137,212.6
|
| 199 |
+
2016-06-30,67.0,2.366,48.25,229.7,71.6965446941588,214.0
|
| 200 |
+
2016-07-31,67.0,2.239,44.95,229.6,80.5036695666373,214.0
|
| 201 |
+
2016-08-31,67.0,2.178,45.84,230.3,74.9789079297113,214.0
|
| 202 |
+
2016-09-30,72.0,2.219,46.57,231.6,72.7822222683015,215.7
|
| 203 |
+
2016-10-31,72.0,2.249,49.52,233.7,75.5988182392733,217.2
|
| 204 |
+
2016-11-30,69.0,2.182,44.73,232.2,85.2692816160443,219.1
|
| 205 |
+
2016-12-31,67.0,2.254,53.31,227.3,101.010820998846,218.5
|
| 206 |
+
2017-01-31,67.0,2.349,54.58,229.3,115.897763023011,216.9
|
| 207 |
+
2017-02-28,72.0,2.304,54.87,235.3,122.989449428927,218.0
|
| 208 |
+
2017-03-31,75.0,2.325,51.59,240.8,107.351636661824,226.0
|
| 209 |
+
2017-04-30,75.0,2.417,52.31,245.6,101.249099379342,228.5
|
| 210 |
+
2017-05-31,72.0,2.391,50.33,245.8,98.6067785788373,229.7
|
| 211 |
+
2017-06-30,72.0,2.347,46.37,244.5,79.7675530736104,228.5
|
| 212 |
+
2017-07-31,72.0,2.3,48.48,241.4,79.3528395564121,225.4
|
| 213 |
+
2017-08-31,75.0,2.38,51.7,240.8,83.1023445805132,225.4
|
| 214 |
+
2017-09-30,77.0,2.645,56.15,244.3,83.6584082517622,226.1
|
| 215 |
+
2017-10-31,80.5,2.505,57.51,249.4,73.6116493026981,232.6
|
| 216 |
+
2017-11-30,82.0,2.564,62.71,251.6,70.2656652434845,235.0
|
| 217 |
+
2017-12-31,82.0,2.477,64.37,253.2,73.6340049532346,236.9
|
| 218 |
+
2018-01-31,79.0,2.555,69.08,247.0,76.8242063567335,239.0
|
| 219 |
+
2018-02-28,83.0,2.587,65.32,247.3,78.4085743171663,236.8
|
| 220 |
+
2018-03-31,83.0,2.591,66.02,252.0,78.1670180931732,238.1
|
| 221 |
+
2018-04-30,83.0,2.757,72.11,248.9,77.7415047447978,239.7
|
| 222 |
+
2018-05-31,83.0,2.901,76.98,254.3,76.1236900344774,236.2
|
| 223 |
+
2018-06-30,83.0,2.891,74.41,257.4,70.0483530041459,235.7
|
| 224 |
+
2018-07-31,83.0,2.849,74.25,257.7,66.1977615602277,234.2
|
| 225 |
+
2018-08-31,83.0,2.836,72.53,262.7,66.5917590376227,234.2
|
| 226 |
+
2018-09-30,86.0,2.836,78.89,260.3,64.9477007375421,230.7
|
| 227 |
+
2018-10-31,86.0,2.86,81.03,260.8,64.4318867137904,233.7
|
| 228 |
+
2018-11-30,83.0,2.647,64.75,254.6,61.0147262177998,233.7
|
| 229 |
+
2018-12-31,80.0,2.366,57.36,248.7,64.4388411130883,224.9
|
| 230 |
+
2019-01-31,80.0,2.248,59.41,242.7,71.8944761455489,223.8
|
| 231 |
+
2019-02-28,80.0,2.309,63.96,241.3,73.9009577214054,223.7
|
| 232 |
+
2019-03-31,80.0,2.516,66.14,239.7,77.7544645422103,223.7
|
| 233 |
+
2019-04-30,83.0,2.798,71.23,239.2,77.6248665680858,224.4
|
| 234 |
+
2019-05-31,83.0,2.859,71.32,241.7,81.5516851840572,221.4
|
| 235 |
+
2019-06-30,83.0,2.716,64.22,238.2,89.9164386367575,222.7
|
| 236 |
+
2019-07-31,80.0,2.74,63.92,237.2,79.7238841910249,222.0
|
| 237 |
+
2019-08-31,77.0,2.621,59.04,237.1,67.7304932369297,220.9
|
| 238 |
+
2019-09-30,80.0,2.592,62.83,237.6,68.1361348959393,220.9
|
| 239 |
+
2019-10-31,80.0,2.627,59.71,238.7,65.121509293294,221.1
|
| 240 |
+
2019-11-30,77.0,2.598,63.21,235.4,69.723710078964,219.7
|
| 241 |
+
2019-12-31,77.0,2.555,67.31,229.5,74.949424390598,217.7
|
| 242 |
+
2020-01-31,47.0,2.548,63.65,228.9,75.2125082780706,215.5
|
| 243 |
+
2020-02-29,47.0,2.442,55.66,232.8,71.6608757971895,218.0
|
| 244 |
+
2020-03-31,47.0,2.234,32.01,231.9,68.3729457395668,217.4
|
| 245 |
+
2020-04-30,43.0,1.841,18.38,216.6,60.6993711474302,219.1
|
| 246 |
+
2020-05-31,43.0,1.87,29.38,210.2,61.37364060725,214.1
|
| 247 |
+
2020-06-30,47.0,2.082,40.27,212.1,64.7854381831213,211.7
|
| 248 |
+
2020-07-31,52.0,2.183,43.24,217.3,67.9849372594608,216.5
|
| 249 |
+
2020-08-31,57.0,2.182,44.74,225.1,79.9616260398618,214.3
|
| 250 |
+
2020-09-30,62.0,2.183,40.91,226.0,89.3124438678774,220.9
|
| 251 |
+
2020-10-31,62.0,2.158,40.19,238.2,101.520278489552,224.0
|
| 252 |
+
2020-11-30,62.0,2.108,42.69,240.0,110.151798107092,222.4
|
| 253 |
+
2020-12-31,67.0,2.195,49.99,246.3,107.745595720848,228.4
|
| 254 |
+
2021-01-31,72.0,2.334,54.77,256.7,104.398944035707,229.2
|
| 255 |
+
2021-02-28,79.0,2.501,62.28,271.7,105.246154792108,233.0
|
| 256 |
+
2021-03-31,86.0,2.81,65.41,302.3,108.160215326471,242.9
|
| 257 |
+
2021-04-30,93.0,2.858,64.81,321.8,99.3282073014635,247.4
|
| 258 |
+
2021-05-31,98.0,2.985,68.53,329.8,105.414992152843,255.9
|
| 259 |
+
2021-06-30,103.0,3.064,73.16,342.7,97.0688826192269,268.6
|
| 260 |
+
2021-07-31,108.0,3.136,75.17,353.336,84.9233924775288,275.777
|
| 261 |
+
2021-08-31,108.0,3.158,70.75,358.454,86.2496117460692,282.857
|
| 262 |
+
2021-09-30,108.0,3.175,74.49,358.01,81.2240575782592,286.721
|
| 263 |
+
2021-10-31,103.0,3.291,83.54,359.606,85.5368228883846,285.666
|
| 264 |
+
2021-11-30,98.0,3.395,81.05,353.75,88.5024565295995,296.322
|
| 265 |
+
2021-12-31,93.0,3.307,74.17,343.395,88.1867087380963,292.442
|
| 266 |
+
2022-01-31,93.0,3.315,86.51,328.684,90.21055782856,285.039
|
| 267 |
+
2022-02-28,93.0,3.517,97.13,328.986,96.8899654160606,284.688
|
| 268 |
+
2022-03-31,97.0,4.222,117.25,328.095,98.3014720470411,288.808
|
| 269 |
+
2022-04-30,97.0,4.109,104.58,343.327,97.0667226529915,291.62
|
| 270 |
+
2022-05-31,100.0,4.444,113.34,349.319,96.0544839308527,291.348
|
| 271 |
+
2022-06-30,100.0,4.929,122.71,352.112,94.0215629822002,304.147
|
| 272 |
+
2022-07-31,97.0,4.559,111.93,342.621,82.938383507189,304.969
|
| 273 |
+
2022-08-31,93.0,3.975,100.45,329.278,73.3045584509684,303.837
|
| 274 |
+
2022-09-30,90.0,3.7,89.76,326.451,66.9564987905564,308.976
|
| 275 |
+
2022-10-31,90.0,3.815,93.33,316.901,68.5357286494898,312.788
|
| 276 |
+
2022-11-30,90.0,3.685,91.42,300.185,65.2658343099326,307.226
|
| 277 |
+
2022-12-31,90.0,3.21,80.92,291.825,65.2658343099326,307.226
|
demo.py
CHANGED
|
@@ -1,4 +1,5 @@
|
|
| 1 |
import json
|
|
|
|
| 2 |
|
| 3 |
import gradio as gr
|
| 4 |
from gr_app import args, GradioApp
|
|
@@ -113,7 +114,7 @@ with demo:
|
|
| 113 |
# Forecasting #
|
| 114 |
# =========== #
|
| 115 |
|
| 116 |
-
column__models = gr.Column(visible=
|
| 117 |
|
| 118 |
with column__models:
|
| 119 |
md__fit_ready = gr.Markdown(**args.md__fit_ready)
|
|
@@ -192,7 +193,6 @@ with demo:
|
|
| 192 |
# Prophet #
|
| 193 |
# ------- #
|
| 194 |
with gr.Tab('Prophet'):
|
| 195 |
-
gr.Markdown('Prophet')
|
| 196 |
|
| 197 |
btn__forecast_with_prophet = gr.Button(
|
| 198 |
**args.btn__forecast_with_prophet)
|
|
@@ -211,6 +211,30 @@ with demo:
|
|
| 211 |
df__prophet_result]
|
| 212 |
)
|
| 213 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 214 |
# --------- #
|
| 215 |
# Operators #
|
| 216 |
# --------- #
|
|
|
|
| 1 |
import json
|
| 2 |
+
import pandas as pd
|
| 3 |
|
| 4 |
import gradio as gr
|
| 5 |
from gr_app import args, GradioApp
|
|
|
|
| 114 |
# Forecasting #
|
| 115 |
# =========== #
|
| 116 |
|
| 117 |
+
column__models = gr.Column(visible=True)
|
| 118 |
|
| 119 |
with column__models:
|
| 120 |
md__fit_ready = gr.Markdown(**args.md__fit_ready)
|
|
|
|
| 193 |
# Prophet #
|
| 194 |
# ------- #
|
| 195 |
with gr.Tab('Prophet'):
|
|
|
|
| 196 |
|
| 197 |
btn__forecast_with_prophet = gr.Button(
|
| 198 |
**args.btn__forecast_with_prophet)
|
|
|
|
| 211 |
df__prophet_result]
|
| 212 |
)
|
| 213 |
|
| 214 |
+
# ---------- #
|
| 215 |
+
# Auto ARIMA #
|
| 216 |
+
# ---------- #
|
| 217 |
+
with gr.Tab('Auto ARIMA'):
|
| 218 |
+
|
| 219 |
+
btn__auto_arima_forecast = gr.Button(
|
| 220 |
+
value='Forecast with auto ARIMA', variant='primary')
|
| 221 |
+
|
| 222 |
+
plot__auto_arima_result = gr.Plot()
|
| 223 |
+
|
| 224 |
+
with gr.Row():
|
| 225 |
+
df__auto_arima_result = gr.DataFrame()
|
| 226 |
+
file__auto_arima_result = gr.File()
|
| 227 |
+
|
| 228 |
+
btn__auto_arima_forecast.click(
|
| 229 |
+
app.btn__auto_arima_forecast__click,
|
| 230 |
+
[],
|
| 231 |
+
[
|
| 232 |
+
plot__auto_arima_result,
|
| 233 |
+
df__auto_arima_result,
|
| 234 |
+
file__auto_arima_result
|
| 235 |
+
]
|
| 236 |
+
)
|
| 237 |
+
|
| 238 |
# --------- #
|
| 239 |
# Operators #
|
| 240 |
# --------- #
|
gr_app/__init__.py
CHANGED
|
@@ -1 +1 @@
|
|
| 1 |
-
from .gr_app import GradioApp
|
|
|
|
| 1 |
+
from .gr_app import GradioApp
|
gr_app/__pycache__/__init__.cpython-310.pyc
CHANGED
|
Binary files a/gr_app/__pycache__/__init__.cpython-310.pyc and b/gr_app/__pycache__/__init__.cpython-310.pyc differ
|
|
|
gr_app/__pycache__/args.cpython-310.pyc
CHANGED
|
Binary files a/gr_app/__pycache__/args.cpython-310.pyc and b/gr_app/__pycache__/args.cpython-310.pyc differ
|
|
|
gr_app/__pycache__/gr_app.cpython-310.pyc
CHANGED
|
Binary files a/gr_app/__pycache__/gr_app.cpython-310.pyc and b/gr_app/__pycache__/gr_app.cpython-310.pyc differ
|
|
|
gr_app/args.py
CHANGED
|
@@ -74,6 +74,12 @@ btn__forecast_with_prophet = {
|
|
| 74 |
'variant': 'primary'
|
| 75 |
}
|
| 76 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 77 |
json_xgboost_params = {
|
| 78 |
'elem_classes': 'json_xgboost_params'
|
| 79 |
}
|
|
|
|
| 74 |
'variant': 'primary'
|
| 75 |
}
|
| 76 |
|
| 77 |
+
btn__forecast_with_auto_arima = {
|
| 78 |
+
'value': 'Forecast with auto ARIMA',
|
| 79 |
+
'variant': 'primary'
|
| 80 |
+
}
|
| 81 |
+
|
| 82 |
+
|
| 83 |
json_xgboost_params = {
|
| 84 |
'elem_classes': 'json_xgboost_params'
|
| 85 |
}
|
gr_app/components/__init__.py
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
from .auto_arima import AutoARIMAForecaster
|
gr_app/components/__pycache__/__init__.cpython-310.pyc
ADDED
|
Binary file (243 Bytes). View file
|
|
|
gr_app/components/__pycache__/auto_arima.cpython-310.pyc
ADDED
|
Binary file (2.32 kB). View file
|
|
|
gr_app/components/auto_arima.py
ADDED
|
@@ -0,0 +1,85 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import gradio as gr
|
| 2 |
+
from sktime.forecasting.arima import AutoARIMA
|
| 3 |
+
from sktime.utils.plotting import plot_series
|
| 4 |
+
import matplotlib.pyplot as plt
|
| 5 |
+
|
| 6 |
+
|
| 7 |
+
class AutoARIMAForecaster():
|
| 8 |
+
def __init__(self) -> None:
|
| 9 |
+
|
| 10 |
+
print('[Auto ARIMA] init model')
|
| 11 |
+
|
| 12 |
+
def cta(self):
|
| 13 |
+
return
|
| 14 |
+
|
| 15 |
+
def fit_predict(
|
| 16 |
+
self,
|
| 17 |
+
y_train,
|
| 18 |
+
y_test,
|
| 19 |
+
y_future,
|
| 20 |
+
fh,
|
| 21 |
+
fh_test,
|
| 22 |
+
sp,
|
| 23 |
+
round_results=False,
|
| 24 |
+
d=None,
|
| 25 |
+
D=None,
|
| 26 |
+
seasonal=True,
|
| 27 |
+
X=None,
|
| 28 |
+
X_train=None,
|
| 29 |
+
X_test=None,
|
| 30 |
+
X_future=None
|
| 31 |
+
):
|
| 32 |
+
print('[Auto ARIMA] Start forecasting')
|
| 33 |
+
self.round_decimal = 0 if round_results else 4
|
| 34 |
+
forecaster = AutoARIMA(
|
| 35 |
+
sp=sp,
|
| 36 |
+
d=d,
|
| 37 |
+
D=D,
|
| 38 |
+
seasonal=seasonal,
|
| 39 |
+
random=True,
|
| 40 |
+
n_fits=5,
|
| 41 |
+
error_action='ignore'
|
| 42 |
+
)
|
| 43 |
+
|
| 44 |
+
self.y_train = y_train
|
| 45 |
+
self.y_test = y_test
|
| 46 |
+
self.y_future = y_future
|
| 47 |
+
self.sp = sp
|
| 48 |
+
|
| 49 |
+
forecaster.fit(y_train, X_train)
|
| 50 |
+
|
| 51 |
+
print('[Auto ARIMA] - Fitted complete')
|
| 52 |
+
|
| 53 |
+
self.test = forecaster.predict(fh_test, X_test)
|
| 54 |
+
self.predict_interval = forecaster.predict_interval(
|
| 55 |
+
fh_test, X_test, coverage=.9)
|
| 56 |
+
|
| 57 |
+
forecaster.update(y_future, X, update_params=False)
|
| 58 |
+
|
| 59 |
+
self.forecast = forecaster.predict(fh, X_future)
|
| 60 |
+
|
| 61 |
+
self.forecast_interval = forecaster.predict_interval(
|
| 62 |
+
fh, X_future, coverage=.9)
|
| 63 |
+
|
| 64 |
+
self.test = round(self.test, self.round_decimal)
|
| 65 |
+
self.forecast = round(self.forecast, self.round_decimal)
|
| 66 |
+
|
| 67 |
+
print('[Auto ARIMA] Forecast completed')
|
| 68 |
+
|
| 69 |
+
def plot_results(self, figsize=(12, 6)):
|
| 70 |
+
fig, ax = plt.subplots(figsize=figsize)
|
| 71 |
+
plot_series(
|
| 72 |
+
self.y_train[-2*self.sp:],
|
| 73 |
+
self.y_test,
|
| 74 |
+
self.test,
|
| 75 |
+
self.forecast,
|
| 76 |
+
labels=["y_train (part)", "y_test", "y_pred", 'y_forecast'],
|
| 77 |
+
x_label='Date',
|
| 78 |
+
pred_interval=self.forecast_interval,
|
| 79 |
+
ax=ax)
|
| 80 |
+
|
| 81 |
+
ax.set_title('Auto ARIMA Forecast Result')
|
| 82 |
+
ax.set_xticklabels(ax.get_xticklabels(), rotation=45)
|
| 83 |
+
ax.legend(loc='upper left')
|
| 84 |
+
# fig.tight_layout()
|
| 85 |
+
return fig
|
gr_app/gr_app.py
CHANGED
|
@@ -20,6 +20,11 @@ from src.idsc import IDSC
|
|
| 20 |
|
| 21 |
from src.forecaster.models import ProphetForecaster
|
| 22 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 23 |
|
| 24 |
class GradioApp():
|
| 25 |
def __init__(
|
|
@@ -29,13 +34,13 @@ class GradioApp():
|
|
| 29 |
self.analyser = Analyser()
|
| 30 |
self.idsc = IDSC()
|
| 31 |
|
| 32 |
-
self.historical_demo_data = 'data/multivariate/
|
| 33 |
-
self.future_demo_data = 'data/multivariate/
|
| 34 |
|
| 35 |
self.data: pd.DataFrame = None
|
| 36 |
self.n_predict = 3
|
| 37 |
-
self.window_length =
|
| 38 |
-
self.target_column = '
|
| 39 |
self.exog_columns = []
|
| 40 |
|
| 41 |
# Define if the model's result is going to be rounded
|
|
@@ -67,6 +72,8 @@ class GradioApp():
|
|
| 67 |
self.prophet__weekly_seasonality = False
|
| 68 |
self.prophet__daily_seasonality = False
|
| 69 |
|
|
|
|
|
|
|
| 70 |
def checkbox__round_results__change(self, val):
|
| 71 |
self.round_results = val
|
| 72 |
|
|
@@ -75,7 +82,9 @@ class GradioApp():
|
|
| 75 |
self.target_column = val
|
| 76 |
|
| 77 |
def btn__profiling__click(self):
|
| 78 |
-
self.analyser.fit(
|
|
|
|
|
|
|
| 79 |
self.analyser.profiling()
|
| 80 |
|
| 81 |
return (
|
|
@@ -257,7 +266,7 @@ class GradioApp():
|
|
| 257 |
self.forecaster.fh_test,
|
| 258 |
self.forecaster.period,
|
| 259 |
self.forecaster.freq,
|
| 260 |
-
X=self.forecaster.
|
| 261 |
seasonality_mode=self.prophet__seasonality_mode,
|
| 262 |
add_country_holidays=self.prophet__add_country_holidays,
|
| 263 |
yearly_seasonality=self.prophet__yearly_seasonality,
|
|
@@ -283,6 +292,7 @@ class GradioApp():
|
|
| 283 |
ax=ax)
|
| 284 |
|
| 285 |
ax.set_title('Prophet Forecast Result')
|
|
|
|
| 286 |
ax.legend(loc='upper left')
|
| 287 |
fig.tight_layout()
|
| 288 |
|
|
@@ -297,6 +307,46 @@ class GradioApp():
|
|
| 297 |
prophet_forecast_df = self.prophet.forecast.reset_index()
|
| 298 |
return gr.Dataframe(value=prophet_forecast_df)
|
| 299 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 300 |
# =============================== #
|
| 301 |
# || Gradio Component Updaters || #
|
| 302 |
# =============================== #
|
|
@@ -304,7 +354,7 @@ class GradioApp():
|
|
| 304 |
def update__plot__changepoints(self):
|
| 305 |
fig, axs = plt.subplots(2, 1, figsize=(20, 8))
|
| 306 |
|
| 307 |
-
axs[0].plot(self.data[[
|
| 308 |
|
| 309 |
axs[0].text(self.data.index[0],
|
| 310 |
axs[0].get_ylim()[1]*0.9,
|
|
@@ -318,7 +368,7 @@ class GradioApp():
|
|
| 318 |
self.analyser.quantity_predictability[i+1],
|
| 319 |
fontsize=20)
|
| 320 |
|
| 321 |
-
axs[1].plot(self.data[[
|
| 322 |
|
| 323 |
axs[1].text(self.data.index[0],
|
| 324 |
axs[1].get_ylim()[1]*0.9,
|
|
|
|
| 20 |
|
| 21 |
from src.forecaster.models import ProphetForecaster
|
| 22 |
|
| 23 |
+
'''
|
| 24 |
+
Below is a new structure, still experimenting the possibility
|
| 25 |
+
'''
|
| 26 |
+
from .components import AutoARIMAForecaster
|
| 27 |
+
|
| 28 |
|
| 29 |
class GradioApp():
|
| 30 |
def __init__(
|
|
|
|
| 34 |
self.analyser = Analyser()
|
| 35 |
self.idsc = IDSC()
|
| 36 |
|
| 37 |
+
self.historical_demo_data = 'data/multivariate/blow_mold_historical.csv'
|
| 38 |
+
self.future_demo_data = 'data/multivariate/blow_mold_future.csv'
|
| 39 |
|
| 40 |
self.data: pd.DataFrame = None
|
| 41 |
self.n_predict = 3
|
| 42 |
+
self.window_length = 2
|
| 43 |
+
self.target_column = 'price'
|
| 44 |
self.exog_columns = []
|
| 45 |
|
| 46 |
# Define if the model's result is going to be rounded
|
|
|
|
| 72 |
self.prophet__weekly_seasonality = False
|
| 73 |
self.prophet__daily_seasonality = False
|
| 74 |
|
| 75 |
+
self.auto_arima = AutoARIMAForecaster()
|
| 76 |
+
|
| 77 |
def checkbox__round_results__change(self, val):
|
| 78 |
self.round_results = val
|
| 79 |
|
|
|
|
| 82 |
self.target_column = val
|
| 83 |
|
| 84 |
def btn__profiling__click(self):
|
| 85 |
+
self.analyser.fit(
|
| 86 |
+
self.data,
|
| 87 |
+
target_col=self.target_column)
|
| 88 |
self.analyser.profiling()
|
| 89 |
|
| 90 |
return (
|
|
|
|
| 266 |
self.forecaster.fh_test,
|
| 267 |
self.forecaster.period,
|
| 268 |
self.forecaster.freq,
|
| 269 |
+
X=self.forecaster.X,
|
| 270 |
seasonality_mode=self.prophet__seasonality_mode,
|
| 271 |
add_country_holidays=self.prophet__add_country_holidays,
|
| 272 |
yearly_seasonality=self.prophet__yearly_seasonality,
|
|
|
|
| 292 |
ax=ax)
|
| 293 |
|
| 294 |
ax.set_title('Prophet Forecast Result')
|
| 295 |
+
ax.set_xticklabels(ax.get_xticklabels(), rotation=45)
|
| 296 |
ax.legend(loc='upper left')
|
| 297 |
fig.tight_layout()
|
| 298 |
|
|
|
|
| 307 |
prophet_forecast_df = self.prophet.forecast.reset_index()
|
| 308 |
return gr.Dataframe(value=prophet_forecast_df)
|
| 309 |
|
| 310 |
+
# -------------------------------- #
|
| 311 |
+
# Auto ARIMA Operations & Updaters #
|
| 312 |
+
# -------------------------------- #
|
| 313 |
+
def btn__auto_arima_forecast__click(self):
|
| 314 |
+
self.auto_arima.fit_predict(
|
| 315 |
+
y_train=self.forecaster.y_train,
|
| 316 |
+
y_test=self.forecaster.y_test,
|
| 317 |
+
y_future=self.forecaster.y,
|
| 318 |
+
fh=self.forecaster.fh,
|
| 319 |
+
fh_test=self.forecaster.fh_test,
|
| 320 |
+
sp=self.forecaster.period,
|
| 321 |
+
round_results=self.round_results,
|
| 322 |
+
d=1,
|
| 323 |
+
D=0,
|
| 324 |
+
seasonal=True,
|
| 325 |
+
X=self.forecaster.X,
|
| 326 |
+
X_train=self.forecaster.X_train,
|
| 327 |
+
X_test=self.forecaster.X_test,
|
| 328 |
+
X_future=self.forecaster.X_future)
|
| 329 |
+
return (
|
| 330 |
+
self.update__plot__auto_arima_result(),
|
| 331 |
+
self.update__df__auto_arima_result(),
|
| 332 |
+
self.update__file__auto_arima_result()
|
| 333 |
+
)
|
| 334 |
+
|
| 335 |
+
def update__plot__auto_arima_result(self):
|
| 336 |
+
fig = self.auto_arima.plot_results(
|
| 337 |
+
figsize=self.plot_figsize_full_screen)
|
| 338 |
+
return gr.Plot(fig)
|
| 339 |
+
|
| 340 |
+
def update__df__auto_arima_result(self):
|
| 341 |
+
auto_arima_result_df = self.auto_arima.forecast.reset_index()
|
| 342 |
+
return gr.Dataframe(auto_arima_result_df)
|
| 343 |
+
|
| 344 |
+
def update__file__auto_arima_result(self):
|
| 345 |
+
auto_arima_result_df = self.auto_arima.forecast
|
| 346 |
+
auto_arima_result_path = self.__create_temp_csv_file(
|
| 347 |
+
auto_arima_result_df)
|
| 348 |
+
return gr.File(auto_arima_result_path)
|
| 349 |
+
|
| 350 |
# =============================== #
|
| 351 |
# || Gradio Component Updaters || #
|
| 352 |
# =============================== #
|
|
|
|
| 354 |
def update__plot__changepoints(self):
|
| 355 |
fig, axs = plt.subplots(2, 1, figsize=(20, 8))
|
| 356 |
|
| 357 |
+
axs[0].plot(self.data[[self.target_column]])
|
| 358 |
|
| 359 |
axs[0].text(self.data.index[0],
|
| 360 |
axs[0].get_ylim()[1]*0.9,
|
|
|
|
| 368 |
self.analyser.quantity_predictability[i+1],
|
| 369 |
fontsize=20)
|
| 370 |
|
| 371 |
+
axs[1].plot(self.data[[self.target_column]])
|
| 372 |
|
| 373 |
axs[1].text(self.data.index[0],
|
| 374 |
axs[1].get_ylim()[1]*0.9,
|
gr_component_test.ipynb
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
src/analyser/__pycache__/analyser.cpython-310.pyc
CHANGED
|
Binary files a/src/analyser/__pycache__/analyser.cpython-310.pyc and b/src/analyser/__pycache__/analyser.cpython-310.pyc differ
|
|
|
src/analyser/analyser.py
CHANGED
|
@@ -14,8 +14,13 @@ class Analyser():
|
|
| 14 |
self.idsc = IDSC()
|
| 15 |
self.viz = Visualiser()
|
| 16 |
|
| 17 |
-
def fit(
|
|
|
|
|
|
|
|
|
|
|
|
|
| 18 |
self.data = data
|
|
|
|
| 19 |
|
| 20 |
def profiling(self):
|
| 21 |
# --------------------------------- #
|
|
@@ -26,7 +31,7 @@ class Analyser():
|
|
| 26 |
self.characteristic = None
|
| 27 |
|
| 28 |
self.profile = self.idsc.profiling(
|
| 29 |
-
self.data[[
|
| 30 |
# Parse profile result
|
| 31 |
self.intermittent_change_points_idx = self.profile['change_point_res']['inter_order_cpi']
|
| 32 |
self.quantity_change_points_idx = self.profile['change_point_res']['order_quantity_cpi']
|
|
|
|
| 14 |
self.idsc = IDSC()
|
| 15 |
self.viz = Visualiser()
|
| 16 |
|
| 17 |
+
def fit(
|
| 18 |
+
self,
|
| 19 |
+
data,
|
| 20 |
+
target_col: str = None
|
| 21 |
+
):
|
| 22 |
self.data = data
|
| 23 |
+
self.target_col = target_col
|
| 24 |
|
| 25 |
def profiling(self):
|
| 26 |
# --------------------------------- #
|
|
|
|
| 31 |
self.characteristic = None
|
| 32 |
|
| 33 |
self.profile = self.idsc.profiling(
|
| 34 |
+
self.data[[self.target_col]].rename(columns={self.target_col: 'target'}).dropna().to_json())
|
| 35 |
# Parse profile result
|
| 36 |
self.intermittent_change_points_idx = self.profile['change_point_res']['inter_order_cpi']
|
| 37 |
self.quantity_change_points_idx = self.profile['change_point_res']['order_quantity_cpi']
|
src/forecaster/__pycache__/forecaster.cpython-310.pyc
CHANGED
|
Binary files a/src/forecaster/__pycache__/forecaster.cpython-310.pyc and b/src/forecaster/__pycache__/forecaster.cpython-310.pyc differ
|
|
|
src/forecaster/forecaster.py
CHANGED
|
@@ -8,7 +8,7 @@ from sktime.forecasting.model_selection import temporal_train_test_split
|
|
| 8 |
from typing import List
|
| 9 |
import logging
|
| 10 |
|
| 11 |
-
from .utils import split_x_y
|
| 12 |
from .models import AllModels
|
| 13 |
|
| 14 |
|
|
@@ -69,7 +69,8 @@ class Forecaster():
|
|
| 69 |
self.data,
|
| 70 |
window_length,
|
| 71 |
n_predict,
|
| 72 |
-
self.freq
|
|
|
|
| 73 |
|
| 74 |
if exog is not None:
|
| 75 |
print('[Forecaster - fit] - exogenous data provided')
|
|
|
|
| 8 |
from typing import List
|
| 9 |
import logging
|
| 10 |
|
| 11 |
+
from .utils import split_x_y
|
| 12 |
from .models import AllModels
|
| 13 |
|
| 14 |
|
|
|
|
| 69 |
self.data,
|
| 70 |
window_length,
|
| 71 |
n_predict,
|
| 72 |
+
self.freq,
|
| 73 |
+
target_col=self.target_col)
|
| 74 |
|
| 75 |
if exog is not None:
|
| 76 |
print('[Forecaster - fit] - exogenous data provided')
|
src/forecaster/models/__pycache__/prophet.cpython-310.pyc
CHANGED
|
Binary files a/src/forecaster/models/__pycache__/prophet.cpython-310.pyc and b/src/forecaster/models/__pycache__/prophet.cpython-310.pyc differ
|
|
|
src/forecaster/models/prophet.py
CHANGED
|
@@ -1,4 +1,5 @@
|
|
| 1 |
from sktime.forecasting.fbprophet import Prophet
|
|
|
|
| 2 |
|
| 3 |
|
| 4 |
class ProphetForecaster():
|
|
@@ -15,17 +16,20 @@ class ProphetForecaster():
|
|
| 15 |
sp,
|
| 16 |
freq,
|
| 17 |
round_val=False,
|
| 18 |
-
X=None,
|
| 19 |
seasonality_mode=None,
|
| 20 |
add_country_holidays=None,
|
| 21 |
yearly_seasonality=False,
|
| 22 |
weekly_seasonality=False,
|
| 23 |
-
daily_seasonality=False
|
|
|
|
|
|
|
|
|
|
|
|
|
| 24 |
):
|
| 25 |
|
| 26 |
print('[Prophet] Start forecasting')
|
| 27 |
|
| 28 |
-
round_decimal = 0 if
|
| 29 |
|
| 30 |
forecaster = Prophet(
|
| 31 |
seasonality_mode=seasonality_mode,
|
|
@@ -36,16 +40,17 @@ class ProphetForecaster():
|
|
| 36 |
daily_seasonality=daily_seasonality
|
| 37 |
)
|
| 38 |
|
| 39 |
-
forecaster.fit(y_train)
|
| 40 |
|
| 41 |
-
self.predict = forecaster.predict(fh_test)
|
| 42 |
self.predict_interval = forecaster.predict_interval(
|
| 43 |
-
fh_test, coverage=.9)
|
| 44 |
|
| 45 |
-
forecaster.update(y_future, update_params=False)
|
| 46 |
|
| 47 |
-
self.forecast = forecaster.predict(fh)
|
| 48 |
-
self.forecast_interval = forecaster.predict_interval(
|
|
|
|
| 49 |
|
| 50 |
self.predict = round(self.predict, round_decimal)
|
| 51 |
self.predict_interval = round(self.predict_interval, round_decimal)
|
|
|
|
| 1 |
from sktime.forecasting.fbprophet import Prophet
|
| 2 |
+
import pandas as pd
|
| 3 |
|
| 4 |
|
| 5 |
class ProphetForecaster():
|
|
|
|
| 16 |
sp,
|
| 17 |
freq,
|
| 18 |
round_val=False,
|
|
|
|
| 19 |
seasonality_mode=None,
|
| 20 |
add_country_holidays=None,
|
| 21 |
yearly_seasonality=False,
|
| 22 |
weekly_seasonality=False,
|
| 23 |
+
daily_seasonality=False,
|
| 24 |
+
X: pd.DataFrame = None,
|
| 25 |
+
X_train=None,
|
| 26 |
+
X_test=None,
|
| 27 |
+
X_future: pd.DataFrame = None
|
| 28 |
):
|
| 29 |
|
| 30 |
print('[Prophet] Start forecasting')
|
| 31 |
|
| 32 |
+
round_decimal = 0 if round_val else 4
|
| 33 |
|
| 34 |
forecaster = Prophet(
|
| 35 |
seasonality_mode=seasonality_mode,
|
|
|
|
| 40 |
daily_seasonality=daily_seasonality
|
| 41 |
)
|
| 42 |
|
| 43 |
+
forecaster.fit(y_train, X_train)
|
| 44 |
|
| 45 |
+
self.predict = forecaster.predict(fh_test, X_test)
|
| 46 |
self.predict_interval = forecaster.predict_interval(
|
| 47 |
+
fh_test, X_test, coverage=.9)
|
| 48 |
|
| 49 |
+
forecaster.update(y_future, X, update_params=False)
|
| 50 |
|
| 51 |
+
self.forecast = forecaster.predict(fh, X_future)
|
| 52 |
+
self.forecast_interval = forecaster.predict_interval(
|
| 53 |
+
fh, X_future, coverage=.9)
|
| 54 |
|
| 55 |
self.predict = round(self.predict, round_decimal)
|
| 56 |
self.predict_interval = round(self.predict_interval, round_decimal)
|
src/forecaster/utils/__pycache__/prep_data.cpython-310.pyc
CHANGED
|
Binary files a/src/forecaster/utils/__pycache__/prep_data.cpython-310.pyc and b/src/forecaster/utils/__pycache__/prep_data.cpython-310.pyc differ
|
|
|
src/forecaster/utils/prep_data.py
CHANGED
|
@@ -9,10 +9,11 @@ def split_x_y(
|
|
| 9 |
window_length: int,
|
| 10 |
n_predict: int,
|
| 11 |
freq: str,
|
|
|
|
| 12 |
):
|
| 13 |
# print('[prep_data] ----- Start -----')
|
| 14 |
datetime_index = data.index
|
| 15 |
-
y = data[
|
| 16 |
X_train, X_forecast = None, None
|
| 17 |
|
| 18 |
has_X = len(data.columns) > 1
|
|
@@ -20,7 +21,7 @@ def split_x_y(
|
|
| 20 |
if has_X:
|
| 21 |
# print('[prep_data] - additional feature columns found')
|
| 22 |
|
| 23 |
-
X = data.drop(columns=
|
| 24 |
X_columns = X.columns
|
| 25 |
|
| 26 |
X_train = pd.DataFrame()
|
|
@@ -75,7 +76,8 @@ def k_folds(
|
|
| 75 |
period: int,
|
| 76 |
window_length: int,
|
| 77 |
n_predict: int,
|
| 78 |
-
freq: str
|
|
|
|
| 79 |
):
|
| 80 |
'''
|
| 81 |
Amount of folds for testing is data size - window length and 2 seasonality period
|
|
@@ -101,7 +103,8 @@ def k_folds(
|
|
| 101 |
d,
|
| 102 |
window_length,
|
| 103 |
n_predict,
|
| 104 |
-
freq
|
|
|
|
| 105 |
))
|
| 106 |
|
| 107 |
print('[k_folds] ----- END -----')
|
|
|
|
| 9 |
window_length: int,
|
| 10 |
n_predict: int,
|
| 11 |
freq: str,
|
| 12 |
+
target_col: str = 'y'
|
| 13 |
):
|
| 14 |
# print('[prep_data] ----- Start -----')
|
| 15 |
datetime_index = data.index
|
| 16 |
+
y = data[target_col]
|
| 17 |
X_train, X_forecast = None, None
|
| 18 |
|
| 19 |
has_X = len(data.columns) > 1
|
|
|
|
| 21 |
if has_X:
|
| 22 |
# print('[prep_data] - additional feature columns found')
|
| 23 |
|
| 24 |
+
X = data.drop(columns=target_col).reset_index(drop=True)
|
| 25 |
X_columns = X.columns
|
| 26 |
|
| 27 |
X_train = pd.DataFrame()
|
|
|
|
| 76 |
period: int,
|
| 77 |
window_length: int,
|
| 78 |
n_predict: int,
|
| 79 |
+
freq: str,
|
| 80 |
+
target_col: str = 'y'
|
| 81 |
):
|
| 82 |
'''
|
| 83 |
Amount of folds for testing is data size - window length and 2 seasonality period
|
|
|
|
| 103 |
d,
|
| 104 |
window_length,
|
| 105 |
n_predict,
|
| 106 |
+
freq,
|
| 107 |
+
target_col=target_col
|
| 108 |
))
|
| 109 |
|
| 110 |
print('[k_folds] ----- END -----')
|
src/idsc/IDSC.py
CHANGED
|
@@ -13,7 +13,7 @@ from .auto_arima import auto_arima
|
|
| 13 |
|
| 14 |
|
| 15 |
from dotenv import load_dotenv
|
| 16 |
-
|
| 17 |
|
| 18 |
|
| 19 |
class IDSC():
|
|
|
|
| 13 |
|
| 14 |
|
| 15 |
from dotenv import load_dotenv
|
| 16 |
+
load_dotenv()
|
| 17 |
|
| 18 |
|
| 19 |
class IDSC():
|
src/idsc/__pycache__/IDSC.cpython-310.pyc
CHANGED
|
Binary files a/src/idsc/__pycache__/IDSC.cpython-310.pyc and b/src/idsc/__pycache__/IDSC.cpython-310.pyc differ
|
|
|
src/idsc/config.yml
CHANGED
|
@@ -1,2 +1,2 @@
|
|
| 1 |
-
apikey:
|
| 2 |
-
apikey_expire: 12/
|
|
|
|
| 1 |
+
apikey: 51a8043a7bb7db880b04d9b35962a2429e646c61
|
| 2 |
+
apikey_expire: 12/21/2023, 15:39:52
|
temp/20231218165125.csv
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
,price
|
| 2 |
+
2023-01-31,87.0
|
| 3 |
+
2023-02-28,87.0
|
| 4 |
+
2023-03-31,87.0
|
temp/20231218165600.csv
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
,price
|
| 2 |
+
2023-01-31,73.0
|
| 3 |
+
2023-02-28,78.0
|
| 4 |
+
2023-03-31,80.0
|
temp/20231218165649.csv
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
,price
|
| 2 |
+
2023-01-31,73.0
|
| 3 |
+
2023-02-28,78.0
|
| 4 |
+
2023-03-31,80.0
|
temp/20231218165805.csv
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
,price
|
| 2 |
+
2023-01-31,73.0
|
| 3 |
+
2023-02-28,78.0
|
| 4 |
+
2023-03-31,80.0
|