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
  Errors with Machine Learning trading bot-- not sure why MattKahn13 0 99 Aug-07-2020, 08:19 PM
Last Post: MattKahn13
  How useful is PCA for machine learning? Marvin93 0 146 Aug-07-2020, 02:07 PM
Last Post: Marvin93
  How to extract data from paragraph using Machine Learning with python? bccsthilina 2 650 Jul-27-2020, 07:02 AM
Last Post: hussainmujtaba
  Machine Learning: Process Enanda 13 884 Mar-18-2020, 02:02 AM
Last Post: jefsummers
  Can I evaluate a Chebyshev polynomial using a function player1681 1 442 Nov-22-2019, 06:33 AM
Last Post: scidam
  Ask for machine learning Python example with 2 data files user5566b 2 485 Sep-05-2019, 12:15 PM
Last Post: user5566b
  Confidence intervals over time with polynomial regression jjameson 0 820 May-16-2019, 02:22 PM
Last Post: jjameson
  Using machine learning kingrayd 1 729 Apr-09-2019, 09:29 AM
Last Post: micseydel
  Python - Database for Machine Learning application braveYug 2 1,058 Mar-04-2019, 10:30 AM
Last Post: Shruti7109162
  About Machine Learning rajeev1729 3 1,936 Mar-01-2019, 07:41 AM
Last Post: rajeev1729

Forum Jump:


Users browsing this thread: 1 Guest(s)