How to plot a Partial dependency plot with sagemaker downloaded model, xgb booster object?

Viewed 107

I have an XGBoost model trained in Sagemaker and downloaded on my local. When you unzip the tar.gz file you get a model object(booster) file. I want to plot a Partial Dependency Plots for some features of my dataset (batch transformed with predictions) using the Sagemaker model instance. However, I get the following error.

ValueError: 'estimator' must be a fitted regressor or classifier.

The code that I'm using to plot the graph is as below-

from sklearn.inspection import partial_dependence
pardep = partial_dependence(model, X, 'num_org')

Here model is <xgboost.core.Booster at 0x7f9b7b9a2250> X is a data frame of the batch -transform with ~100 columns and 'num_org' is what I want to plot with respect to predictions.

0 Answers
Related