Update fimdlp version and change tests
This commit is contained in:
2
.vscode/launch.json
vendored
2
.vscode/launch.json
vendored
@@ -16,7 +16,7 @@
|
||||
"name": "test",
|
||||
"program": "${workspaceFolder}/build_Debug/tests/TestBayesNet",
|
||||
"args": [
|
||||
"[XBAODE]"
|
||||
"Test Dataset Loading"
|
||||
],
|
||||
"cwd": "${workspaceFolder}/build_Debug/tests"
|
||||
},
|
||||
|
2
Makefile
2
Makefile
@@ -21,8 +21,6 @@ sed_command_diagram = 's/Diagram"/Diagram" width="100%" height="100%" /g'
|
||||
CPUS := $(shell getconf _NPROCESSORS_ONLN 2>/dev/null \
|
||||
|| nproc --all 2>/dev/null \
|
||||
|| sysctl -n hw.ncpu)
|
||||
|
||||
# --- Your desired job count: CPUs – 7, but never less than 1 --------------
|
||||
JOBS := $(shell n=$(CPUS); [ $${n} -gt 7 ] && echo $$((n-7)) || echo 1)
|
||||
|
||||
# Colors for output
|
||||
|
@@ -60,7 +60,7 @@ class BayesNetConan(ConanFile):
|
||||
self.requires("libtorch/2.7.1")
|
||||
self.requires("nlohmann_json/3.11.3")
|
||||
self.requires("folding/1.1.2") # Custom package
|
||||
self.requires("fimdlp/2.1.1") # Custom package
|
||||
self.requires("fimdlp/2.1.2") # Custom package
|
||||
|
||||
def build_requirements(self):
|
||||
self.build_requires("cmake/[>=3.27]")
|
||||
|
@@ -16,7 +16,7 @@
|
||||
#include "TestUtils.h"
|
||||
|
||||
std::map<std::string, std::string> modules = {
|
||||
{ "mdlp", "2.1.1" },
|
||||
{ "mdlp", "2.1.2" },
|
||||
{ "Folding", "1.1.2" },
|
||||
{ "json", "3.11" },
|
||||
{ "ArffFiles", "1.2.1" }
|
||||
|
@@ -78,7 +78,7 @@ RawDatasets::RawDatasets(const std::string& file_name, bool discretize_, int num
|
||||
std::cout << to_string();
|
||||
}
|
||||
|
||||
map<std::string, int> RawDatasets::discretizeDataset(std::vector<mdlp::samples_t>& X, const std::vector<bool>& is_numeric)
|
||||
map<std::string, int> RawDatasets::discretizeDataset(std::vector<mdlp::samples_t>& X)
|
||||
{
|
||||
map<std::string, int> maxes;
|
||||
auto fimdlp = mdlp::CPPFImdlp();
|
||||
@@ -175,8 +175,9 @@ void RawDatasets::loadDataset(const std::string& name, bool class_last)
|
||||
className = handler.getClassName();
|
||||
auto attributes = handler.getAttributes();
|
||||
transform(attributes.begin(), attributes.end(), back_inserter(features), [](const auto& pair) { return pair.first; });
|
||||
is_numeric.clear();
|
||||
is_numeric.reserve(features.size());
|
||||
auto numericFeaturesIdx = catalog.at(name);
|
||||
std::vector<bool> is_numeric;
|
||||
if (numericFeaturesIdx.empty()) {
|
||||
// no numeric features
|
||||
is_numeric.assign(features.size(), false);
|
||||
@@ -195,7 +196,7 @@ void RawDatasets::loadDataset(const std::string& name, bool class_last)
|
||||
}
|
||||
}
|
||||
// Discretize Dataset
|
||||
auto maxValues = discretizeDataset(X, is_numeric);
|
||||
auto maxValues = discretizeDataset(X);
|
||||
maxValues[className] = *max_element(yv.begin(), yv.end()) + 1;
|
||||
if (discretize) {
|
||||
// discretize the tensor as well
|
||||
|
@@ -27,6 +27,7 @@ public:
|
||||
std::vector<double> weightsv;
|
||||
std::vector<string> features;
|
||||
std::string className;
|
||||
std::vector<bool> is_numeric; // indicates whether each feature is numeric
|
||||
map<std::string, std::vector<int>> states;
|
||||
//catalog holds the mapping between dataset names and their corresponding indices of numeric features (-1) means all are numeric
|
||||
//and an empty vector means none are numeric
|
||||
@@ -89,7 +90,7 @@ private:
|
||||
}
|
||||
return result;
|
||||
}
|
||||
map<std::string, int> discretizeDataset(std::vector<mdlp::samples_t>& X, const std::vector<bool>& is_numeric);
|
||||
map<std::string, int> discretizeDataset(std::vector<mdlp::samples_t>& X);
|
||||
void loadDataset(const std::string& name, bool class_last);
|
||||
map<std::string, std::vector<int>> loadCatalog();
|
||||
};
|
||||
|
Reference in New Issue
Block a user