0

need help with python ml

so basically i was learning ml but idk why i am getting this error could anyone help me here is my code and error: https://code.sololearn.com/cI1W720JKmD2/#py

29th Sep 2020, 5:16 PM
Karan
Karan - avatar
2 Respostas
+ 1
You almost got it! The error says that the `predict` function is expecting a 2D array. So let's see: 3300 - is a scalar value; [3300] - is a 1D array with 1 element; [[3300]] - is a 2D array with 1 row and 1 column (that's what you need here). Extra notes: -the first dimension is for how many output values to predict -the second dimension is for how many input values are required to predict one value. If you do smth like this, you will get 2 predictions (one for each input area): Xnew = [[3300], [2000]] print(req.predict(Xnew))
30th Sep 2020, 12:12 AM
Mihai Iacov
Mihai Iacov - avatar
0
Mihai Iacov it worked thanks
30th Sep 2020, 5:32 AM
Karan
Karan - avatar