From 101fb02da59fc9d9fa5270da3213888e47f49dbe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ricardo=20Monta=C3=B1ana=20G=C3=B3mez?= Date: Wed, 6 Mar 2024 18:04:34 +0100 Subject: [PATCH] Update tests to last version --- src/CMakeLists.txt | 4 +++- tests/CMakeLists.txt | 3 +++ tests/TestPythonClassifiers.cc | 3 ++- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index c4e4ab0..ed94eba 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -2,10 +2,12 @@ include_directories( ${PyClassifiers_SOURCE_DIR}/lib/Files ${PyClassifiers_SOURCE_DIR}/lib/BayesNet/lib/json/include ${PyClassifiers_SOURCE_DIR}/lib/BayesNet/src + ${PyClassifiers_SOURCE_DIR}/lib/BayesNet/src/classifiers + ${PyClassifiers_SOURCE_DIR}/lib/BayesNet/src/bayesian_network + ${PyClassifiers_SOURCE_DIR}/lib/BayesNet/src/utils ${CMAKE_BINARY_DIR}/configured_files/include ${Python3_INCLUDE_DIRS} ${TORCH_INCLUDE_DIRS} ) add_library(PyClassifiers SHARED ${PyClassifiers_SOURCES}) -#target_link_libraries(PyClassifiers ${Python3_LIBRARIES} "${TORCH_LIBRARIES}" ${LIBTORCH_PYTHON} Boost::boost Boost::python Boost::numpy xgboost::xgboost) target_link_libraries(PyClassifiers BayesNet ${Python3_LIBRARIES} "${TORCH_LIBRARIES}" ${LIBTORCH_PYTHON} Boost::boost Boost::python Boost::numpy) \ No newline at end of file diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 7206cc9..465f026 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -6,6 +6,9 @@ if(ENABLE_TESTING) ${PyClassifiers_SOURCE_DIR}/lib/BayesNet/lib/Files ${PyClassifiers_SOURCE_DIR}/lib/BayesNet/lib/mdlp ${PyClassifiers_SOURCE_DIR}/lib/BayesNet/src + ${PyClassifiers_SOURCE_DIR}/lib/BayesNet/src/classifiers + ${PyClassifiers_SOURCE_DIR}/lib/BayesNet/src/bayesian_network + ${PyClassifiers_SOURCE_DIR}/lib/BayesNet/src/utils ${Python3_INCLUDE_DIRS} ${TORCH_INCLUDE_DIRS} ${CMAKE_BINARY_DIR}/configured_files/include diff --git a/tests/TestPythonClassifiers.cc b/tests/TestPythonClassifiers.cc index 0407920..3856ec9 100644 --- a/tests/TestPythonClassifiers.cc +++ b/tests/TestPythonClassifiers.cc @@ -35,11 +35,12 @@ TEST_CASE("Test Python Classifiers score", "[PyClassifiers]") }; SECTION("Test Python Classifier " + name + " score ") { - for (auto file_name : { "glass", "iris", "ecoli", "diabetes" }) { + for (std::string file_name : { "glass", "iris", "ecoli", "diabetes" }) { auto raw = RawDatasets(file_name, false); auto clf = models[name]; clf->fit(raw.Xt, raw.yt, raw.featurest, raw.classNamet, raw.statest); auto score = clf->score(raw.Xt, raw.yt); + INFO("File: " + file_name + " Classifier: " + name + " Score: " + to_string(score)); REQUIRE(score == Catch::Approx(scores[{file_name, name}]).epsilon(raw.epsilon)); } }