Home » ML
      Bookmark ·  Report ·  More actions.. Lock comments ·  Pin thread

Your first Machine Learning project in Python with Step-By-Step instructions (Part 4 of 6)

404

nVector

posted on

Enjoy great content like this and a lot more !

Signup for a free account to write a post / comment / upvote posts. Its simple and takes less than 5 seconds




Hi!\nWhy when i test my model whith code print(model.predict(6.3)) i get error:\n\nValueError: Expected 2D array, got scalar array instead:\narray=6.3.\nReshape 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.

Pls. add [] to the value being considered for prediction of salary.

Ex.

print(model.predict([[6.3]]))

Thanks.