R 的可训练 sklearn StandardScaler
Trainable sklearn StandardScaler for R
R
中是否有类似的东西允许拟合 StandardScaler
(resulting into mean=0 and standard deviation=1 features) to the training data and use that scaler model to transform the test data? scale
不提供根据训练数据的均值和标准差转换测试数据的方法。
Python
的代码段:
from sklearn.preprocessing import StandardScaler
scaler = StandardScaler()
scaler.fit(X_train)
X_train_scaled = scaler.transform(X_train)
X_test_scaled = scaler.transform(X_test)
因为我很确定这是这样做的正确方法 (avoiding the leak of information from the test to the training set) 我想有一个我找不到的简单解决方案。
R
中是否有类似的东西允许拟合 StandardScaler
(resulting into mean=0 and standard deviation=1 features) to the training data and use that scaler model to transform the test data? scale
不提供根据训练数据的均值和标准差转换测试数据的方法。
Python
的代码段:
from sklearn.preprocessing import StandardScaler
scaler = StandardScaler()
scaler.fit(X_train)
X_train_scaled = scaler.transform(X_train)
X_test_scaled = scaler.transform(X_test)
因为我很确定这是这样做的正确方法 (avoiding the leak of information from the test to the training set) 我想有一个我找不到的简单解决方案。