ogboost.concordance_index¶
- ogboost.concordance_index(y_true, y_pred, sample_weight=None)[source]¶
Compute the concordance index (C-index) for ordinal predictions, optionally weighted by sample weights.
- Parameters:
y_true (array-like) – True ordinal labels.
y_pred (array-like) – Predicted ordinal scores or labels.
sample_weight (array-like, optional) – Sample weights (must have the same length as y_true). If None, equal weights are assumed.
- Returns:
float – The computed concordance index. Returns 0.0 if no permissible pairs are found.
- Raises:
ValueError – If input arrays have mismatched lengths or if sample_weight is invalid (e.g., contains negative values).