Nov-13-2019, 11:41 AM
Hello All,
I am facing some problem while implementing polynomial regression for my machine learning module. Part of my code is as below:
My question is that my predicted values are completely in line with output(label) but still rmse and r2 are respectively 10.2 & 0.99. Why this rmse and r2 are showing in opposite direction that model is not tuned well? Am I missing something important?
I am facing some problem while implementing polynomial regression for my machine learning module. Part of my code is as below:
poly = PolynomialFeatures(degree = 4) X_poly = poly.fit_transform(X) lin = LinearRegression() lin.fit(X_poly, Y) y_poly_pred = lin.predict(X_poly) plt.scatter(X['Totalizer'], Y, color='red') plt.plot(X['Totalizer'], y_poly_pred, color='b') plt.title('Polynomial Regression') plt.xlabel('Totalizer') plt.ylabel('Temperature') plt.show() rmse = np.sqrt(mean_squared_error(Y,y_poly_pred)) r2 = r2_score(Y,y_poly_pred) print(rmse) print(r2)Please also see attached picture :
My question is that my predicted values are completely in line with output(label) but still rmse and r2 are respectively 10.2 & 0.99. Why this rmse and r2 are showing in opposite direction that model is not tuned well? Am I missing something important?