Bottom Page

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
 Machine Learning Polynomial Regression
#1
Hello All,

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?
Quote

Top Page

Possibly Related Threads...
Thread Author Replies Views Last Post
  Can I evaluate a Chebyshev polynomial using a function player1681 1 164 Nov-22-2019, 06:33 AM
Last Post: scidam
  Regression Event navigates 1 185 Oct-01-2019, 07:27 PM
Last Post: Larz60+
  Ask for machine learning Python example with 2 data files user5566b 2 227 Sep-05-2019, 12:15 PM
Last Post: user5566b
  Confidence intervals over time with polynomial regression jjameson 0 412 May-16-2019, 02:22 PM
Last Post: jjameson
  sklearn regression to excel punksnotdead 1 470 Apr-14-2019, 12:32 PM
Last Post: punksnotdead
  Using machine learning kingrayd 1 454 Apr-09-2019, 09:29 AM
Last Post: micseydel
  Python - Database for Machine Learning application braveYug 2 690 Mar-04-2019, 10:30 AM
Last Post: Shruti7109162
  About Machine Learning rajeev1729 3 1,644 Mar-01-2019, 07:41 AM
Last Post: rajeev1729
  PyCM 1.8 released: Machine learning library for confusion matrix statistical analysis sepandhaghighi 0 534 Jan-05-2019, 12:36 PM
Last Post: sepandhaghighi
  Logistic regression with Tensorflow kiton 1 728 Nov-28-2018, 07:34 PM
Last Post: kiton

Forum Jump:


Users browsing this thread: 1 Guest(s)