Skip to content

Commit

Permalink
handle the case of list sizes not being equal in list comparison
Browse files Browse the repository at this point in the history
  • Loading branch information
kasunamare committed Jan 8, 2024
1 parent ecd63e4 commit eeda7e7
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/triage/component/postmodeling/report_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down

0 comments on commit eeda7e7

Please sign in to comment.