I've created 50 random x and y points (with slope of y = 2x-1).

First, I used Linear Regression from sklearn to fit the model onto my dataset where I got a slope of 2.0066... and intercept of -0.535...

My Question: is fitting the model to our dataset considered training? For each given x value, since it has a y-value (supervised), does our machine go through each x,y match and create line of best fit based upon that? Thus, is our model trained?

Second, I used stats.linregress(x,y) from scipy to get slope and intercept (which seem really close if not the same to the slope and intercept I've got from using sklearn Linear Regression).

My Question: If both methods give the same result, why not just use scipy to get formula for the best fit line to make predictions? What is the benefit of using machine learning?


1 Answer 1

  1. Yes fitting the data and finding the best fitting line is called training the model.
  2. If you look at the source code of scikit-learn linear regression you can find the its using scipy linalg.lstsq module for finding the coefficients and intercept (most cases). See the source code for more details . Machine learning is fancy word for Application of mathematics (on data mostly) using computers (machines)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.