我从之前的模型中保存了一个sklearn StandardScaler,并尝试将其应用于新数据
scaler = myOldStandardScaler
print("ORIG:", X)
print("CLASS:", X.__class__)
X = scaler.fit_transform(X)
print("SCALED:", X)
我有三个观察,每个观察2000个特征.如果我单独运行每个观察,我得到全零的输出.
ORIG: [[ 3.19029839e-04 0.00000000e+00 1.90985485e-06 ..., 0.00000000e+00
0.00000000e+00 0.00000000e+00]]
CLASS:
SCALED: [[ 0. 0. 0. ..., 0. 0. 0.]]
但是,如果我将所有三个观察结果附加到一个数组中,我得到了我想要的结果
ORIG: [[ 0.00000000e+00 8.69737728e-08 7.53361877e-06 ..., 0.00000000e+00
0.00000000e+00 0.00000000e+00]
[ 9.49627142e-04 0.00000000e+00 0.00000000e+00 ..., 0.00000000e+00
0.00000000e+00 0.00000000e+00]
[ 3.19029839e-04 0.00000000e+00 1.90985485e-06 ..., 0.00000000e+00
0.00000000e+00 0.00000000e+00]]
CLA