feat: 新增 Physical_Only 预处理分支 — 纯物理特征+标准化,与 MNF A/B 对比
spectral_Preprocessing.py: - 新增 Physical_Only 分支: Pipeline[PhysicalFeatureExtractor + StandardScaler] - 纯物理特征流: 20个指数 → StandardScaler → SVR - DualStream_MNF 逻辑完全不变 modeling_batch.py: - preprocessing_methods 新增 Physical_Only - 训练时 Physical_Only 也只取纯光谱50列 - 波长列表传递覆盖 Physical_Only GUI: - 两个面板同步新增「纯物理特征 (指数+标准化)」选项
This commit is contained in:
@ -241,7 +241,7 @@ class WaterQualityModelingBatch:
|
||||
# 预处理方法列表
|
||||
self.preprocessing_methods = [
|
||||
"None", "MMS", "SS", "CT", "SNV", "MA", "SG", "MSC", "D1", "D2", "DT", "WVAE",
|
||||
"DualStream_MNF"
|
||||
"DualStream_MNF", "Physical_Only"
|
||||
]
|
||||
|
||||
# 样本划分方法列表
|
||||
@ -609,10 +609,10 @@ class WaterQualityModelingBatch:
|
||||
# ═══════════════════════════════════════════════════════════
|
||||
# ★ DualStream_MNF:只取纯光谱列,WQI 由 Pipeline 内 PhysicalExtractor 动态计算
|
||||
# ═══════════════════════════════════════════════════════════
|
||||
if preprocess_method == "DualStream_MNF":
|
||||
if preprocess_method in ("DualStream_MNF", "Physical_Only"):
|
||||
_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]} 列 "
|
||||
print(f"[{preprocess_method}] 精简为纯光谱: {X_raw.shape[1]} 列 "
|
||||
f"({X_raw.columns[0]} ~ {X_raw.columns[-1]} nm)")
|
||||
|
||||
# 使用指定方法分割训练集和测试集
|
||||
@ -637,9 +637,9 @@ class WaterQualityModelingBatch:
|
||||
base_model.set_params(verbose=-1)
|
||||
|
||||
# ============ 关键:把预处理器塞进 Pipeline ============
|
||||
# DualStream_MNF 需要传入波长列表,供 PhysicalFeatureExtractor 定位波段
|
||||
# DualStream_MNF / Physical_Only 需要波长列表,供 PhysicalFeatureExtractor 定位波段
|
||||
_wl_list = None
|
||||
if preprocess_method == "DualStream_MNF":
|
||||
if preprocess_method in ("DualStream_MNF", "Physical_Only"):
|
||||
_wl_list = self._extract_train_wavelengths(X_raw.columns)
|
||||
preproc = get_preprocessing_transformer(preprocess_method, wavelengths=_wl_list)
|
||||
pipeline = Pipeline([
|
||||
|
||||
Reference in New Issue
Block a user