Auto MPG Dataset
Auto MPG Dataset Data Science Project
Introduction to Supervised Learning with scikit-learn

Auto MPG Dataset

This lab uses the classic **Auto MPG Dataset** and builds a model to predict the fuel efficiency of late-1970s and early 1980s automobiles. To do this, we'll examine the relation between fuel efficiency and different attributes like: cylinders, displacement, horsepower, and weight.

Project Activities

All our Data Science projects include bite-sized activities to test your knowledge and practice in an environment with constant feedback.

All our activities include solutions with explanations on how they work and why we chose them.


Compute the correlation matrix

Based on the correlation analysis of the dataset, which variable has the highest correlation with the target column?


Use train_test_split to split the data into training and testing sets. Split the dataset in 80% training, 20% testing, and random_state=0.

Set the random_state parameter to a desired integer value for reproducibility. Store this variable in random_state and then used in the function.

Store the values in the variables in X_train,X_test,y_train and y_test.


Linea Regression

Create an instance of the LinearRegression and store the model in lr.


Train the linear regression model

It's time to train the linear regression model using the training dataset.


Make predictions on the test set

Use the trained model to make predictions on the test data. Store the prediction in y_pred.

Auto MPG DatasetAuto MPG Dataset

Verónica Barraza

This project is part of

Introduction to Supervised Learning with scikit-learn

Explore other projects