Skip to content

Commit

Permalink
Force idxmax result to be non-categorical #96
Browse files Browse the repository at this point in the history
  • Loading branch information
ChuanXu1 committed Nov 1, 2023
1 parent 77abaa3 commit 543c059
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion celltypist/classifier.py
Original file line number Diff line number Diff line change
Expand Up @@ -468,7 +468,7 @@ def majority_vote(predictions: AnnotationResult, over_clustering: Union[list, tu
over_clustering = np.array(over_clustering)
logger.info("🗳️ Majority voting the predictions")
votes = pd.crosstab(predictions.predicted_labels['predicted_labels'], over_clustering)
majority = votes.idxmax(axis=0)
majority = votes.idxmax(axis=0).astype(str)
freqs = (votes / votes.sum(axis=0).values).max(axis=0)
majority[freqs < min_prop] = 'Heterogeneous'
majority = majority[over_clustering].reset_index()
Expand Down

0 comments on commit 543c059

Please sign in to comment.