【发布时间】:2019-11-23 12:29:20
【问题描述】:
我在一个 1 行 8 列的矩阵中设置来自用户的输入,并且特征缩放这些值,以便我可以使用矩阵中的值来预测我得到的错误是
ValueError: 找到昏暗的数组 3. StandardScaler 预期
我试过了
matrix = q.fit_transform(matrix[:, np.newaxis])
但它返回 -Found array with dim 3. StandardScaler expected
R = int(input("Enter the number of rows:"))
C = int(input("Enter the number of columns:"))
print("Enter the entries in a single line (separated by space): ")
entries = list(map(float, input().split()))
matrix = np.array(entries).reshape(R, C)
print(matrix)
matrix = q.fit_transform(matrix)
我期待StandardScale 结果,但它返回
[0.000000000000000000e+00 0.000000000000000000e+00
0.000000000000000000e+00 0.000000000000000000e+00
0.000000000000000000e+00 0.000000000000000000e+00
0.000000000000000000e+00 0.000000000000000000e+00]
【问题讨论】:
标签: python-3.x numpy scikit-learn