Update sample to last library version
This commit is contained in:
7
Makefile
7
Makefile
@@ -6,7 +6,6 @@ f_release = build_release
|
|||||||
f_debug = build_debug
|
f_debug = build_debug
|
||||||
app_targets = b_best b_list b_main b_manage b_grid
|
app_targets = b_best b_list b_main b_manage b_grid
|
||||||
test_targets = unit_tests_platform
|
test_targets = unit_tests_platform
|
||||||
n_procs = -j 16
|
|
||||||
|
|
||||||
define ClearTests
|
define ClearTests
|
||||||
@for t in $(test_targets); do \
|
@for t in $(test_targets); do \
|
||||||
@@ -56,10 +55,10 @@ dependency: ## Create a dependency graph diagram of the project (build/dependenc
|
|||||||
cd $(f_debug) && cmake .. --graphviz=dependency.dot && dot -Tpng dependency.dot -o dependency.png
|
cd $(f_debug) && cmake .. --graphviz=dependency.dot && dot -Tpng dependency.dot -o dependency.png
|
||||||
|
|
||||||
buildd: ## Build the debug targets
|
buildd: ## Build the debug targets
|
||||||
cmake --build $(f_debug) -t $(app_targets) PlatformSample $(n_procs)
|
cmake --build $(f_debug) -t $(app_targets) PlatformSample --parallel
|
||||||
|
|
||||||
buildr: ## Build the release targets
|
buildr: ## Build the release targets
|
||||||
cmake --build $(f_release) -t $(app_targets) $(n_procs)
|
cmake --build $(f_release) -t $(app_targets) --parallel
|
||||||
|
|
||||||
clean: ## Clean the tests info
|
clean: ## Clean the tests info
|
||||||
@echo ">>> Cleaning Debug Platform tests...";
|
@echo ">>> Cleaning Debug Platform tests...";
|
||||||
@@ -87,7 +86,7 @@ opt = ""
|
|||||||
test: ## Run tests (opt="-s") to verbose output the tests, (opt="-c='Test Maximum Spanning Tree'") to run only that section
|
test: ## Run tests (opt="-s") to verbose output the tests, (opt="-c='Test Maximum Spanning Tree'") to run only that section
|
||||||
@echo ">>> Running Platform tests...";
|
@echo ">>> Running Platform tests...";
|
||||||
@$(MAKE) clean
|
@$(MAKE) clean
|
||||||
@cmake --build $(f_debug) -t $(test_targets) $(n_procs)
|
@cmake --build $(f_debug) -t $(test_targets) --parallel
|
||||||
@for t in $(test_targets); do \
|
@for t in $(test_targets); do \
|
||||||
if [ -f $(f_debug)/tests/$$t ]; then \
|
if [ -f $(f_debug)/tests/$$t ]; then \
|
||||||
cd $(f_debug)/tests ; \
|
cd $(f_debug)/tests ; \
|
||||||
|
@@ -3,7 +3,7 @@ include_directories(
|
|||||||
${Platform_SOURCE_DIR}/src/main
|
${Platform_SOURCE_DIR}/src/main
|
||||||
${Python3_INCLUDE_DIRS}
|
${Python3_INCLUDE_DIRS}
|
||||||
${Platform_SOURCE_DIR}/lib/Files
|
${Platform_SOURCE_DIR}/lib/Files
|
||||||
${Platform_SOURCE_DIR}/lib/mdlp
|
${Platform_SOURCE_DIR}/lib/mdlp/src
|
||||||
${Platform_SOURCE_DIR}/lib/argparse/include
|
${Platform_SOURCE_DIR}/lib/argparse/include
|
||||||
${Platform_SOURCE_DIR}/lib/folding
|
${Platform_SOURCE_DIR}/lib/folding
|
||||||
${Platform_SOURCE_DIR}/lib/json/include
|
${Platform_SOURCE_DIR}/lib/json/include
|
||||||
|
@@ -161,7 +161,8 @@ int main(int argc, char** argv)
|
|||||||
}
|
}
|
||||||
states[className] = std::vector<int>(maxes[className]);
|
states[className] = std::vector<int>(maxes[className]);
|
||||||
auto clf = platform::Models::instance()->create(model_name);
|
auto clf = platform::Models::instance()->create(model_name);
|
||||||
clf->fit(Xd, y, features, className, states);
|
bayesnet::Smoothing_t smoothing = bayesnet::Smoothing_t::ORIGINAL;
|
||||||
|
clf->fit(Xd, y, features, className, states, smoothing);
|
||||||
if (dump_cpt) {
|
if (dump_cpt) {
|
||||||
std::cout << "--- CPT Tables ---" << std::endl;
|
std::cout << "--- CPT Tables ---" << std::endl;
|
||||||
clf->dump_cpt();
|
clf->dump_cpt();
|
||||||
@@ -210,14 +211,14 @@ int main(int argc, char** argv)
|
|||||||
torch::Tensor ytraint = yt.index({ ttrain });
|
torch::Tensor ytraint = yt.index({ ttrain });
|
||||||
torch::Tensor Xtestt = torch::index_select(Xt, 1, ttest);
|
torch::Tensor Xtestt = torch::index_select(Xt, 1, ttest);
|
||||||
torch::Tensor ytestt = yt.index({ ttest });
|
torch::Tensor ytestt = yt.index({ ttest });
|
||||||
clf->fit(Xtraint, ytraint, features, className, states);
|
clf->fit(Xtraint, ytraint, features, className, states, smoothing);
|
||||||
auto temp = clf->predict(Xtraint);
|
auto temp = clf->predict(Xtraint);
|
||||||
score_train = clf->score(Xtraint, ytraint);
|
score_train = clf->score(Xtraint, ytraint);
|
||||||
score_test = clf->score(Xtestt, ytestt);
|
score_test = clf->score(Xtestt, ytestt);
|
||||||
} else {
|
} else {
|
||||||
auto [Xtrain, ytrain] = extract_indices(train, Xd, y);
|
auto [Xtrain, ytrain] = extract_indices(train, Xd, y);
|
||||||
auto [Xtest, ytest] = extract_indices(test, Xd, y);
|
auto [Xtest, ytest] = extract_indices(test, Xd, y);
|
||||||
clf->fit(Xtrain, ytrain, features, className, states);
|
clf->fit(Xtrain, ytrain, features, className, states, smoothing);
|
||||||
std::cout << "Nodes: " << clf->getNumberOfNodes() << std::endl;
|
std::cout << "Nodes: " << clf->getNumberOfNodes() << std::endl;
|
||||||
nodes += clf->getNumberOfNodes();
|
nodes += clf->getNumberOfNodes();
|
||||||
score_train = clf->score(Xtrain, ytrain);
|
score_train = clf->score(Xtrain, ytrain);
|
||||||
|
Reference in New Issue
Block a user