Skip to content

Request help in using the library #88

@sissaNassir

Description

@sissaNassir

Hello! I'm trying to use PDPbox but It doesn't plot the figure and I don't understand

I'm using this dataset https://www.kaggle.com/datasets/mathan/fifa-2018-match-statistics

the code is

y = (fifa['Man of the Match'] == "Yes") # Convert from string "Yes"/"No" to binary
feature_names = [i for i in fifa.columns if fifa[i].dtype in [np.int64]]
X = fifa[feature_names]
train_X, val_X, train_y, val_y = train_test_split(X, y, random_state=1)
my_model = RandomForestClassifier(n_estimators=100, random_state=0).fit(train_X, train_y)

Then I consider the PDP for goal scored and I write:

from pdpbox import pdp, info_plots #A
feature_to_plot = 'Goal Scored' #B
pdp_dist = pdp.PDPIsolate(my_model, val_X, feature_names,feature_to_plot,'Goal Scored')

fig, axes = pdp_dist.plot(
    center=True,
    plot_lines=True,
    frac_to_plot=1,
    cluster_method='accurate',
    plot_pts_dist=True,
    to_bins=False,
    show_percentile=False,
    which_classes=None,
    figsize=None,
    dpi=300,
    ncols=2,
    plot_params={"pdp_hl": True, "line": {"hl_color": "#f46d43"}},
    engine='plotly',
    template='plotly_white',
)
fig

But it doesn't plot any figure, where is the error?

Thank you

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions