perf: trim persisted ML fold metadata

This commit is contained in:
Hermes Agent
2026-07-26 23:19:21 +00:00
parent 1c46e1ad4b
commit 741de87ce2
3 changed files with 29 additions and 6751 deletions
+9 -1
View File
@@ -164,6 +164,14 @@ def viable_classification_splits(y, splits):
yield train_idx, val_idx
def artifact_fold_results(fold_results):
"""Strip training-only row indexes from the persisted ML artifact."""
return [
{key: value for key, value in fold.items() if key not in {"train_idx", "val_idx"}}
for fold in fold_results
]
def _build_model():
return GradientBoostingClassifier(
n_estimators=300,
@@ -503,7 +511,7 @@ def train_model(rows):
"mean_recall": round(float(np.mean(cv_recall)), 4),
"validation_method": "purged_expanding_window",
"label_horizon_days": LABEL_HORIZON_DAYS,
"folds": fold_results,
"folds": artifact_fold_results(fold_results),
},
"training_info": {
"n_samples": len(labeled),