From 310b18a8d39586129ee365f929c68b38b2a74d95 Mon Sep 17 00:00:00 2001 From: Thomas Purcell <purcell@fhi-berlin.mpg.de> Date: Fri, 4 Sep 2020 11:47:08 +0200 Subject: [PATCH] Update tests for classification changes in feature space --- src/classification/utils.cpp | 2 +- src/python/__init__.py | 2 +- src/utils/project.hpp | 2 +- tests/test_descriptor_identifier/test_regressor.py | 2 +- .../test_feature_space/test_feature_space.py | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/classification/utils.cpp b/src/classification/utils.cpp index 953f17e0..2cf4c682 100644 --- a/src/classification/utils.cpp +++ b/src/classification/utils.cpp @@ -1,4 +1,4 @@ -#include <classificationutils.hpp> +#include <classification/utils.hpp> std::vector<double> convex_hull::SORTED_VALUE; std::vector<int> convex_hull::SORTED_PROP_INDS; diff --git a/src/python/__init__.py b/src/python/__init__.py index 469b8657..0ad8455d 100644 --- a/src/python/__init__.py +++ b/src/python/__init__.py @@ -77,7 +77,6 @@ def generate_phi_0_from_csv( # Load csv file if isinstance(df, str): df = pd.read_csv(df, index_col=0) - df = df.astype(float) df_cols = df.columns.to_list() col_exprs = [c.split(" (")[0] for c in df_cols] prop_ind = np.where([c_ex == prop_key.split(" (")[0] for c_ex in col_exprs])[0][0] @@ -105,6 +104,7 @@ def generate_phi_0_from_csv( prop = df[prop_key].to_numpy() df = df.drop([prop_key], axis=1) + df = df.astype(float) # Get test and training sets= if leave_out_frac > 0.0 and leave_out_inds is None: leave_out_inds = [] diff --git a/src/utils/project.hpp b/src/utils/project.hpp index 59f217e0..ff24e1ba 100644 --- a/src/utils/project.hpp +++ b/src/utils/project.hpp @@ -10,7 +10,7 @@ #include <limits> #include <feature_creation/node/Node.hpp> -#include <classificationutils.hpp> +#include <classification/utils.hpp> namespace project_funcs { diff --git a/tests/test_descriptor_identifier/test_regressor.py b/tests/test_descriptor_identifier/test_regressor.py index 264e2ac6..9b13f8a7 100644 --- a/tests/test_descriptor_identifier/test_regressor.py +++ b/tests/test_descriptor_identifier/test_regressor.py @@ -36,7 +36,7 @@ def test_sisso_regressor(): op_set = ["add", "sub", "mult", "sq", "cb", "sqrt", "cbrt"] - feat_space = generate_fs(phi_0, prop, [90], op_set, 2, 10) + feat_space = generate_fs(phi_0, prop, [90], op_set, "regression", 2, 10) sisso = SISSORegressor( feat_space, diff --git a/tests/test_feature_creation/test_feature_space/test_feature_space.py b/tests/test_feature_creation/test_feature_space/test_feature_space.py index db0d03fc..4c237ea1 100644 --- a/tests/test_feature_creation/test_feature_space/test_feature_space.py +++ b/tests/test_feature_creation/test_feature_space/test_feature_space.py @@ -26,7 +26,7 @@ def test_feature_space(): op_set = ["add", "sub", "mult", "sq", "cb", "sqrt", "cbrt"] - feat_space = generate_fs(phi_0, prop, [90], op_set, 2, 10) + feat_space = generate_fs(phi_0, prop, [90], op_set, "regression", 2, 10) feat_space.sis(prop) assert feat_space.phi_selected[0].postfix_expr == "1|0|add|sq" -- GitLab