Machine LearningLesson 76Free preview
Linear Regression
This lesson is part of Python · All levels
Summary
Linear regression finds the best straight line that describes the relationship between the free variable X and the bound variable y. This model minimizes the difference between the predicted value and the actual value, and then produces the slope coefficient and the cut-off point. After being trained, the model can estimate the value of y for the value of x that has never been seen before. In scikit-learn, the entire process is enough with fit() on the training data and then predict() on the test data.
Key points
- Linear regression modeling linear relationships y = m*x + b
- Fit() trained the model and predict() produced predictions
- Coef_ contains the feature weight and intercept_ contains the cut-off point
- Validation must use data that is not used during training.
Full lesson
Code examples and quizzes
Full lessons, code examples, and quizzes are available to subscribers. 5 questions.