Skip to content

Build-Your-Dream-Python-Project/linear-regression-demo

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Linear Regression Demo

This demo has been created for the +BYDPP event + Intro To Machine Learning + #ITML23 +. It is a basic implementation of linear regression in Python using the pandas, scikit-learn, jupyterlab, and matplotlib libraries. It includes a Jupyter notebook that walks through the steps of loading and exploring a sample dataset, preparing the data for linear regression, and using scikit-learn to fit a linear regression model and make predictions. The notebook also includes visualizations of the data and the linear regression model.

Installation Guide

To run this demo in JupyterLab, you'll need to have Python 3 and the following libraries installed on your system.

  • pandas
  • scikit-learn
  • jupyterlab
  • matplotlib

To avoid conflicts with other Python projects on your system, it can help to create a virtual environment for this demo. Here's how to set up a virtual environment, activate it, and install the necessary libraries.

  1. Open a terminal or command prompt and navigate to the directory where you've cloned the demo repository.
  2. Create a virtual environment by running the following command.
    python3 -m venv env
  3. Activate the virtual environment by running the following command.
    source env/bin/activate
    Note: On Windows, use env\Scripts\activate instead.
  4. Install the necessary libraries by running the following command
    pip install -r requirements.txt
    or
    pip install pandas scikit-learn jupyterlab matplotlib

Alternatively, you can install the 4 packages without a virtual environment by following just steps 1 and 4 above.

Once you've installed the necessary libraries, you can start JupyterLab and load the demo notebook.

  1. Start JupyterLab by running the following command: jupyter lab
  2. In your web browser, navigate to http://localhost:8888/lab to access the JupyterLab interface.
  3. In the JupyterLab interface, navigate to the directory where you've cloned the demo repository.
  4. Click on the linear_regression_demo.ipynb file to load the demo notebook.

That's it! You should now be able to run the demo notebook and explore the implementation of linear regression while we code it live together in Python!