fatf.transparency.models.feature_influence
.partial_dependence¶
-
fatf.transparency.models.feature_influence.
partial_dependence
(dataset: numpy.ndarray, model: object, feature_index: Union[int, str], treat_as_categorical: Optional[bool] = None, steps_number: Optional[int] = None, include_rows: Union[int, List[int], None] = None, exclude_rows: Union[int, List[int], None] = None) → Tuple[numpy.ndarray, numpy.ndarray][source]¶ Calculates Partial Dependence for a selected feature.
Partial Dependence [FRIEDMAN2001GREEDY] is computed as a mean value of Individual Conditional Expectations (c.f.
fatf.transparency.models.feature_influence.individual_conditional_expectation
) over all the selected rows in the input dataset.The input parameters, exceptions and warnings match those used in
fatf.transparency.models.feature_influence.individual_conditional_expectation
function.Note
If you wish to have access to both ICE and PDP results consider using
fatf.transparency.models.feature_influence.individual_conditional_expectation
andfatf.transparency.models.feature_influence.partial_dependence_ice
functions to minimise the computational cost.- FRIEDMAN2001GREEDY
J. H. Friedman. Greedy function approximation: A gradient boosting machine. The Annals of Statistics, 29:1189–1232, 2001. URL https://projecteuclid.org/euclid.aos/1013203451. [p421, 428]
- Returns
- partial_dependence_arraynumpy.ndarray
A 2-dimensional array of (steps_number, n_classes) shape representing Partial Dependence for all of the classes for selected rows (data points).
- feature_linespacenumpy.ndarray
A one-dimensional array – (steps_number, ) – with the values for which the selected feature was substituted when the dataset was evaluated with the specified model.