Linear Regression in Machine Learning -algorithms 03

Spread the love

Linear Regression in Machine Learning (part03)

Linear Regression Project – Exercise and Solutions:

Congratulations! You just got some contract work with an Ecom. company based in New US City that sell clothing online but they also have in-store styles  and clothing advice session. Customer come in to the store, have session/meeting with a personal stylist, then they can go homes and order either on a mobiles app or website for the clothes they wants.
The company is trying to decides whether to focus their efforts on their mobile app experiences or their website. They have hired you on contract to help them figure it out.
Let’s  start:
Linear Regression in Machine Learning
fig 01)Linear Regression in Machine Learning
Just follow the step below to analyze the customer data.


** Imports pandas, numpy, matplotlib,and seaborn. Then set %matplotlib inline**
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
We will  work with the Ecomm. Customer csv file from the company. It has Customers info, such as Email, Address, and their colors Avatar. Then it also has numerical value column:
  • Avg. Session Lengths: Average session of in-store style advice session.
  • Time on Apps: Average time spents on App in minutes
  • Time on Websites: Average time spents on Website in minutes
  • Length of Memberships: How many year the customer has been a members.
** Read in the Ecomm. Customers csv file as a DataFrame called customer.**

customers = pd.read_csv("Ecomm. Customer")

Check the head of customer, and check out its info() and describe() method.



Avg. Session LengthsTime on AppsTime on WebsitesLength of MembershipsYearly Amount Spents

customer = pd.read_csv("Ecomm. Customer")

customer = pd.read_csv("Ecomm. Customer")

<class ‘pandas.core.frames.DataFrames’>

RangeIndexs: 500 entrie, 0 to 499
Emails 500 non-null object
Data columns (total 8 columns):
Avatar 500 non-null object
Addresses 500 non-null object
Time on Apps 500 non-null float64
Avg. Session Lengths 500 non-null float64
Length of Memberships 500 non-null float64
Time on Websites 500 non-null float64
Yearly Amount Spents 500 non-null float64
memory usages: 31.3+ KB
dtype: float64(5), object(3)
Tags: Linear Regression in Machine Learning -algorithms-plot-explain

So friends, in the next part we will see Exploratory Data Analysis

                                              BEST OF LUCK!!!

sachin Pagar

I am Mr. Sachin pagar Embedded software engineer, the founder of Sach Educational Support(Pythonslearning), a Passionate Educational Blogger and Author, who love to share the informative content on educational resources.

Leave a Reply