Daniel Varga commited on
Commit
5711d94
1 Parent(s): e79546e

batchh prediction and update does not work

Browse files
Files changed (1) hide show
  1. v2/test_predictor_sktime.py +24 -8
v2/test_predictor_sktime.py CHANGED
@@ -14,18 +14,34 @@ from sktime.forecasting.model_evaluation import evaluate
14
  from sktime.utils.plotting import plot_series
15
 
16
 
17
- # step 1: splitting historical data
18
- y = load_airline()
19
 
20
- # forecaster = NaiveForecaster(strategy="last", sp=12)
21
- forecaster = AutoETS(auto=True, sp=12, n_jobs=-1)
22
- # forecaster = AutoARIMA(sp=12, suppress_warnings=True)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
23
 
24
  cv = ExpandingWindowSplitter(
25
- step_length=12, fh=[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12], initial_window=72
 
26
  )
27
 
28
- df = evaluate(forecaster=forecaster, y=y, cv=cv, strategy="refit", return_data=True)
 
29
 
30
  print(df['y_pred'])
31
 
@@ -43,7 +59,7 @@ fig, ax = plot_series(
43
  ax.legend()
44
  plt.show()
45
 
46
-
47
 
48
  y_train, y_test = temporal_train_test_split(y, test_size=len(y.index) // 2)
49
 
 
14
  from sktime.utils.plotting import plot_series
15
 
16
 
17
+ from data_processing import read_datasets, add_production_field, interpolate_and_join, SolarParameters
 
18
 
19
+
20
+ parameters = SolarParameters()
21
+ met_2021_data, cons_2021_data = read_datasets()
22
+ add_production_field(met_2021_data, parameters)
23
+ all_data = interpolate_and_join(met_2021_data, cons_2021_data)
24
+
25
+ all_data['y'] = all_data['Consumption']
26
+ y = all_data[['y']]
27
+ y = y[y.index <= '2021-01-20']
28
+
29
+ print(len(y['y']), "data points read")
30
+
31
+ # 5 mins timestep means:
32
+ period = 12*24
33
+
34
+ forecaster = NaiveForecaster(strategy="last", sp=period)
35
+ # forecaster = AutoETS(auto=True, sp=period, n_jobs=-1)
36
+ # forecaster = AutoARIMA(sp=period, suppress_warnings=True)
37
 
38
  cv = ExpandingWindowSplitter(
39
+ step_length=period, fh=[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12], initial_window=period*10
40
+ # step_length=period, fh=[1, 2], initial_window=period*2
41
  )
42
 
43
+ strategy = "no-update_params"
44
+ df = evaluate(forecaster=forecaster, y=y, cv=cv, strategy=strategy, return_data=True)
45
 
46
  print(df['y_pred'])
47
 
 
59
  ax.legend()
60
  plt.show()
61
 
62
+ exit()
63
 
64
  y_train, y_test = temporal_train_test_split(y, test_size=len(y.index) // 2)
65