File tree Expand file tree Collapse file tree 1 file changed +6
-5
lines changed
Expand file tree Collapse file tree 1 file changed +6
-5
lines changed Original file line number Diff line number Diff line change @@ -11,7 +11,7 @@ def __init__(
1111 """Stores the top k scores between two lists of inchikeys"""
1212
1313 self .k = tanimoto_scores_for_top_k .shape [1 ]
14- self .top_k_inchikeys_and_scores = self ._create_multi_index (
14+ self .top_k_inchikeys_and_scores : pd . DataFrame = self ._create_multi_index (
1515 tanimoto_scores_for_top_k , top_k_inchikeys , inchikey_indexes
1616 )
1717
@@ -62,7 +62,8 @@ def select_average_score(self, inchikey) -> float:
6262
6363 def get_all_average_tanimoto_scores (self ) -> dict [str , float ]:
6464 """Returns all average tanimoto scores for the top k per inchikey"""
65- average_per_inchikey_df = self .top_k_inchikeys_and_scores .xs ("score" , axis = 1 , level = "attribute" ).mean (axis = 1 ) # type: ignore
66- # convert to dictionary
67- average_per_inchikey = average_per_inchikey_df .squeeze ().to_dict ()
68- return average_per_inchikey
65+ # Get the scores
66+ scores_df : pd .DataFrame = self .top_k_inchikeys_and_scores .xs ("score" , axis = 1 , level = "attribute" ) # type: ignore
67+
68+ average_per_inchikey_df = scores_df .mean (axis = 1 )
69+ return average_per_inchikey_df .to_dict ()
You can’t perform that action at this time.
0 commit comments