Linear Regression Code in Python for absolute beginners.
Brief about Linear Regression Algorithm In Linear Regression, there is one independent variable(x) and one dependent variable(y). Linear Regression assumes that there is a linear relationship between the independent variable x and dependent variable y. The linear Regression algorithm tries to fit the equation of a straight line on to our data points. y=mx+c where, y= Dependent variable x= Independent variable m= Slope of the line c= y-intercept Training our Machine The machine will be trained on the training data set and the machine will compute the equation of line based on those data points ie. finding values of slope(m) and y-intercept(c). Predicting Dependent variable Now, as our machine is trained on the training data set, we can predict the values of the dependent variable and compare it against the actual values on our testing data set. To check whether the machine is predicting accurate or not, we calculate the accuracy of the prediction. Code for Linear ...