|
@@ -136,6 +136,7 @@ SPECIAL_REVERSE = {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+METRICS_JSON = 'model_metrics.json'
|
|
|
|
|
|
# ------------ 数据加载与预处理 ------------
|
|
|
def load_and_preprocess_data():
|
|
@@ -362,10 +363,9 @@ def evaluate_and_predict(model, scaler, X_tr, y_tr, X_te, y_te, X_fu, use_tuning
|
|
|
}
|
|
|
|
|
|
# 保存为JSON
|
|
|
- json_path = './model_metrics.json'
|
|
|
- with open(json_path, 'w', encoding='utf-8') as f:
|
|
|
+ with open(METRICS_JSON, 'w', encoding='utf-8') as f:
|
|
|
json.dump([metrics], f, ensure_ascii=False, indent=4)
|
|
|
- print(f"评估指标已保存至 {json_path}")
|
|
|
+ print(f"评估指标已保存至 {METRICS_JSON}")
|
|
|
|
|
|
return y_tr_pred, y_te_pred, y_fu_pred
|
|
|
|