Last answered:

12 Nov 2022

Posted on:

07 Nov 2022

3

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.image

3 answers ( 0 marked as helpful)
Posted on:

07 Nov 2022

7

You should reshape 'y' as well. Then reg.predict([[1740]]).

Posted on:

07 Nov 2022

1

Thank you so much Zoltan!!:)

Posted on:

12 Nov 2022

10

I use reg.predict(np.array([1740]).reshape(-1,1)) , and it's work too.

image.png

Submit an answer