Module 1: Linear Regression 1

Overview

In this module, you will learn the fundamentals of linear regression. You'll start with simple baseline models, implement linear regression using scikit-learn, and understand how to interpret model coefficients.

Learning Objectives

Objective 1: Determine baseline for Regression

Learn how to establish simple baseline models as a starting point for your regression analysis.

  • Understanding the importance of baseline models
  • Implementing mean and median baselines
  • Calculating baseline metrics like Mean Absolute Error (MAE) and Mean Squared Error (MSE)
  • Using baselines to evaluate more complex models

Objective 2: Fit a Simple Linear Regression model using scikit learn

Learn how to implement linear regression models using the scikit-learn library.

  • Understanding the scikit-learn API for regression models
  • Fitting and predicting with LinearRegression
  • Evaluating model performance with metrics like R-squared
  • Visualizing linear regression results

Objective 3: Interpret coefficients

Understand what model coefficients tell you about the relationship between features and the target variable.

  • Interpreting the intercept and slope
  • Understanding how coefficients relate to feature importance
  • Analyzing coefficient signs and magnitudes
  • Communicating insights from model coefficients

Guided Project

Linear Regression I

The notebook for this guided project is JDS_SHR_211_guided_project_notes.ipynb in the GitHub repository.

Module Assignment

Linear Regression 1 Assignment

In this module assignment, found in the file LS_DS_211_assignment.ipynb in the GitHub repository, you'll apply your knowledge of linear regression fundamentals to a real-world dataset:

Tasks:

  1. Import csv file using wrangle function
  2. Conduct exploratory data analysis (EDA) and plot the relationship between one feature and the target 'price'
  3. Split data into feature matrix X and target vector y
  4. Establish the baseline mean absolute error for your dataset
  5. Build and train a Linearregression model
  6. Check the mean absolute error of our model on the training data
  7. Extract and print the intercept and coefficient from your LinearRegression model