Linear Regression Exercise
Programming for Data Science is a subject we’ve designed to explore the various programming components of data science.
Keywords
data science, data analysis, programming, dataidea
Week 2: Linear Regression (3 Questions)
1. Linear Regression 1 Dimension
- Exercise: Implement a simple linear regression model to fit a line to 1D data points generated as
(x, y) = (x, 3x + 7 + noise)
. Visualize the data and the fitted line.
2. Linear Regression with 1 Parameter
- Exercise: Create a linear regression model with a single parameter. Train the model on a dataset with a known linear relationship, and evaluate the model’s performance by plotting the predicted vs. actual values.
3. Training Slope and Bias
- Exercise: Implement a linear regression model from scratch to learn the slope and bias for the dataset
(x, y) = (x, 4x + 10 + noise)
. Compare the learned parameters with the true values.