diff --git a/src/triage/component/postmodeling/report_generator.py b/src/triage/component/postmodeling/report_generator.py index 5adab4bed..cf4805109 100644 --- a/src/triage/component/postmodeling/report_generator.py +++ b/src/triage/component/postmodeling/report_generator.py @@ -592,7 +592,10 @@ def _pairwise_list_comparison_single_fold(self, threshold_type, threshold, train df2.sort_values('score', ascending=False, inplace=True) # only returning the corr coefficient, not the p-value - results['rank_corr'].loc[model_group_pair[0], model_group_pair[1]] = spearmanr(df1.entity_id.iloc[:], df2.entity_id.iloc[:])[0] + if len(df1) == len(df2): + results['rank_corr'].loc[model_group_pair[0], model_group_pair[1]] = spearmanr(df1.entity_id.iloc[:], df2.entity_id.iloc[:])[0] + else: + logging.warning(f'Not calculating rank correlation. List sizes are not equal ({len(df1)}, {len(df2)})') if plot: fig, axes = plt.subplots(1, len(metrics), figsize=(10, 3))