knn 报错:
print('预测电影类型为:',knn.predict([18,90]))
ValueError: Expected 2D array, got 1D array instead:
array=[18 90].
Reshape your data either using array.reshape(-1, 1) if your data has a single feature or array.reshape(1, -1) if it contains a single sample.
改为:
x = np.array([18,90]).reshape(1, -1)
print('预测电影类型为:',knn.predict(x))