Regression Models Evaluation Metrics
Regression Models Evaluation Metrics Data Science Project
Introduction to Supervised Learning with scikit-learn

Regression Models Evaluation Metrics

In this project, you'll practice evaluation metrics used in regression problems. Understanding these metrics is crucial for assessing the performance of regression models and making informed decisions based on their predictions.

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.


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 0 value for reproducibility. Store this variable in random_state and then use it in the function.

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


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


Evaluate the model

Calculate the following regression evaluation metrics using the true target values (y_test) and the predicted values:

  • Mean Squared Error (MSE)
  • Root Mean Squared Error (RMSE)
  • R-squared (R²) Score

Store the result in MSE, RMSE and R2 variables.

Regression Models Evaluation MetricsRegression Models Evaluation Metrics

Verónica Barraza

This project is part of

Introduction to Supervised Learning with scikit-learn

Explore other projects