Created
March 20, 2019 09:21
-
-
Save panicpotatoe/4f11c00ed2d54cf47706a915ca67aa82 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 Linear Regression to the dataset | |
from sklearn.linear_model import LinearRegression | |
lin_reg = LinearRegression() | |
lin_reg.fit(X, y) | |
# Visualizing the Linear Regression results | |
def viz_linear(): | |
plt.scatter(X, y, color='red') | |
plt.plot(X, lin_reg.predict(X), color='blue') | |
plt.title('Truth or Bluff (Linear Regression)') | |
plt.xlabel('Position level') | |
plt.ylabel('Salary') | |
plt.show() | |
return | |
viz_linear() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment