Linear Regression in Machine Learning -algorithms 03


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.

Import

** 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.

customer.head()







customer.describe()




















Avg. Session LengthsTime on AppsTime on WebsitesLength of MembershipsYearly Amount Spents
count500.000000500.000000500.000000500.000000500.000000
mean33.05319412.05248837.0604453.533462499.314038
std0.9925630.9942161.0104890.99927879.314782
min29.5324298.50815233.9138470.269901256.670582
25%32.34182211.38815336.3492572.930450445.038277
50%33.08200811.98323137.0693673.533975498.887875
75%33.71198512.75385037.7164324.126502549.313828



customer.info()


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!!!

I am Mr. Sachin pagar the founder of Pythonslearning, a Passionate Educational Blogger and Author, who love to share the informative content on educational resources.

Have any Question or Comment?

Leave a Reply

Your email address will not be published. Required fields are marked *