单位方差缩放
对每个变量减去均值并除以其标准差,改变变量间的相对权重,而非校正所有测量偏差。
定义
单位方差缩放(autoscaling)先减去各变量的均值,再除以该变量的标准差:z = (x − 均值) / SD。这里 SD 为采用 n − 1 作分母的样本标准差。对每个完整、非常数的特征列使用该公式后,其均值为零、样本方差为一。这会改变变量间的相对权重。[1]
简单例子
构造的信号值:[10, 12, 14] 的均值为 12,样本 SD 为 2。缩放后为 [−1, 0, 1]。第二列 [100, 120, 140] 产生完全相同的缩放值。这种表示有意移除了原来的十倍响应差异。
常见混淆
按列进行单位方差缩放不等于按样本总量归一化、浓度校准或批次校正。它赋予相同方差,而非相同测量可靠性。微弱、噪声大的特征可能被放大;常数列的 SD 为零,不能用该公式缩放。应明确处理排除和缺失,而不是悄悄产生无效数值。R 的 PCA 文档说明了常数变量的限制。[2]
用于留出预测时,应重复使用训练数据估计的均值和标准差。对每个测试集重新估计会改变变换,并可能泄漏评估信息。
检查理解
缩放值为 −1 是否表示负浓度?
不是。按所声明的缩放约定,它表示比对应的均值低一个训练集或分析集标准差。
在指南中使用
References & further reading
- van den Berg et al. (2006). Centering, scaling, and transformations: improving the biological information content of metabolomics data. BMC Genomics 7, 142.
Primary comparison of preprocessing choices on a metabolomics dataset. DOI: 10.1186/1471-2164-7-142. Supports the effect of variable weighting and noise amplification; does not establish one universally preferred scaling method.
- R stats package. prcomp: Principal Components Analysis.
Official documentation for centering, optional unit-variance scaling, singular-value decomposition, score and loading definitions, sample-variance divisor, and arbitrary component signs. The constructed example is calculated independently.