ThinkChat2.0新版上线,更智能更精彩,支持会话、画图、阅读、搜索等,送10W Token,即刻开启你的AI之旅 广告
## 标准化 > 归一化是将单个样本缩放为具有单位范数的过程。 ## L2 norm [http://mathworld.wolfram.com/L2-Norm.html](http://mathworld.wolfram.com/L2-Norm.html) ### 例: ``` use Phpml\Preprocessing\Normalizer; $samples = [ [1, -1, 2], [2, 0, 0], [0, 1, -1], ]; $normalizer = new Normalizer(); $normalizer->preprocess($samples); /* $samples = [ [0.4, -0.4, 0.81], [1.0, 0.0, 0.0], [0.0, 0.7, -0.7], ]; */ ``` ***** ## L1 norm [http://mathworld.wolfram.com/L1-Norm.html](http://mathworld.wolfram.com/L1-Norm.html) ### 例: ``` use Phpml\Preprocessing\Normalizer; $samples = [ [1, -1, 2], [2, 0, 0], [0, 1, -1], ]; $normalizer = new Normalizer(Normalizer::NORM_L1); $normalizer->preprocess($samples); /* $samples = [ [0.25, -0.25, 0.5], [1.0, 0.0, 0.0], [0.0, 0.5, -0.5], ]; */ ```