题目
对数据预处理时,一般需要对数据进行标准化处理,请给出python命令。按下面的两个步骤,分别填写两个空。导入数据预处理的标准化函数为:对数据进行标准化处理的命令是:第1空from sklearn.preprocessing import StandardScaler第2空scaler = StandardScaler().fit(X_train)X_train_std = scaler.transform(X_train)X_test_std = scaler.transform(X_test)
对数据预处理时,一般需要对数据进行标准化处理,请给出python命令。按下面的两个步骤,分别填写两个空。 导入数据预处理的标准化函数为: 对数据进行标准化处理的命令是: 第1空 from sklearn.preprocessing import StandardScaler 第2空 scaler = StandardScaler().fit(X_train) X_train_std = scaler.transform(X_train) X_test_std = scaler.transform(X_test)
题目解答
答案
from sklearn.preprocessing import StandardScaler; scaler = StandardScaler().fit(X_train); X_train_std = scaler.transform(X_train); X_test_std = scaler.transform(X_test)