safeai.rga.rga_curve
- safeai.rga.rga_curve(y_true, y_score, *, x=None, class_order=None, positive_class=1, n_segments=10, curve_method='auto', normalize_to_perfect=True, verbose=False)[source]
Compute an RGA curve and normalized AURGA.
- Parameters:
y_true (array-like, shape (n_samples,)) – True labels.
y_score (array-like or fitted model) – One of: - binary score/probability vector, shape (n_samples,) - probability matrix, shape (n_samples, n_classes) - fitted sklearn estimator or Pipeline with predict_proba
x (array-like or DataFrame, optional) – Input features. Required if y_score is a fitted model.
class_order (array-like, optional) – Order of probability columns.
positive_class (int or str, default=1) – Positive class for binary classification.
n_segments (int, default=10) – Number of curve segments.
curve_method ({'auto', 'partial', 'removal'}, default='auto') –
Method used to construct the RGA curve.
- ’auto’:
binary -> ‘partial’ multiclass -> ‘removal’
- ’partial’:
Partial contribution decomposition. Currently supported only for binary classification.
- ’removal’:
Progressively remove high-confidence samples and recompute RGA.
normalize_to_perfect (bool, default=True) – If True, return normalized AURGA as the main ‘aurga’.
verbose (bool, default=False) – Whether to print additional information.
- Returns:
Dictionary containing: - task - curve_method - rga - x - curve - aurga - aurga_raw - aurga_perfect, when available - perfect_curve, when available - per_class_rga, only for multiclass - class_weights, only for multiclass - classes, only for multiclass
- Return type:
dict