Skip to content

Commit 6b7f82c

Browse files
committed
fix: validate actualLabels length in DI detector
1 parent 845c9a1 commit 6b7f82c

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/Interpretability/DisparateImpactBiasDetector.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,11 @@ protected override BiasDetectionResult<T> GetBiasDetectionResult(
9393
// If labels are available, compute TPR/FPR/Precision per group and Equal Opportunity difference.
9494
if (actualLabels != null)
9595
{
96+
if (actualLabels.Length != predictions.Length)
97+
{
98+
throw new ArgumentException("Actual labels vector must have the same length as predictions.", nameof(actualLabels));
99+
}
100+
96101
var groupTruePositiveRates = new Dictionary<string, T>();
97102
var groupFalsePositiveRates = new Dictionary<string, T>();
98103
var groupPrecisions = new Dictionary<string, T>();

0 commit comments

Comments
 (0)