sampling.effects.plot_all_partial_dependence

sampling.effects.plot_all_partial_dependence(
    df,
    df_target,
    model='GradientBoostingRegressor',
    nrows=5,
    ncols=6,
    figsize=(20, 15),
    title='',
)

Generates Partial Dependence Plots (PDPs) for every feature in a DataFrame against a target variable, arranged in a grid.

Parameters

Name Type Description Default
df pd.DataFrame DataFrame containing the features. required
df_target pd.Series Series containing the target variable. required
model str Name of the model class to use (e.g., “GradientBoostingRegressor”). Defaults to “GradientBoostingRegressor”. 'GradientBoostingRegressor'
nrows int Number of rows in the grid of subplots. Defaults to 5. 5
ncols int Number of columns in the grid of subplots. Defaults to 6. 6
figsize tuple Figure size (width, height) in inches. Defaults to (20, 15). (20, 15)
title str Title for the subplots. Defaults to ““. ''

Returns

Name Type Description
None None

Examples

>>> form spotpython.utils.effects import plot_all_partial_dependence
>>> from sklearn.datasets import load_boston
>>> import pandas as pd
>>> data = load_boston()
>>> df = pd.DataFrame(data.data, columns=data.feature_names)
>>> df_target = pd.Series(data.target, name="target")
>>> plot_all_partial_dependence(df, df_target, model="GradientBoostingRegressor", nrows=5, ncols=6, figsize=(20, 15))