safeai.rge.rge_score
- safeai.rge.rge_score(pred_full, pred_reduced, *, class_order=None, class_weights=None, verbose=False)[source]
Compute Rank Graduation Explainability between two prediction arrays.
- Parameters:
pred_full (array-like) – Predictions from the full/original model input. Can be a 1D score vector or a 2D probability matrix.
pred_reduced (array-like) – Predictions after feature removal, masking, or occlusion. Must have the same shape as pred_full.
class_order (array-like, optional) – Class order. If provided with 1D binary probabilities, the vectors are converted to two-column probability matrices.
class_weights (array-like, optional) – Weights for multiclass aggregation. If None, uses uniform weights.
verbose (bool, default=False) – Whether to print per-class values for multiclass inputs.
- Returns:
RGE score. Higher values indicate stronger prediction preservation after removal/occlusion.
- Return type:
float