Predicting Risk with CatBoost

You can get started with explainX in less than five minutes. Just follow this working examples line by line or simply copy-paste the code in your Jupyter Notebook


For this example, our goal is to predict RiskPerformance from the HELOC dataset.

For this example, we will be trainingCatBoost Classifierand then use ExplainX to provide business-level explanations and performing debugging tasks.

Let's start by opening up our Jupyter Notebook.

Install relevant packages

!pip install catboost
!pip install explainx

Import the library

from explainx import *
import catboost
from sklearn.model_selection import train_test_split

Load and pre-process the dataset for model-building. The dataset can be easily accessible from within the explainX library.

#Load Dataset
X_Data, Y_Data = explainx.dataset_heloc()
#Split data into train and test
X_train, X_test, Y_train, Y_test = train_test_split(X_Data, Y_Data, test_size=0.2, random_state=0)

Let's train our CatBoost model.

#Run CatBoost Model
model = CatBoostClassifier(iterations=500, learning_rate=0.3, depth=2)
#Fit Model, Y_train)

Let's call the explainX function and pass the parameters., Y_Test, model, model_name="catboost")

Once the explainX function is done running, you can simply click on the application link to access the explainX dashboard.

App running at

In the next part, we will continue our predicting RiskPerformance with CatBoost example. Let's dive right into explaining the model behavior and model predictions.