Skip to content

Commit

Permalink
always filter hpo terms in predict_new_sample
Browse files Browse the repository at this point in the history
  • Loading branch information
ldingemans committed Jun 7, 2023
1 parent 582db0a commit 024d446
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions phenoscore/phenoscorer.py
Original file line number Diff line number Diff line change
Expand Up @@ -325,6 +325,7 @@ def predict_new_sample(self, original_X, original_y, img, hpo_all_new_sample, li
get_clf(original_X, original_y, self._simscorer, self.mode, None)

if self.mode != 'face':

filtered_hpo = self._simscorer.filter_hpo_df(hpo_all_new_sample)

if len(hpo_terms_pt) != len(hpo_terms_cont):
Expand All @@ -333,8 +334,10 @@ def predict_new_sample(self, original_X, original_y, img, hpo_all_new_sample, li
avg_pt, avg_cont = [], []

for i in range(len(hpo_terms_pt)):
avg_pt.append(self._simscorer.calc_similarity(filtered_hpo, self._simscorer.filter_hpo_df(hpo_terms_pt[i])))
avg_cont.append(self._simscorer.calc_similarity(filtered_hpo, self._simscorer.filter_hpo_df(hpo_terms_cont[i])))
hpo_terms_pt[i], hpo_terms_cont[i] = self._simscorer.filter_hpo_df(
hpo_terms_pt[i]), self._simscorer.filter_hpo_df(hpo_terms_cont[i])
avg_pt.append(self._simscorer.calc_similarity(filtered_hpo, hpo_terms_pt[i]))
avg_cont.append(self._simscorer.calc_similarity(filtered_hpo, hpo_terms_cont[i]))

hpo_features = np.array([[np.mean(avg_pt), np.mean(avg_cont)]])
hpo_features = scale_hpo.transform(hpo_features)
Expand Down

0 comments on commit 024d446

Please sign in to comment.