Question: Project Assignment Tasks The data file for this project is available from the Seaborn website. To load this data into a DataFrame, run this code:

Project Assignment Tasks
The data file for this project is available from the Seaborn website. To load this data into a DataFrame, run
this code: mpg= sns.load_dataset('mpg')(2 pts.)
Display the first five rows of data (2 pts.).
Get the correlation data for the mpg column. Sort the results to make it easier to see the columns with the
stronger correlations (2 pts.).
Use the column with the strongest positive or negative correlation to the mpg column to split the data into
test and training datasets, where the test dataset consists of 20% of the total dataset. Be sure to specify a
value for the random_state parameter (4 pts.).
Create a linear regression model from the training dataset (3 pts.).
Score the model using the test dataset (2 pts.).
Score the model using the training dataset (2 pts.).
Predict the y values based on the x values in the test dataset, and store the results in a variable. Then, put the
predicted values in a new DataFrame (3 pts.).
Join the y_test and predicted data with the x-test data, save the combined data in a new DataFrame, and
then display the first five rows of data (3 pts.).
Add the residuals to the new DataFrame created in step 9(2 pts.).
Plot the residuals in a Seaborn KDE plot (2 pts.).
Melt the actual and predicted MPG columns together, assigning appropriate values to the variable and value
names (2 pts.).
Use a Seaborn scatter plot to plot the predicted data (2 pts.).
Project Assignment Tasks The data file for this

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!