Skip to content
Advertisement

ValueError:Reshape 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

**the code predict the house price with polynomial regression model and fastapi **`

make class have an one parameter and have a 4 value

JavaScript

#The train_plynomial_model is a function that takes the Features and returns polynomial model

JavaScript

The predict is a function that predict the house price

JavaScript

I tried to put this sentencenewfeature=newfeature.reshape(-1, 1)

Advertisement

Answer

You should change features array not newfeatures.
Try reshaping like this and using a numpy array :

JavaScript
Advertisement