

My problem is not that I can't use new_model.predict(x) since it'll result in "ValueError: shapes (1,1) and (8,) not aligned: 1 (dim 1) != 8 (dim 0)". Y_prediction = new_model.predict(x_new) #this actually predicts x.? Poly = PolynomialFeatures(degree=8, include_bias=False) #the bias is avoiding the need to intercept This is exactly what I want, I just wanted to line to fit better so instead I tried polynoimal regression with sklearn by doing following: from sklearn.preprocessing import PolynomialFeatures

This resulted in a predicted line that had a pretty poor fit:Ī very nice feature from sklearn however is that you can try to predict an value based on a temperature, so if I were to write model.predict(15) Model.fit(x_train, y_train) #fit tries to fit the x variable and y variable.
#Matlab use fitplot to predict y values code
This is the code for that: from sklearn.linear_model import LinearRegression As seen on the picture below, there is some sort of correlation between the temperature and the amount of sales:įirst and foremost, I tried to do linear regression to see how well it'd fit. I took my datasets for the temperature and set it equal to the x variable, and the amount of sales to as a y variable. I'm currently using TensorFlow and SkLearn to to try to make a model that can predict the amount of sales for a certain product, X, based on the outdoor temperature in celcius.
