Simple Model Tests: performance evaluations
Simple Model Tests: performance evaluations Data Science Project
Classification in Depth with Scikit-Learn

Simple Model Tests: performance evaluations

The main objective of the first project is to validate the ability to split the dataset into train and test sets stratified by the target class, and to train and compare the performance of different models such as decision tree, random forest, light xgboost, and xgboost. For this project, we will use accuracy as the evaluation metric.

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.


Separate the target and the features into two variables.

Store the features in X and the target y.


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.

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


Train an Random Forest with the following parameters: n_estimators=100 and random_state=42 and calculated the accuracy for the testing set.

Train a Random Forest Classifier using the training data, and store the model in rf. You can specify the model parameters such as the maximum depth of the tree or the minimum number of samples required to split an internal node.

Calculate the accuracy of both the training and testing sets and run the code in a Jupyter Notebook.

Store the results in the variables train_accuracy and test_accuracy.

The expected accuracy for a simple problem varies depending on the specifics of the problem and data. However, for a well-defined and simple problem with a large and diverse training dataset, a well-trained machine learning model could achieve an accuracy of over 80% in some cases.


Compute precision, recall and f1-score using the test dataset

Store the precision, recall, and f1-score of the positive class in the variables precision,recall and f_1_score


If the Precision-Recall curve of a binary classification model has a steep slope in the beginning and becomes less steep towards the end, it means that it has high precision at the beginning, but as the recall increases, the precision decreases.


Best models performance

Which model presents the worst performance in the test dataset?

Simple Model Tests: performance evaluationsSimple Model Tests: performance evaluations

Verónica Barraza

This project is part of

Classification in Depth with Scikit-Learn

Explore other projects