fix: PhysicalFeatureExtractor 修复 ndarray 输入时波长丢失问题

- SimpleImputer 把 DataFrame → ndarray,PhysicalFeatureExtractor.fit()
  收不到列名导致 ValueError: 必须在 __init__ 中提供 wavelengths
- get_preprocessing_transformer 新增 wavelengths 可选参数
- train_single_model 在 DualStream_MNF 时提取 X_raw 波长列表传入工厂
- PhysicalFeatureExtractor 已有 ndarray + wavelengths 参数的处理分支
This commit is contained in:
duxin
2026-07-29 10:11:01 +08:00
parent ef9187fc7b
commit 09f8d89b56
2 changed files with 9 additions and 3 deletions

View File

@ -611,7 +611,11 @@ class WaterQualityModelingBatch:
base_model.set_params(verbose=-1)
# ============ 关键:把预处理器塞进 Pipeline ============
preproc = get_preprocessing_transformer(preprocess_method)
# DualStream_MNF 需要传入波长列表,供 PhysicalFeatureExtractor 定位波段
_wl_list = None
if preprocess_method == "DualStream_MNF":
_wl_list = self._extract_train_wavelengths(X_raw.columns)
preproc = get_preprocessing_transformer(preprocess_method, wavelengths=_wl_list)
pipeline = Pipeline([
('imputer', SimpleImputer(strategy='median')),
('preproc', preproc),