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.
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.
- Open a terminal or command prompt and navigate to the directory where you've cloned the demo repository.
- Create a virtual environment by running the following command.
python3 -m venv env
- Activate the virtual environment by running the following command.
source env/bin/activate
Note: On Windows, useenv\Scripts\activate
instead. - 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.
- Start JupyterLab by running the following command:
jupyter lab
- In your web browser, navigate to http://localhost:8888/lab to access the JupyterLab interface.
- In the JupyterLab interface, navigate to the directory where you've cloned the demo repository.
- 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!