Created
September 4, 2018 15:38
-
-
Save Manikant92/30619b2889174a6f30bcc9730df34e60 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
#slope -logic | |
m = lr.coef_[0] | |
#constant | |
c = lr.intercept_ | |
#multiply m with all input data to form a regression line- linear equation to observe whether it is the best fit or not. | |
regression_line = [(m*i)+c for i in x] | |
#scatter plot whole x and y data. | |
plt.scatter(x,y,color='blue') | |
plt.plot(x,regression_line, color='red') | |
plt.ylabel('Dependent/Output Variable') | |
plt.xlabel('Independent/Input Variable') | |
plt.title('Regression Line fit') | |
plt.show() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment