Create installation process

This commit is contained in:
Ricardo Montañana Gómez 2024-03-08 00:37:36 +01:00
parent 199ffc95d2
commit eba2095718
Signed by: rmontanana
GPG Key ID: 46064262FD9A7ADE
22 changed files with 45 additions and 35 deletions

View File

@ -30,6 +30,7 @@ SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pthread")
option(ENABLE_CLANG_TIDY "Enable to add clang tidy." OFF)
option(ENABLE_TESTING "Unit testing build" OFF)
option(CODE_COVERAGE "Collect coverage from test library" OFF)
option(INSTALL_GTEST "Enable installation of googletest." OFF)
# CMakes modules
# --------------
@ -76,3 +77,12 @@ if (ENABLE_TESTING)
include(CTest)
add_subdirectory(tests)
endif (ENABLE_TESTING)
# Installation
# ------------
install(TARGETS BayesNet
ARCHIVE DESTINATION lib
LIBRARY DESTINATION lib
CONFIGURATIONS Release)
install(DIRECTORY src/ DESTINATION include/bayesnet FILES_MATCHING CONFIGURATIONS Release PATTERN "*.h")
install(FILES ${CMAKE_BINARY_DIR}/configured_files/include/config.h DESTINATION include/bayesnet CONFIGURATIONS Release)

View File

@ -47,6 +47,11 @@ clean: ## Clean the tests info
$(call ClearTests)
@echo ">>> Done";
install: ## Install library
@echo ">>> Installing BayesNet...";
@cmake --install $(f_release)
@echo ">>> Done";
debug: ## Build a debug version of the project
@echo ">>> Building Debug BayesNet...";
@if [ -d ./$(f_debug) ]; then rm -rf ./$(f_debug); fi

@ -1 +1 @@
Subproject commit ed6ac8a629f9a4206575be784c1e340da2a94855
Subproject commit 8ac8190e494a381072c89f5e161b92a08d98b37b

View File

@ -1,6 +1,6 @@
#include "ArffFiles.h"
#include "CPPFImdlp.h"
#include "BoostAODE.h"
#include <ArffFiles.h>
#include <CPPFImdlp.h>
#include "ensembles/BoostAODE.h"
std::vector<mdlp::labels_t> discretizeDataset(std::vector<mdlp::samples_t>& X, mdlp::labels_t& y)
{

View File

@ -4,15 +4,10 @@ include_directories(
${BayesNet_SOURCE_DIR}/lib/folding
${BayesNet_SOURCE_DIR}/lib/json/include
${BayesNet_SOURCE_DIR}/src
${BayesNet_SOURCE_DIR}/src/feature_selection
${BayesNet_SOURCE_DIR}/src/bayesian_network
${BayesNet_SOURCE_DIR}/src/classifiers
${BayesNet_SOURCE_DIR}/src/ensembles
${BayesNet_SOURCE_DIR}/src/utils
${CMAKE_BINARY_DIR}/configured_files/include
)
file(GLOB_RECURSE Sources "*.cc")
add_library(BayesNet ${Sources})
target_link_libraries(BayesNet mdlp "${TORCH_LIBRARIES}")
target_link_libraries(BayesNet mdlp "${TORCH_LIBRARIES}")

View File

@ -1,7 +1,7 @@
#include <thread>
#include <mutex>
#include "Network.h"
#include "bayesnetUtils.h"
#include "utils/bayesnetUtils.h"
namespace bayesnet {
Network::Network() : features(std::vector<std::string>()), className(""), classNumStates(0), fitted(false), laplaceSmoothing(0) {}
Network::Network(float maxT) : features(std::vector<std::string>()), className(""), classNumStates(0), maxThreads(maxT), fitted(false), laplaceSmoothing(0) {}

View File

@ -1,5 +1,5 @@
#include "Classifier.h"
#include "bayesnetUtils.h"
#include "utils/bayesnetUtils.h"
namespace bayesnet {
Classifier::Classifier(Network model) : model(model), m(0), n(0), metrics(Metrics()), fitted(false) {}

View File

@ -2,8 +2,8 @@
#define CLASSIFIER_H
#include <torch/torch.h>
#include "BaseClassifier.h"
#include "Network.h"
#include "BayesMetrics.h"
#include "bayesian_network/Network.h"
#include "utils/BayesMetrics.h"
namespace bayesnet {
class Classifier : public BaseClassifier {

View File

@ -2,7 +2,7 @@
#define KDB_H
#include <torch/torch.h>
#include "Classifier.h"
#include "bayesnetUtils.h"
#include "utils/bayesnetUtils.h"
namespace bayesnet {
class KDB : public Classifier {
private:

View File

@ -3,7 +3,7 @@
#include <string>
#include <map>
#include <torch/torch.h>
#include "Network.h"
#include "bayesian_network/Network.h"
#include "CPPFImdlp.h"
#include "Classifier.h"

View File

@ -1,7 +1,7 @@
#ifndef AODE_H
#define AODE_H
#include "Ensemble.h"
#include "SPODE.h"
#include "classifiers/SPODE.h"
namespace bayesnet {
class AODE : public Ensemble {
public:

View File

@ -1,8 +1,8 @@
#ifndef AODELD_H
#define AODELD_H
#include "Ensemble.h"
#include "Proposal.h"
#include "SPODELd.h"
#include "classifiers/Proposal.h"
#include "classifiers/SPODELd.h"
namespace bayesnet {
class AODELd : public Ensemble, public Proposal {

View File

@ -2,11 +2,11 @@
#include <functional>
#include <limits.h>
#include <tuple>
#include <folding.hpp>
#include "BoostAODE.h"
#include "CFS.h"
#include "FCBF.h"
#include "IWSS.h"
#include "folding.hpp"
#include "feature_selection/CFS.h"
#include "feature_selection/FCBF.h"
#include "feature_selection/IWSS.h"
namespace bayesnet {
struct {

View File

@ -2,8 +2,8 @@
#define BOOSTAODE_H
#include "Ensemble.h"
#include <map>
#include "SPODE.h"
#include "FeatureSelect.h"
#include "classifiers/SPODE.h"
#include "feature_selection/FeatureSelect.h"
namespace bayesnet {
class BoostAODE : public Ensemble {
public:

View File

@ -1,9 +1,9 @@
#ifndef ENSEMBLE_H
#define ENSEMBLE_H
#include <torch/torch.h>
#include "Classifier.h"
#include "BayesMetrics.h"
#include "bayesnetUtils.h"
#include "classifiers/Classifier.h"
#include "utils/BayesMetrics.h"
#include "utils/bayesnetUtils.h"
namespace bayesnet {
class Ensemble : public Classifier {

View File

@ -1,6 +1,6 @@
#include "CFS.h"
#include <limits>
#include "bayesnetUtils.h"
#include "utils/bayesnetUtils.h"
namespace bayesnet {
void CFS::fit()
{

View File

@ -2,7 +2,7 @@
#define CFS_H
#include <torch/torch.h>
#include <vector>
#include "FeatureSelect.h"
#include "feature_selection/FeatureSelect.h"
namespace bayesnet {
class CFS : public FeatureSelect {
public:

View File

@ -1,4 +1,4 @@
#include "bayesnetUtils.h"
#include "utils/bayesnetUtils.h"
#include "FCBF.h"
namespace bayesnet {

View File

@ -2,7 +2,7 @@
#define FCBF_H
#include <torch/torch.h>
#include <vector>
#include "FeatureSelect.h"
#include "feature_selection/FeatureSelect.h"
namespace bayesnet {
class FCBF : public FeatureSelect {
public:

View File

@ -1,6 +1,6 @@
#include "FeatureSelect.h"
#include <limits>
#include "bayesnetUtils.h"
#include "utils/bayesnetUtils.h"
namespace bayesnet {
FeatureSelect::FeatureSelect(const torch::Tensor& samples, const std::vector<std::string>& features, const std::string& className, const int maxFeatures, const int classNumStates, const torch::Tensor& weights) :
Metrics(samples, features, className, classNumStates), maxFeatures(maxFeatures == 0 ? samples.size(0) - 1 : maxFeatures), weights(weights)

View File

@ -2,7 +2,7 @@
#define FEATURE_SELECT_H
#include <torch/torch.h>
#include <vector>
#include "BayesMetrics.h"
#include "utils/BayesMetrics.h"
namespace bayesnet {
class FeatureSelect : public Metrics {
public:

View File

@ -1,6 +1,6 @@
#include "IWSS.h"
#include <limits>
#include "bayesnetUtils.h"
#include "utils/bayesnetUtils.h"
namespace bayesnet {
IWSS::IWSS(const torch::Tensor& samples, const std::vector<std::string>& features, const std::string& className, const int maxFeatures, const int classNumStates, const torch::Tensor& weights, const double threshold) :
FeatureSelect(samples, features, className, maxFeatures, classNumStates, weights), threshold(threshold)