Linear Regression with Scikit-Learn
Using the command "reg.predict(1740)," I'm attempting to forecast the GPA score based on the provided SAT value, much like the tutor did. However, I am receiving a message that reads "Expected 2D, got scalar array instead."
Would you kindly assist me with this?
PS: All libraries have been correctly imported.
Attached the screenshot for your reference.
3 answers ( 0 marked as helpful)
You should reshape 'y' as well. Then reg.predict([[1740]]).
Thank you so much Zoltan!!:)
I use reg.predict(np.array([1740]).reshape(-1,1)) , and it's work too.