Find the best-fitting line through data
Linear regression finds the line that best fits a set of data points by minimizing the sum of squared residuals. This simulation lets you generate data with various noise levels and watch how the algorithm finds the optimal line.
Linear regression finds the line y = mx + b that minimizes the sum of squared errors between predicted and actual values. The optimal parameters are found using the least squares method:
Where x̄ and ȳ are the means of x and y values. The R² score measures how well the line fits the data, with 1.0 being a perfect fit.
Key concepts: