fix: ML Pipeline 缺失值填充 + 推理端外部模型 dict 兼容

- modeling_batch: Pipeline 首步新增 SimpleImputer(median) 填充 NaN
- inference_batch: 外部模型支持完整 dict(含 metadata/train_wavelengths),
  兼容旧版裸 Pipeline 对象
- step9_ml_predict_panel: 模型加载保留完整 dict 而非仅 model 对象,
  确保推理端可从 train_wavelengths 做光谱重采样
This commit is contained in:
duxin
2026-07-28 14:59:11 +08:00
parent 02592cc181
commit 89b67fbd34
3 changed files with 15 additions and 6 deletions

View File

@ -20,6 +20,7 @@ from sklearn.ensemble import GradientBoostingRegressor, AdaBoostRegressor, Extra
from sklearn.tree import DecisionTreeRegressor
from sklearn.neural_network import MLPRegressor
from sklearn.pipeline import Pipeline
from sklearn.impute import SimpleImputer
from joblib import parallel_backend
# 第三方模型导入
# try:
@ -611,6 +612,7 @@ class WaterQualityModelingBatch:
# ============ 关键:把预处理器塞进 Pipeline ============
preproc = get_preprocessing_transformer(preprocess_method)
pipeline = Pipeline([
('imputer', SimpleImputer(strategy='median')),
('preproc', preproc),
('model', base_model),
])