File tree Expand file tree Collapse file tree 1 file changed +37
-1
lines changed
Expand file tree Collapse file tree 1 file changed +37
-1
lines changed Original file line number Diff line number Diff line change 1010# Forecasting horizon
1111h = 20
1212
13-
1413# Data frame containing the time series
1514df = pd .read_csv ("https://raw.githubusercontent.com/Techtonique/datasets/refs/heads/main/time_series/univariate/AirPassengers.csv" ).set_index ('date' )
1615df .index = pd .DatetimeIndex (df .index )
4443print (d3 .averages_ [1 ])
4544print (np .asarray (d3 .fcast_ .rx2 ['mean' ]))
4645
46+ print (d3 .fcast_ .rx2 ['sims' ][0 ])
47+ print (d3 .fcast_ .rx2 ['sims' ][1 ])
48+ d3 .plot ()
49+
50+ # Data frame containing the time series
51+ df = pd .read_csv ("https://raw.githubusercontent.com/Techtonique/datasets/refs/heads/main/time_series/univariate/a10.csv" ).set_index ('date' )
52+ df .index = pd .DatetimeIndex (df .index )
53+ print (df )
54+
55+ # univariate ts forecasting
56+ print ("Example 1 -----" )
57+ d1 = Ridge2Regressor (h = h , date_formatting = "original" )
58+
59+ start = time ()
60+ d1 .forecast (df )
61+ print (f"Elapsed: { time ()- start } \n " )
62+ print ("averages: \n " )
63+ print (d1 .averages_ )
64+ print ("\n " )
65+ print ("ranges: \n " )
66+ print (d1 .ranges_ )
67+ print ("\n " )
68+ d1 .plot ()
69+
70+ print ("Example 2 -----" )
71+
72+ d3 = Ridge2Regressor (h = h , date_formatting = "original" ,
73+ type_pi = "bootstrap" , B = 5 )
74+
75+ start = time ()
76+ d3 .forecast (df )
77+ print (f"Elapsed: { time ()- start } \n " )
78+
79+ print (d3 .fcast_ .rx2 ['mean' ])
80+ print (d3 .averages_ [1 ])
81+ print (np .asarray (d3 .fcast_ .rx2 ['mean' ]))
82+
4783print (d3 .fcast_ .rx2 ['sims' ][0 ])
4884print (d3 .fcast_ .rx2 ['sims' ][1 ])
4985d3 .plot ()
You can’t perform that action at this time.
0 commit comments