Add multifeature direct horizon Torch forecaster
This commit is contained in:
@@ -291,9 +291,42 @@ def _time_series_model_artifact(settings: Settings) -> dict[str, Any]:
|
||||
"created_at": data.get("created_at", ""),
|
||||
"symbol_count": len(rows),
|
||||
"models": models,
|
||||
"feature_count": _artifact_feature_count(data, rows),
|
||||
"target_horizon": _artifact_target_horizon(data, rows),
|
||||
"direct_horizon": _artifact_direct_horizon(data, rows),
|
||||
}
|
||||
|
||||
|
||||
def _artifact_feature_count(data: dict[str, Any], rows: list[Any]) -> int:
|
||||
feature_count = data.get("feature_count")
|
||||
if isinstance(feature_count, int):
|
||||
return feature_count
|
||||
counts = [
|
||||
int(row.get("input_size", 0))
|
||||
for row in rows
|
||||
if isinstance(row, dict) and isinstance(row.get("input_size"), int)
|
||||
]
|
||||
return max(counts) if counts else 1
|
||||
|
||||
|
||||
def _artifact_target_horizon(data: dict[str, Any], rows: list[Any]) -> int:
|
||||
horizon = data.get("target_horizon")
|
||||
if isinstance(horizon, int):
|
||||
return horizon
|
||||
horizons = [
|
||||
int(row.get("target_horizon", 0))
|
||||
for row in rows
|
||||
if isinstance(row, dict) and isinstance(row.get("target_horizon"), int)
|
||||
]
|
||||
return max(horizons) if horizons else 0
|
||||
|
||||
|
||||
def _artifact_direct_horizon(data: dict[str, Any], rows: list[Any]) -> bool:
|
||||
if bool(data.get("direct_horizon")):
|
||||
return True
|
||||
return any(isinstance(row, dict) and bool(row.get("direct_horizon")) for row in rows)
|
||||
|
||||
|
||||
def _forecast_model_label(model: str, *, torch_artifact: bool = False) -> str:
|
||||
normalized = model.strip().lower()
|
||||
if normalized in {"torch_lstm", "lstm"} and torch_artifact:
|
||||
|
||||
Reference in New Issue
Block a user