warn when val period shorter than projection period
This commit is contained in:
@@ -1,8 +1,9 @@
|
||||
import pandas as pd
|
||||
import numpy as np
|
||||
from datetime import timedelta
|
||||
import matplotlib.pyplot as plt
|
||||
import seaborn as sns
|
||||
import warnings
|
||||
from datetime import timedelta
|
||||
from multiprocessing import Pool
|
||||
|
||||
|
||||
@@ -1079,6 +1080,11 @@ def create_backtest_plot(
|
||||
if len(training_df) < 30: # Require at least 30 days of training data
|
||||
raise ValueError("Insufficient training data before backtest date")
|
||||
|
||||
if len(validation_df) < project_days:
|
||||
warnings.warn(
|
||||
f"Validation period ({len(validation_df)} days) shorter than projection period ({project_days} days)"
|
||||
)
|
||||
|
||||
# Generate historical projections using only training data
|
||||
historical_projections = project_prices(training_df, days_forward=project_days)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user