说明¶
ICA — 独立成分分析
从混合观测信号中分离出统计独立的源信号。基于 FastICA 算法。
算法原理¶
FastICA 固定点迭代¶
预处理(必须):
- 中心化:\(\mathbf{x}_c = \mathbf{x} - E[\mathbf{x}]\),去均值
- 白化:对协方差矩阵做特征分解 → \(\tilde{\mathbf{x}} = E D^{-½} E^T \mathbf{x}_c\)
- 使各维度不相关且方差为 1
- 将分离矩阵约束从一般矩阵降为正交矩阵
核心迭代:对每个源 \(i = 1, \dots, m\):
\[ \mathbf{w}i^+ = E[\tilde{\mathbf{x}} \cdot g(\mathbf{w}i^T \tilde{\mathbf{x}})] - E[g'(\mathbf{w}i^T \tilde{\mathbf{x}})] \cdot \mathbf{w}i \]
归一化后 Gram-Schmidt 正交化。收敛判据:\(1 - |\mathbf{w}i^{(k)T} \cdot \mathbf{w}i^{(k-1)}| < \text{tolerance}\)
非线性函数 \(g(u)\) 选择:
| 函数 | 公式 | 适用源类型 |
|---|---|---|
tanh(默认) | \(\tanh(\alpha u)\) | 超高斯(语音、地震) |
cube | \(u^3\) | 亚高斯 |
gauss | \(u \cdot e{-u2/2}\) | 对称分布 |
skew | \(u^2\) | 偏斜分布 |
ICA vs PCA
| ICA | PCA | |
|---|---|---|
| 目标 | 统计独立 | 不相关 |
| 统计量 | 高阶(除二阶) | 仅二阶 |
| 输出顺序 | 不确定 | 按方差排序 |
ICA 的固有不确定性
无法确定分离信号的幅度和顺序。这是模型本身的特性,不是 bug。
前提条件
源数 ≤ 传感器数;各源须非高斯(至多一个高斯源);建议 \(> 100\) 采样点。
API 参考(C++ 类封装)¶
tiny::ICA ica;
ica.set_max_iterations(1000);
ica.set_tolerance(1e-6f);
ica.set_nonlinearity(tiny::ICANonlinearity::TANH);
// 一次性分解
ICADecomposition result = ica.decompose(mixed_signals, num_sources);
// result.sources — 分离的源信号
// result.mixing_matrix — 混合矩阵 A
// result.unmixing_matrix — 分离矩阵 W
// 重建
Mat reconstructed = ICADecomposition::reconstruct(sources, mixing_matrix);
// 对新数据应用已训练的模型
Mat separated = ICADecomposition::apply(decomposition, new_mixed_signals);