Abstract
The vivo package provides an accessible framework for calculating local variable importance based on Ceteris Paribus profiles and global variable importance based on Partial Dependence Profiles. It is designed for the R environment (>= 3.0) and integrates with the DALEX ecosystem to offer nuanced model diagnostics.
Introduction
Interpreting complex machine learning models requires tools that go beyond aggregate global scores. While traditional measures like permutation importance are useful, they often fail to capture how a variable's influence fluctuates across its range or for specific instances. The vivo package addresses this by quantifying "oscillations" in model profiles. By measuring the sensitivity of a model's output to changes in a single input feature, vivo provides a granular diagnostic tool for both local and global model behavior.
Methodology and Implementation
The core of vivo lies in analyzing how model predictions change when a single variable is varied while others are held constant. The package builds upon the "Model Oriented" ecosystem, integrating with DALEX and ingredients to calculate importance based on two primary profile types.
Local Variable Importance
Local importance is derived from Ceteris Paribus (CP) profiles, which measure the influence of a variable for a single observation. The package allows for eight distinct variants of importance calculation by adjusting parameters such as absolute deviation, the reference point for distance measurement, and data density weighting.
Empirical Density Weighting
A critical innovation in vivo is the ability to weight importance by the empirical distribution of the training data. The calculate_weight function estimates data density using variable splits, ensuring that oscillations in regions with sparse data do not disproportionately inflate a feature's importance score. This prevents the interpretation of model "hallucinations" in areas where the model has not been adequately trained.
Global Importance
Global importance is calculated by aggregating these local behaviors into Partial Dependence Profiles (PDP). This provides a consistent narrative across different levels of model explanation, moving from specific instances to model-wide trends.
Applications and Insights
Using datasets such as the apartments regression set, vivo demonstrates how feature influence (e.g., surface area vs. construction year) can be visualized and quantified. Key insights include:
- Oscillation as a Proxy for Importance: A variable's importance is directly proportional to the "wiggliness" of its profile; a flat profile indicates zero influence.
- The Density Guardrail: By incorporating empirical density weighting,
vivoensures importance measures are grounded in regions where data actually exists. - Visual Consistency: S3 methods for plotting enable seamless transitions from numerical scores to bar and line charts, facilitating easier communication of model diagnostics.
Limitations and Future Work
The primary limitation of this approach is the computational cost associated with generating numerous CP and PDP profiles, especially for high-dimensional data or complex ensembles like deep neural networks. Furthermore, while excellent for univariate analysis, the current framework may not fully capture complex feature interactions where one variable's oscillation depends heavily on the state of another. Future directions may include derivative-based measures or more explicit handling of high-dimensional interactions.
Summary updated