Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Fitting Polynomial Regression to the dataset
- from sklearn.preprocessing import PolynomialFeatures
- poly_reg = PolynomialFeatures(degree=4)
- X_poly = poly_reg.fit_transform(X)
- pol_reg = LinearRegression()
- pol_reg.fit(X_poly, y)
- # Visualizing the Polymonial Regression results
- def viz_polymonial():
- plt.scatter(X, y, color='red')
- plt.plot(X, pol_reg.predict(poly_reg.fit_transform(X)), color='blue')
- plt.title('Truth or Bluff (Linear Regression)')
- plt.xlabel('Position level')
- plt.ylabel('Salary')
- plt.show()
- return
- viz_polymonial()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement