简体   繁体   中英

Use the trained k-NN classifier model to classify new, previously unseen objects

fruit_prediction = knn.predict([[20, 4.3, 5.5]])

lookup_fruit_name[fruit_prediction[0]]

I am not able to run above two lines. I am getting this kind of error

ValueError: query data dimension must match training data dimension

Checking the inputs of knn classifier would be good option to analysed what is wrong in the dimensions of knn.predict. As you have nested list in your predict as inputs that can be just a list.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM