Add CMakelist integration
This commit is contained in:
parent
f6e00530be
commit
6a23e2cc26
@ -36,12 +36,16 @@ option(CODE_COVERAGE "Collect coverage from test library" OFF)
|
|||||||
set(Boost_USE_STATIC_LIBS OFF)
|
set(Boost_USE_STATIC_LIBS OFF)
|
||||||
set(Boost_USE_MULTITHREADED ON)
|
set(Boost_USE_MULTITHREADED ON)
|
||||||
set(Boost_USE_STATIC_RUNTIME OFF)
|
set(Boost_USE_STATIC_RUNTIME OFF)
|
||||||
find_package(Boost 1.66.0 REQUIRED)
|
find_package(Boost 1.66.0 REQUIRED COMPONENTS python3 numpy3)
|
||||||
if(Boost_FOUND)
|
if(Boost_FOUND)
|
||||||
message("Boost_INCLUDE_DIRS=${Boost_INCLUDE_DIRS}")
|
message("Boost_INCLUDE_DIRS=${Boost_INCLUDE_DIRS}")
|
||||||
include_directories(${Boost_INCLUDE_DIRS})
|
include_directories(${Boost_INCLUDE_DIRS})
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
# Python
|
||||||
|
find_package(Python3 3.11...3.11.9 COMPONENTS Interpreter Development REQUIRED)
|
||||||
|
message("Python3_LIBRARIES=${Python3_LIBRARIES}")
|
||||||
|
|
||||||
# CMakes modules
|
# CMakes modules
|
||||||
# --------------
|
# --------------
|
||||||
set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules ${CMAKE_MODULE_PATH})
|
set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules ${CMAKE_MODULE_PATH})
|
||||||
@ -77,6 +81,7 @@ add_subdirectory(config)
|
|||||||
add_subdirectory(lib/Files)
|
add_subdirectory(lib/Files)
|
||||||
add_subdirectory(src/BayesNet)
|
add_subdirectory(src/BayesNet)
|
||||||
add_subdirectory(src/Platform)
|
add_subdirectory(src/Platform)
|
||||||
|
add_subdirectory(src/PyClassifiers)
|
||||||
add_subdirectory(sample)
|
add_subdirectory(sample)
|
||||||
|
|
||||||
file(GLOB BayesNet_HEADERS CONFIGURE_DEPENDS ${BayesNet_SOURCE_DIR}/src/BayesNet/*.h ${BayesNet_SOURCE_DIR}/BayesNet/*.h)
|
file(GLOB BayesNet_HEADERS CONFIGURE_DEPENDS ${BayesNet_SOURCE_DIR}/src/BayesNet/*.h ${BayesNet_SOURCE_DIR}/BayesNet/*.h)
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
include_directories(${BayesNet_SOURCE_DIR}/src/BayesNet)
|
include_directories(${BayesNet_SOURCE_DIR}/src/BayesNet)
|
||||||
include_directories(${BayesNet_SOURCE_DIR}/src/Platform)
|
include_directories(${BayesNet_SOURCE_DIR}/src/Platform)
|
||||||
|
include_directories(${BayesNet_SOURCE_DIR}/src/PyClassifiers)
|
||||||
include_directories(${BayesNet_SOURCE_DIR}/lib/Files)
|
include_directories(${BayesNet_SOURCE_DIR}/lib/Files)
|
||||||
include_directories(${BayesNet_SOURCE_DIR}/lib/mdlp)
|
include_directories(${BayesNet_SOURCE_DIR}/lib/mdlp)
|
||||||
include_directories(${BayesNet_SOURCE_DIR}/lib/argparse/include)
|
include_directories(${BayesNet_SOURCE_DIR}/lib/argparse/include)
|
||||||
@ -11,7 +12,7 @@ add_executable(b_manage b_manage.cc Results.cc ManageResults.cc CommandParser.cc
|
|||||||
add_executable(b_list b_list.cc Datasets.cc Dataset.cc)
|
add_executable(b_list b_list.cc Datasets.cc Dataset.cc)
|
||||||
add_executable(b_best b_best.cc BestResults.cc Result.cc Statistics.cc BestResultsExcel.cc ReportExcel.cc ReportBase.cc Datasets.cc Dataset.cc ExcelFile.cc)
|
add_executable(b_best b_best.cc BestResults.cc Result.cc Statistics.cc BestResultsExcel.cc ReportExcel.cc ReportBase.cc Datasets.cc Dataset.cc ExcelFile.cc)
|
||||||
|
|
||||||
target_link_libraries(b_main BayesNet ArffFiles mdlp "${TORCH_LIBRARIES}")
|
target_link_libraries(b_main BayesNet ArffFiles mdlp "${TORCH_LIBRARIES}" PyWrap)
|
||||||
target_link_libraries(b_manage "${TORCH_LIBRARIES}" "${XLSXWRITER_LIB}" ArffFiles mdlp)
|
target_link_libraries(b_manage "${TORCH_LIBRARIES}" "${XLSXWRITER_LIB}" ArffFiles mdlp)
|
||||||
target_link_libraries(b_best Boost::boost "${XLSXWRITER_LIB}" "${TORCH_LIBRARIES}" ArffFiles mdlp)
|
target_link_libraries(b_best Boost::boost "${XLSXWRITER_LIB}" "${TORCH_LIBRARIES}" ArffFiles mdlp)
|
||||||
target_link_libraries(b_list ArffFiles mdlp "${TORCH_LIBRARIES}")
|
target_link_libraries(b_list ArffFiles mdlp "${TORCH_LIBRARIES}")
|
@ -11,6 +11,7 @@
|
|||||||
#include "SPODELd.h"
|
#include "SPODELd.h"
|
||||||
#include "AODELd.h"
|
#include "AODELd.h"
|
||||||
#include "BoostAODE.h"
|
#include "BoostAODE.h"
|
||||||
|
#include "STree.h"
|
||||||
namespace platform {
|
namespace platform {
|
||||||
class Models {
|
class Models {
|
||||||
private:
|
private:
|
||||||
|
@ -18,4 +18,6 @@ static platform::Registrar registrarALD("AODELd",
|
|||||||
[](void) -> bayesnet::BaseClassifier* { return new bayesnet::AODELd();});
|
[](void) -> bayesnet::BaseClassifier* { return new bayesnet::AODELd();});
|
||||||
static platform::Registrar registrarBA("BoostAODE",
|
static platform::Registrar registrarBA("BoostAODE",
|
||||||
[](void) -> bayesnet::BaseClassifier* { return new bayesnet::BoostAODE();});
|
[](void) -> bayesnet::BaseClassifier* { return new bayesnet::BoostAODE();});
|
||||||
|
static pywrap::Registrar registrarSt("STree",
|
||||||
|
[](void) -> bayesnet::BaseClassifier* { return new pywrap::STree();});
|
||||||
#endif
|
#endif
|
@ -1,5 +1,6 @@
|
|||||||
include_directories(${PyWrap_SOURCE_DIR}/lib/Files)
|
include_directories(${BayesNet_SOURCE_DIR}/lib/Files)
|
||||||
include_directories(${PyWrap_SOURCE_DIR}/lib/json/include)
|
include_directories(${BayesNet_SOURCE_DIR}/lib/json/include)
|
||||||
|
include_directories(${BayesNet_SOURCE_DIR}/src/BayesNet)
|
||||||
include_directories(${Python3_INCLUDE_DIRS})
|
include_directories(${Python3_INCLUDE_DIRS})
|
||||||
include_directories(${TORCH_INCLUDE_DIRS})
|
include_directories(${TORCH_INCLUDE_DIRS})
|
||||||
|
|
||||||
|
@ -1,23 +1,20 @@
|
|||||||
#ifndef CLASSIFIER_H
|
#ifndef CLASSIFIER_H
|
||||||
#define CLASSIFIER_H
|
#define CLASSIFIER_H
|
||||||
#include <torch/torch.h>
|
#include <torch/torch.h>
|
||||||
|
#include "BaseClassifier.h"
|
||||||
#include <nlohmann/json.hpp>
|
#include <nlohmann/json.hpp>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <map>
|
#include <map>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
namespace pywrap {
|
namespace pywrap {
|
||||||
class Classifier {
|
class Classifier : bayesnet::BaseClassifier {
|
||||||
public:
|
public:
|
||||||
Classifier() = default;
|
Classifier() = default;
|
||||||
virtual ~Classifier() = default;
|
virtual ~Classifier() = default;
|
||||||
virtual Classifier& fit(torch::Tensor& X, torch::Tensor& y, const std::vector<std::string>& features, const std::string& className, std::map<std::string, std::vector<int>>& states) = 0;
|
|
||||||
virtual Classifier& fit(torch::Tensor& X, torch::Tensor& y) = 0;
|
virtual Classifier& fit(torch::Tensor& X, torch::Tensor& y) = 0;
|
||||||
virtual torch::Tensor predict(torch::Tensor& X) = 0;
|
|
||||||
virtual double score(torch::Tensor& X, torch::Tensor& y) = 0;
|
|
||||||
virtual std::string version() = 0;
|
virtual std::string version() = 0;
|
||||||
virtual std::string sklearnVersion() = 0;
|
virtual std::string sklearnVersion() = 0;
|
||||||
virtual void setHyperparameters(const nlohmann::json& hyperparameters) = 0;
|
|
||||||
protected:
|
protected:
|
||||||
virtual void checkHyperparameters(const std::vector<std::string>& validKeys, const nlohmann::json& hyperparameters) = 0;
|
virtual void checkHyperparameters(const std::vector<std::string>& validKeys, const nlohmann::json& hyperparameters) = 0;
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user