df=
df_train_x.head()
Out[43]:
longevity_endfy18 ... memc_err_law
1029 9 ... 0
79 9 ... 0
1464 9 ... 0
2620 3 ... 0
808 3 ... 0
type(df_train_x)
Out[44]: pandas.core.frame.DataFrame
normalizer = preprocessing.StandardScaler.fit(df_train_x)
trainx_norm = normalizer.transform(df_train_x)
testx_norm = normalizer.transform(df_test_x)
我正在尝试应用标准缩放器并收到此错误:
normalizer = preprocessing.StandardScaler.fit(df_train_x)
TypeError: fit() missing 1 required positional argument: 'X'
在我使用 Keras 的过程中,我从未想过这会是最难的部分。我看了很多例子,但看不出哪里出了问题。
最佳答案
StandardScaler
后面缺少括号。
归一化器 = preprocessing.StandardScaler().fit(df_train_x)
关于python - 在为 Keras NN 做准备时应用 StandardScaler() 时遇到问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56586286/