vcpkg #1

Merged
rmontanana merged 5 commits from vcpkg into main 2025-06-29 10:29:45 +00:00
17 changed files with 134 additions and 234 deletions
Showing only changes of commit e460eb4c41 - Show all commits

View File

@@ -68,7 +68,7 @@ endif (ENABLE_CLANG_TIDY)
# -------------------------------------------------- # --------------------------------------------------
# find_library(BayesNet NAMES libBayesNet BayesNet libBayesNet.a PATHS ${PyClassifiers_SOURCE_DIR}/../lib/lib REQUIRED) # find_library(BayesNet NAMES libBayesNet BayesNet libBayesNet.a PATHS ${PyClassifiers_SOURCE_DIR}/../lib/lib REQUIRED)
# find_path(Bayesnet_INCLUDE_DIRS REQUIRED NAMES bayesnet PATHS ${PyClassifiers_SOURCE_DIR}/../lib/include) # find_path(Bayesnet_INCLUDE_DIRS REQUIRED NAMES bayesnet PATHS ${PyClassifiers_SOURCE_DIR}/../lib/include)
find_library(bayesnet NAMES libbayesnet bayesnet libbayesnet.a PATHS ../lib REQUIRED) find_library(bayesnet NAMES libbayesnet bayesnet libbayesnet.a ${PyClassifiers_SOURCE_DIR}/../lib/lib REQUIRED)
find_path(Bayesnet_INCLUDE_DIRS REQUIRED NAMES bayesnet PATHS ../lib/include) find_path(Bayesnet_INCLUDE_DIRS REQUIRED NAMES bayesnet PATHS ../lib/include)
message(STATUS "BayesNet=${bayesnet}") message(STATUS "BayesNet=${bayesnet}")
message(STATUS "Bayesnet_INCLUDE_DIRS=${Bayesnet_INCLUDE_DIRS}") message(STATUS "Bayesnet_INCLUDE_DIRS=${Bayesnet_INCLUDE_DIRS}")

View File

@@ -1,19 +1,19 @@
#include "AdaBoost.h" #include "AdaBoostPy.h"
namespace pywrap { namespace pywrap {
AdaBoost::AdaBoost() : PyClassifier("sklearn.ensemble", "AdaBoostClassifier", true) AdaBoostPy::AdaBoostPy() : PyClassifier("sklearn.ensemble", "AdaBoostClassifier", true)
{ {
validHyperparameters = { "n_estimators", "n_jobs", "random_state" }; validHyperparameters = { "n_estimators", "n_jobs", "random_state" };
} }
int AdaBoost::getNumberOfEdges() const int AdaBoostPy::getNumberOfEdges() const
{ {
return callMethodSumOfItems("get_n_leaves"); return callMethodSumOfItems("get_n_leaves");
} }
int AdaBoost::getNumberOfStates() const int AdaBoostPy::getNumberOfStates() const
{ {
return callMethodSumOfItems("get_depth"); return callMethodSumOfItems("get_depth");
} }
int AdaBoost::getNumberOfNodes() const int AdaBoostPy::getNumberOfNodes() const
{ {
return callMethodSumOfItems("node_count"); return callMethodSumOfItems("node_count");
} }

View File

@@ -1,12 +1,12 @@
#ifndef ADABOOST_H #ifndef ADABOOSTPY_H
#define ADABOOST_H #define ADABOOSTPY_H
#include "PyClassifier.h" #include "PyClassifier.h"
namespace pywrap { namespace pywrap {
class AdaBoost : public PyClassifier { class AdaBoostPy : public PyClassifier {
public: public:
AdaBoost(); AdaBoostPy();
~AdaBoost() = default; ~AdaBoostPy() = default;
int getNumberOfEdges() const override; int getNumberOfEdges() const override;
int getNumberOfStates() const override; int getNumberOfStates() const override;
int getNumberOfNodes() const override; int getNumberOfNodes() const override;

View File

@@ -4,5 +4,5 @@ include_directories(
${PyClassifiers_SOURCE_DIR}/lib/json/include ${PyClassifiers_SOURCE_DIR}/lib/json/include
${Bayesnet_INCLUDE_DIRS} ${Bayesnet_INCLUDE_DIRS}
) )
add_library(PyClassifiers ODTE.cc STree.cc SVC.cc RandomForest.cc XGBoost.cc AdaBoost.cc PyClassifier.cc PyWrap.cc) add_library(PyClassifiers ODTE.cc STree.cc SVC.cc RandomForest.cc XGBoost.cc AdaBoostPy.cc PyClassifier.cc PyWrap.cc)
target_link_libraries(PyClassifiers nlohmann_json::nlohmann_json ${Python3_LIBRARIES} "${TORCH_LIBRARIES}" ${LIBTORCH_PYTHON} Boost::boost Boost::python Boost::numpy) target_link_libraries(PyClassifiers nlohmann_json::nlohmann_json ${Python3_LIBRARIES} "${TORCH_LIBRARIES}" ${LIBTORCH_PYTHON} Boost::boost Boost::python Boost::numpy)

View File

@@ -10,7 +10,7 @@
#include "pyclfs/SVC.h" #include "pyclfs/SVC.h"
#include "pyclfs/RandomForest.h" #include "pyclfs/RandomForest.h"
#include "pyclfs/XGBoost.h" #include "pyclfs/XGBoost.h"
#include "pyclfs/AdaBoost.h" #include "pyclfs/AdaBoostPy.h"
#include "pyclfs/ODTE.h" #include "pyclfs/ODTE.h"
#include "TestUtils.h" #include "TestUtils.h"
#include <iostream> #include <iostream>
@@ -63,7 +63,7 @@ TEST_CASE("Test Python Classifiers score", "[PyClassifiers]")
TEST_CASE("AdaBoostClassifier", "[PyClassifiers]") TEST_CASE("AdaBoostClassifier", "[PyClassifiers]")
{ {
auto raw = RawDatasets("iris", false); auto raw = RawDatasets("iris", false);
auto clf = pywrap::AdaBoost(); auto clf = pywrap::AdaBoostPy();
clf.fit(raw.Xt, raw.yt, raw.featurest, raw.classNamet, raw.statest); clf.fit(raw.Xt, raw.yt, raw.featurest, raw.classNamet, raw.statest);
clf.setHyperparameters(nlohmann::json::parse("{ \"n_estimators\": 100 }")); clf.setHyperparameters(nlohmann::json::parse("{ \"n_estimators\": 100 }"));
auto score = clf.score(raw.Xt, raw.yt); auto score = clf.score(raw.Xt, raw.yt);