Search⌘ K
AI Features

Visualizing Classification Model Outputs

Explore how to visualize classification model outputs using Plotly in Python. Understand ROC-AUC curves and feature importance plots through customer churn and breast cancer datasets. Learn to evaluate and compare models' performance with interactive visualizations.

The data

The data that we will use for the following plots is a customer churn dataset that details many important people attributes such as their Age, CreditScore, gender (1 if male and 0 otherwise), etc. We also notice some one-hot encoded columns Geography_France, Geography_Germany, and Geography_Spain. These values are either 1 or zero, so if a person is from France, Geography_France=1, Geography_Germany=0, and Geography_Spain=0. We then use these variables to predict whether someone has Exited (churned).

Python 3.8
# Import libraries
import pandas as pd
import numpy as np
# Import datasets
churn = pd.read_csv('/usr/local/csvfiles/churn_preprocessed.csv')
print(churn.head())

We will now build a model (in this case, a GradientBoostingClassifier) in which Exited is the dependent variable and all the remaining variables are the predictor (independent) variables.

We split the data into training and testing sets so that we can fit the model to the training data and evaluate the model on unseen ...