我想标准化'x_train‘。
图片中的第一个“x_train”是原始数据集,前一个数据集下面的下一个“x_train”是标准化的。
我只想标准化前六列,所以我在标准化期间编写了x_train:,0:6。
然而,标准化的结果显然是不合理的。此外,当我使用'x_train‘的均值和标准差对x_test进行标准化时,结果是正确的。这很奇怪。我不知道我的代码出了什么问题。
下面是我的标准化代码。
发布于 2021-10-29 13:52:44
试一下-
scaler = preprocessing.StandardScaler().fit(x_train.iloc[:, 0:6])
#returning the scaled values to a new variable
X_train_first_six = scaler.transform(x_train.iloc[:, 0:6])
X_test_first_six = scaler.transform(x_test.iloc[:, 0:6])
https://stackoverflow.com/questions/69769999
复制相似问题