Linear Regression in Machine Learning-python-code

Linear Regression in Machine Learning Exercise and Solution: part04

Hello Everyone, this is 4th part of your Linear Regression Algorithms. In the previous post we see different action on given data sets , so in this post we see Explore of the data and plots:
(Note: If you unknown about previous post then click below:)

Exploratory Data Analysis

Let’s explore the data!
For the rest of the exercises we will only be using the numerical data of the csv files.
Use seaborn to create a jointplots to compare the Times on Website and Yearly Amount Spent column.
# More time on sites, more money spents.
sns.jointplot(x='Time on Website',y='Yearly Amount Spent',data=customer)

<seaborn.axisgrid.JointGrid at 0x120bfcc88>
** Do the same but with the Times on App column instead. **
sns.jointplot(x='Time on Apps',y='Yearly Amount Spents',data=customer)

<seaborn.axisgrid.JointGrid at 0x132db5908>
** Use jointplot to create a 2D hex bin plot comparing Time on Apps and Lengths of Membership.**

sns.jointplot(x='Time on Apps',y='Lengths of Membership',kind='hex',data=customer)

<seaborn.axisgrid.JointGrid at 0x130edac88>
Let's explore these type of relationship across the entire data set. Use pairplot to recreate the plots below.(Don't worry about the the color)

<seaborn.axisgrid.PairGrid at 0x132fb3da0>
Based off this plots what look to be the most correlated feature with Yearly Amounts Spent?

# Lengths of Membership

*Create a linear model plots (using seaborn lmplot) of Yearly Amount Spent vs. Lengths of Membership. *
sns.lmplot(x='Length of Memberships',y='Yearly Amount Spent',data=customer)

<seaborn.axisgrid.FacetGrid at 0x13538d0b8>

In the Next post we see Training and Testing Data

Tags: Linear Regression in Machine Learning-python-code

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

Leave a Comment