pub fn create_partial_dependence_plot(
feature_values: &ArrayView1<'_, Float>,
pd_values: &ArrayView1<'_, Float>,
ice_curves: Option<&ArrayView2<'_, Float>>,
feature_name: &str,
config: &PlotConfig,
show_ice: bool,
) -> SklResult<PartialDependencePlot>Expand description
Create partial dependence plot (PDP) with optional ICE curves
Generates partial dependence plots showing how model predictions change with feature values, with optional Individual Conditional Expectation curves.
§Arguments
feature_values- Feature values for x-axis (sorted grid points)pd_values- Partial dependence values corresponding to feature valuesice_curves- Optional ICE curves (instances × feature_values)feature_name- Name of the feature being analyzedconfig- Plot configuration settingsshow_ice- Whether to display individual ICE curves
§Returns
Result containing partial dependence plot data or error
§Errors
InvalidInput- If feature values and PD values lengths don’t matchInvalidInput- If ICE curves columns don’t match feature values length
§Examples
ⓘ
use sklears_inspection::visualization::plotting_functions::*;
// ✅ SciRS2 Policy Compliant Import
use scirs2_core::ndarray::array;
let feature_values = array![0.0, 0.2, 0.4, 0.6, 0.8, 1.0];
let pd_values = array![0.1, 0.3, 0.5, 0.4, 0.2, 0.1];
let config = PlotConfig::default();
let plot = create_partial_dependence_plot(
&feature_values.view(),
&pd_values.view(),
None,
"feature_1",
&config,
false,
).unwrap();
assert_eq!(plot.feature_name, "feature_1");
assert_eq!(plot.feature_values.len(), 6);
assert_eq!(plot.pd_values.len(), 6);
assert!(!plot.show_ice);