/DS_HW_3

Primary LanguageJupyter Notebook

DS_HW_3

Linear Regression Homework

This repository contains the code and data for a homework assignment on linear regression. The goal of the assignment is to implement linear regression from scratch, compare the results with the analytical solution, and then use Scikit-Learn to perform linear regression on the same dataset.

Files

  • hw3.ipynb: Jupyter Notebook file containing the code for the assignment.
  • Housing.csv: CSV file containing the dataset of housing prices and features.

Assignment Overview

The assignment consists of the following tasks:

  1. Implement the hypothesis function for linear regression in vectorized form.
  2. Implement the mean squared error function for linear regression.
  3. Implement one step of gradient descent for linear regression.
  4. Find the best parameters for linear regression using gradient descent.
  5. Find the best parameters for linear regression using the analytical solution.
  6. Compare the results obtained from gradient descent and the analytical solution.

Getting Started

To get started with this assignment, you'll need to have Python and Jupyter Notebook installed on your system. You can install the required libraries by running the following command:

pip install poetry
poetry add numpy pandas matplotlib scikit-learn

Usage

You can use the Jupyter Notebook hw3.ipynb to complete the assignment step by step. Each task is clearly defined in the notebook, and you can run the code cells to see the results.

Results

After completing the assignment, you will have the following results:

Parameters obtained using gradient descent. Parameters obtained using the analytical solution. Visualizations comparing the two methods.