Last active
March 19, 2021 12:49
-
-
Save panicpotatoe/37b33c053213f852a9f2cbebe703904b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi, How can I get the fit coefficients to be able to write down the fit equation?