refactor: DualStream 纯光谱输入 — 消除 WQI 冗余双向断层

训练端:
- DualStream_MNF 时只取纯光谱列(50列)传给 Pipeline
- PhysicalFeatureExtractor + MNFTransformer 都只收纯光谱
- 不再从 CSV 预读 WQI 列混入输入

推理端:
- 只做 308→50 光谱重采样,不补 WQI
- pipeline.predict() 自动完成 Physical 指数计算 + MNF 降维
- 删除 30+ 行 WQI 补齐代码

训练/推理完全对称: 纯光谱入 → FeatureUnion → SVR 出
This commit is contained in:
duxin
2026-07-29 13:15:10 +08:00
parent 6f1f222baa
commit f4a927386b
2 changed files with 19 additions and 26 deletions

View File

@ -606,7 +606,16 @@ class WaterQualityModelingBatch:
print(f"开始训练模型: {model_name} (预处理: {preprocess_method})")
# 使用指定方法分割训练集和测试集(用原始 X_rawPipeline 内置 transform 处理)
# ═══════════════════════════════════════════════════════════
# ★ DualStream_MNF只取纯光谱列WQI 由 Pipeline 内 PhysicalExtractor 动态计算
# ═══════════════════════════════════════════════════════════
if preprocess_method == "DualStream_MNF":
_spec_cols = [c for c in X_raw.columns if self._is_wavelength_column(c)]
X_raw = X_raw[_spec_cols]
print(f"[DualStream_MNF] 精简为纯光谱: {X_raw.shape[1]}"
f"({X_raw.columns[0]} ~ {X_raw.columns[-1]} nm)")
# 使用指定方法分割训练集和测试集
X_train, X_test, y_train, y_test = self.split_data(
X_raw, y, method=split_method, test_size=test_size, random_state=random_state
)