Begin conan integration
This commit is contained in:
@@ -2,12 +2,10 @@ include_directories(
|
||||
## Libs
|
||||
${Python3_INCLUDE_DIRS}
|
||||
${MPI_CXX_INCLUDE_DIRS}
|
||||
${TORCH_INCLUDE_DIRS}
|
||||
${CMAKE_BINARY_DIR}/configured_files/include
|
||||
${PyClassifiers_INCLUDE_DIRS}
|
||||
## Platform
|
||||
${Platform_SOURCE_DIR}/src
|
||||
${Platform_SOURCE_DIR}/results
|
||||
)
|
||||
|
||||
# b_best
|
||||
@@ -23,7 +21,7 @@ add_executable(
|
||||
experimental_clfs/DecisionTree.cpp
|
||||
experimental_clfs/AdaBoost.cpp
|
||||
)
|
||||
target_link_libraries(b_best Boost::boost "${PyClassifiers}" bayesnet::bayesnet fimdlp ${Python3_LIBRARIES} "${TORCH_LIBRARIES}" Boost::python Boost::numpy "${XLSXWRITER_LIB}")
|
||||
target_link_libraries(b_best Boost::boost "${PyClassifiers}" bayesnet::bayesnet argparse::argparse fimdlp::fimdlp ${Python3_LIBRARIES} torch::torch Boost::python Boost::numpy "${XLSXWRITER_LIB}")
|
||||
|
||||
# b_grid
|
||||
set(grid_sources GridSearch.cpp GridData.cpp GridExperiment.cpp GridBase.cpp )
|
||||
@@ -38,7 +36,7 @@ add_executable(b_grid commands/b_grid.cpp ${grid_sources}
|
||||
experimental_clfs/DecisionTree.cpp
|
||||
experimental_clfs/AdaBoost.cpp
|
||||
)
|
||||
target_link_libraries(b_grid ${MPI_CXX_LIBRARIES} "${PyClassifiers}" bayesnet::bayesnet fimdlp ${Python3_LIBRARIES} "${TORCH_LIBRARIES}" Boost::python Boost::numpy)
|
||||
target_link_libraries(b_grid ${MPI_CXX_LIBRARIES} "${PyClassifiers}" bayesnet::bayesnet argparse::argparse fimdlp::fimdlp ${Python3_LIBRARIES} torch::torch Boost::python Boost::numpy)
|
||||
|
||||
# b_list
|
||||
add_executable(b_list commands/b_list.cpp
|
||||
@@ -51,7 +49,7 @@ add_executable(b_list commands/b_list.cpp
|
||||
experimental_clfs/DecisionTree.cpp
|
||||
experimental_clfs/AdaBoost.cpp
|
||||
)
|
||||
target_link_libraries(b_list "${PyClassifiers}" bayesnet::bayesnet fimdlp ${Python3_LIBRARIES} "${TORCH_LIBRARIES}" Boost::python Boost::numpy "${XLSXWRITER_LIB}")
|
||||
target_link_libraries(b_list "${PyClassifiers}" bayesnet::bayesnet argparse::argparse fimdlp::fimdlp ${Python3_LIBRARIES} torch::torch Boost::python Boost::numpy "${XLSXWRITER_LIB}")
|
||||
|
||||
# b_main
|
||||
set(main_sources Experiment.cpp Models.cpp HyperParameters.cpp Scores.cpp ArgumentsExperiment.cpp)
|
||||
@@ -66,7 +64,7 @@ add_executable(b_main commands/b_main.cpp ${main_sources}
|
||||
experimental_clfs/DecisionTree.cpp
|
||||
experimental_clfs/AdaBoost.cpp
|
||||
)
|
||||
target_link_libraries(b_main PRIVATE nlohmann_json::nlohmann_json "${PyClassifiers}" bayesnet::bayesnet fimdlp ${Python3_LIBRARIES} "${TORCH_LIBRARIES}" Boost::python Boost::numpy)
|
||||
target_link_libraries(b_main PRIVATE nlohmann_json::nlohmann_json "${PyClassifiers}" bayesnet::bayesnet argparse::argparse fimdlp::fimdlp ${Python3_LIBRARIES} torch::torch Boost::python Boost::numpy)
|
||||
|
||||
# b_manage
|
||||
set(manage_sources ManageScreen.cpp OptionsMenu.cpp ResultsManager.cpp)
|
||||
@@ -78,7 +76,8 @@ add_executable(
|
||||
results/Result.cpp results/ResultsDataset.cpp results/ResultsDatasetConsole.cpp
|
||||
main/Scores.cpp
|
||||
)
|
||||
target_link_libraries(b_manage "${TORCH_LIBRARIES}" "${XLSXWRITER_LIB}" fimdlp bayesnet::bayesnet)
|
||||
target_link_libraries(b_manage torch::torch "${XLSXWRITER_LIB}" fimdlp::fimdlp bayesnet::bayesnet argparse::argparse)
|
||||
|
||||
# b_results
|
||||
add_executable(b_results commands/b_results.cpp)
|
||||
target_link_libraries(b_results torch::torch "${XLSXWRITER_LIB}" fimdlp::fimdlp bayesnet::bayesnet argparse::argparse)
|
||||
|
@@ -2,8 +2,8 @@
|
||||
#include <filesystem>
|
||||
#include <fstream>
|
||||
#include <vector>
|
||||
#include <argparse/argparse.hpp>
|
||||
#include <nlohmann/json.hpp>
|
||||
#include "nlohmann/json.hpp"
|
||||
#include "argparse/argparse.hpp"
|
||||
#include "common/Paths.h"
|
||||
#include "results/JsonValidator.h"
|
||||
#include "results/SchemaV1_0.h"
|
||||
|
@@ -1,4 +1,4 @@
|
||||
#include <ArffFiles/ArffFiles.hpp>
|
||||
#include <ArffFiles.hpp>
|
||||
#include <fstream>
|
||||
#include "Dataset.h"
|
||||
namespace platform {
|
||||
|
18
src/common/TensorUtils.h
Normal file
18
src/common/TensorUtils.h
Normal file
@@ -0,0 +1,18 @@
|
||||
#ifndef TENSOR_UTILS_H
|
||||
#define TENSOR_UTILS_H
|
||||
|
||||
#include <torch/torch.h>
|
||||
#include <vector>
|
||||
|
||||
namespace platform {
|
||||
template <typename T>
|
||||
std::vector<T> tensorToVector(const torch::Tensor& tensor)
|
||||
{
|
||||
torch::Tensor contig_tensor = tensor.contiguous();
|
||||
auto num_elements = contig_tensor.numel();
|
||||
const T* tensor_data = contig_tensor.data_ptr<T>();
|
||||
std::vector<T> result(tensor_data, tensor_data + num_elements);
|
||||
return result;
|
||||
}
|
||||
}
|
||||
#endif
|
@@ -6,17 +6,11 @@
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <algorithm>
|
||||
#include <torch/torch.h>
|
||||
#include <cstdlib>
|
||||
|
||||
extern char **environ;
|
||||
|
||||
namespace platform {
|
||||
template <typename T>
|
||||
std::vector<T> tensorToVector(const torch::Tensor& tensor)
|
||||
{
|
||||
torch::Tensor contig_tensor = tensor.contiguous();
|
||||
auto num_elements = contig_tensor.numel();
|
||||
const T* tensor_data = contig_tensor.data_ptr<T>();
|
||||
std::vector<T> result(tensor_data, tensor_data + num_elements);
|
||||
return result;
|
||||
}
|
||||
static std::string trim(const std::string& str)
|
||||
{
|
||||
std::string result = str;
|
||||
|
@@ -3,6 +3,7 @@
|
||||
#include <numeric>
|
||||
#include <utility>
|
||||
#include "RocAuc.h"
|
||||
#include "common/TensorUtils.h" // tensorToVector
|
||||
namespace platform {
|
||||
|
||||
double RocAuc::compute(const torch::Tensor& y_proba, const torch::Tensor& labels)
|
||||
|
@@ -1,6 +1,6 @@
|
||||
#include <sstream>
|
||||
#include "Scores.h"
|
||||
#include "common/Utils.h" // tensorToVector
|
||||
#include "common/TensorUtils.h" // tensorToVector
|
||||
#include "common/Colors.h"
|
||||
namespace platform {
|
||||
Scores::Scores(torch::Tensor& y_test, torch::Tensor& y_proba, int num_classes, std::vector<std::string> labels) : num_classes(num_classes), labels(labels), y_test(y_test), y_proba(y_proba)
|
||||
|
Reference in New Issue
Block a user