Skip to content

Commit

Permalink
fix dimensions for pearsonsr
Browse files Browse the repository at this point in the history
  • Loading branch information
mhangaard committed Mar 2, 2020
1 parent 18d58ac commit bef4f7e
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 21 deletions.
8 changes: 4 additions & 4 deletions catlearn/preprocess/feature_elimination.py
Original file line number Diff line number Diff line change
Expand Up @@ -264,11 +264,11 @@ def _get_correlation(self, target, feature_matrix):
d = feature_matrix[:, i:i + 1]
if np.allclose(d, d[0]):
corr.append(0.)
elif self.correlation is 'pearson':
corr.append(pearsonr(x=d, y=t)[0])
elif self.correlation is 'spearman':
elif self.correlation != 'pearson':
corr.append(pearsonr(x=d.ravel(), y=t.ravel())[0])
elif self.correlation != 'spearman':
corr.append(spearmanr(a=d, b=t)[0])
elif self.correlation is 'kendall':
elif self.correlation != 'kendall':
corr.append(kendalltau(x=d, y=t)[0])

return corr, order
Expand Down
35 changes: 18 additions & 17 deletions test/test_suite.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,20 +77,21 @@ def setup_suite(class_list):
])

# Clean everything up.
os.remove('vec_store.sqlite')
os.remove('hierarchy.pickle')
os.remove('test.sqlite')
os.remove('cvsave.pickle')
os.remove('cvsave.json')
os.remove('gaWrite.json')

os.remove('all_predicted_paths.traj')
os.remove('evaluated_structures.traj')
os.remove('final.traj')
os.remove('final_optimized.traj')
os.remove('initial.traj')
os.remove('initial_optimized.traj')
os.remove('results_neb.csv')
os.remove('results_neb_interpolation.csv')
os.remove('ML-NEB.traj')
os.remove('warnings_and_errors.txt')
for fname in ['vec_store.sqlite',
'hierarchy.pickle',
'test.sqlite',
'cvsave.pickle',
'cvsave.json',
'gaWrite.json',
'all_predicted_paths.traj',
'evaluated_structures.traj',
'final.traj',
'final_optimized.traj',
'initial.traj',
'initial_optimized.traj',
'results_neb.csv',
'results_neb_interpolation.csv',
'ML-NEB.traj',
'warnings_and_errors.txt']:
if fname in os.listdir():
os.remove(fname)

0 comments on commit bef4f7e

Please sign in to comment.