Skip to content

Commit

Permalink
removes DataFrame.append from feature scoring
Browse files Browse the repository at this point in the history
see conversation on issue #126
  • Loading branch information
quaquel committed May 18, 2022
1 parent 3d16223 commit 8b8bfe4
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 10 deletions.
17 changes: 9 additions & 8 deletions ema_workbench/analysis/feature_scoring.py
Original file line number Diff line number Diff line change
Expand Up @@ -377,15 +377,16 @@ def get_feature_scores_all(
"""
complete = None
complete = []
for key, value in y.items():
fs, _ = algorithms[alg](x, value, mode=mode, **kwargs)

fs = fs.rename(columns={1: key})

if complete is None:
complete = fs.T
else:
complete = complete.append(fs.T, sort=True)

return complete.T
complete.append(fs)
# if complete is None:
# complete = fs.T
# else:
# complete = complete.append(fs.T, sort=True)
complete = pd.concat(complete, sort=True, axis=1)

return complete
4 changes: 2 additions & 2 deletions test/test_analysis/test_feature_scoring.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ def test_prepare_experiments(self):
)
x, _ = fs._prepare_experiments(x)

correct = np.array([[0, 1, 2, 1], [2, 5, 6, 1], [3, 2, 1, 1]], dtype=np.float)
correct = np.array([[0, 1, 2, 1], [2, 5, 6, 1], [3, 2, 1, 1]], dtype=float)

self.assertTrue(np.all(x == correct))

Expand Down Expand Up @@ -206,4 +206,4 @@ def test_get_feature_scores_all(self):

# suite = unittest.TestSuite()
# suite.addTest(FeatureScoringTestCase("test_get_lasso_feature_scores"))
# unittest.TextTestRunner().run(suite)
# unittest.TextTestRunner().run(suite)

0 comments on commit 8b8bfe4

Please sign in to comment.