Skip to content

Commit

Permalink
[Compare] Add validation for dataset lengths for the Wilcoxon test. (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
Amerousful authored Dec 18, 2024
1 parent 21955e9 commit 4f88cf9
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/plugins/compare/statistical.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ def perform_test(test_type, baseline, current, **kwargs):
return None, "Datasets are identical"
else:
return None, "No variability"
if (len(set(baseline)) != len(set(current))) and test_type == 'wilcoxon':
return None, "Datasets have different lengths"

if test_type == 'wilcoxon':
return wilcoxon(current, baseline, **kwargs)
Expand All @@ -31,7 +33,7 @@ def perform_test(test_type, baseline, current, **kwargs):
group_results = {}
for metric_name, metric_data in metrics.items():
stat, p = perform_test(test_type, metric_data['baseline'], metric_data['current'], **options)
if p == "No variability" or p == "Datasets are identical":
if p == "No variability" or p == "Datasets are identical" or p == "Datasets have different lengths":
group_results[metric_name] = {'statistic': "N/A", 'p-value': p}
else:
group_results[metric_name] = {'statistic': stat, 'p-value': p}
Expand Down

0 comments on commit 4f88cf9

Please sign in to comment.