# scikit-learn: Predict Sales Revenue using Multiple Linear Regression

This project will cover how to implement multiple linear regression using Python. We will alternatively use the `statsmodels` and `sklearn`modules for calculating the linear regression, while using `pandas` for data management, and `seaborn` for plotting. We will be working with the very popular advertising dataset to predict sales revenue based on advertising spending on different mediums.

Duration (mins)

Learners

#### NA / 5

Rating

We will cover the following tasks in 1 hour and 11 minutes:

### Introduction and Libraries

We will understand the Rhyme interface and our learning environment. You will be provided with a cloud desktop with Jupyter Notebooks and all the software you will need to complete the project. Jupyter Notebooks are very popular with Data Science and Machine Learning Engineers as one can write code in cells and use other cells for documentation.

We will also introduce the model we will be building as well the dataset for this Project. Finally, we will import libraries and helper functions that will be essential later in the project.

In this task, we will load the very popular advertising dataset about various costs incurred on advertising by different mediums such as through TV, radio, newspaper, and the sales for a particular product. Next, we will briefly explore the data to get some basic information about what we are going to be working with.

### Data Cleaning

Cleaning and preprocessing data is a vital process in data analysis and machine learning. In this task, we will take a look at our imported data and ascertain what to remove and what to keep for further analysis.

### Multiple Linear Regression - Estimating Coefficients

Multiple linear regression is an approach for modeling the relationship between a scalar dependent response variable y and two or more predictors (or independent variables) denoted X.

In this task, we are going to use the `statsmodels.api` to create our ordinary least squares (OLS) linear regression model. We will use `sklearn` to split our data into training and test sets.

### Interpreting Coefficients

In this task, we will understand the significance of the model coefficients as they relate to the advertising data. We have already learned to interpret them geometrically, and now we will look at how the coefficients of the predictors affect the response variable `sales.

### Feature Selection

Although one can include all available predictors as features or regressors, that is most often not the smart choice. In this task, we will implement various models and determine which features to include for our inference.

### Model Evaluation Metrics

Here we will learn the theory and implementation details behind Mean Absolute Error, Mean Squared Error, and Root Mean Square Error. We will then make the appropriate choice of metrics for our model.

### Model Evaluation Using Train/Test Split and RMSE

Armed with our arsenal of model metrics, we will evaluate the multiple regression model on the test set to determine out of sample performance.

## Watch Preview

Preview the instructions that you will follow along in a hands-on session in your browser.

## About the Host (Snehan Kekre)

Snehan hosts Machine Learning courses at Rhyme. He is in his senior year of university at the Minerva Schools at KGI, pursuing a double major in the Natural Sciences and Computational Sciences, with a focus on physics and machine learning. When not applying computational and quantitative methods to identify the structures shaping the world around him, he can sometimes be seen trekking in the mountains of Nepal.

## Frequently Asked Questions

##### How is this different from YouTube, PluralSight, Udemy, etc.?
In Rhyme, all projects are completely hands-on. You don't just passively watch someone else. You use the software directly while following the host's (Snehan Kekre) instructions. Using the software is the only way to achieve mastery. With the "Live Guide" option, you can ask for help and get immediate response.
##### What do I need to install / configure to join this session?
Nothing! Just join through your web browser. Your host (Snehan Kekre) has already installed all required software and configured all data.
##### How do I create my own projects like this?
You can go to https://rhyme.com/for-companies, sign up for free, and follow this visual guide How to use Rhyme to create your own projects. If you have custom needs or company-specific environment, please email us at help@rhyme.com
##### Can I buy Rhyme sessions for my company or learning institution?
Absolutely. We offer Rhyme for workgroups as well larger departments and companies. Universities, academies, and bootcamps can also buy Rhyme for their settings. You can select projects and trainings that are mission critical for you and, as well, author your own that reflect your own needs and tech environments. Please email us at help@rhyme.com
##### What kind of accessibility options does Rhyme provide?
Rhyme's visual instructions are somewhat helpful for reading impairments. The Rhyme interface has features like resolution and zoom that are slightly helpful for visual impairment. And, we are currently developing a close-caption functionality to help with hearing impairment. Most of the accessibility options of the cloud desktop's operating system or the specific application can also be used in Rhyme. However, we still have a lot of work to do. If you have suggestions for accessibility, please email us at accessibility@rhyme.com
##### I have a different question
Please email us at help@rhyme.com and we'll respond to you within one business day.