File tree Expand file tree Collapse file tree 2 files changed +13
-10
lines changed
Expand file tree Collapse file tree 2 files changed +13
-10
lines changed Original file line number Diff line number Diff line change @@ -11,7 +11,7 @@ def task_evaluate_ar_models(
1111 BLD / "models" / "ar_model_evaluation.pkl" ,
1212 BLD / "models" / "top_models.tex" ,
1313 ),
14- max_p = 15 ,
14+ max_p = 12 ,
1515 criterion = "aic" ,
1616):
1717 df = pd .read_pickle (data )
Original file line number Diff line number Diff line change 55import plotly .graph_objects as go
66import plotly .io as pio
77
8+ from lennart_epp .analysis .evaluate_ar_model import _predict_ar
9+
810msg = "Fehler beim Erstellen des PDF-Plots"
911
1012
1113def _predict_ar_from_coefficients (
1214 df : pd .DataFrame , integrated_coefficients : pd .DataFrame
1315) -> pd .Series :
14- coeffs = integrated_coefficients ["coefficient" ].to_numpy ()
15- lag_order = len (coeffs ) - 1
16- predictions = [np .nan ] * lag_order
17- for i in range (lag_order , len (df )):
18- ar_sum = coeffs [0 ]
19- for lag in range (1 , len (coeffs )):
20- ar_sum += coeffs [lag ] * df ["close_price" ].iloc [i - lag ]
21- predictions .append (ar_sum )
22- return pd .Series (predictions , index = df .index )
16+ model_results = {"integrated_coefficients" : integrated_coefficients }
17+
18+ predictions = _predict_ar (df , model_results )
19+
20+ lag_order = len (integrated_coefficients ) - 1
21+ predictions_series = pd .Series (
22+ [np .nan ] * lag_order + list (predictions ), index = df .index
23+ )
24+
25+ return predictions_series
2326
2427
2528def plot_top_ar_models (
You can’t perform that action at this time.
0 commit comments