diff --git a/.gitignore b/.gitignore index a1c4460..fa86698 100644 --- a/.gitignore +++ b/.gitignore @@ -40,4 +40,8 @@ puml/** .vscode/settings.json sample/build **/.DS_Store +docs/manual +docs/man3 +docs/man +docs/Doxyfile diff --git a/.gitmodules b/.gitmodules index 90a50b3..e0ca40e 100644 --- a/.gitmodules +++ b/.gitmodules @@ -18,3 +18,6 @@ url = https://github.com/catchorg/Catch2.git main = main update = merge +[submodule "tests/lib/Files"] + path = tests/lib/Files + url = https://github.com/rmontanana/ArffFiles diff --git a/CHANGELOG.md b/CHANGELOG.md index 016627c..585439a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,6 +17,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - A2DE & SPnDE tests. - Add tests to reach 99% of coverage. - Add tests to check the correct version of the mdlp, folding and json libraries. +- Library documentation generated with Doxygen. +- Link to documentation in the README.md. ### Internal @@ -27,6 +29,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Refactor Coverage Report generation. - Add devcontainer to work on apple silicon. - Change build cmake folder names to Debug & Release. +- Add a Makefile target (doc) to generate the documentation. +- Add a Makefile target (doc-install) to install the documentation. ## [1.0.5] 2024-04-20 diff --git a/CMakeLists.txt b/CMakeLists.txt index 67cee94..eed7062 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -25,8 +25,11 @@ set(CMAKE_CXX_EXTENSIONS OFF) set(CMAKE_EXPORT_COMPILE_COMMANDS ON) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${TORCH_CXX_FLAGS}") SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pthread") -set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -fprofile-arcs -ftest-coverage -fno-elide-constructors -fno-default-inline") +set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -fprofile-arcs -ftest-coverage -fno-elide-constructors") set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -O3") +if (NOT ${CMAKE_SYSTEM_NAME} MATCHES "Darwin") + set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -fno-default-inline") +endif() # Options # ------- @@ -63,7 +66,6 @@ endif (ENABLE_CLANG_TIDY) # include(FetchContent) add_git_submodule("lib/json") add_git_submodule("lib/mdlp") -add_subdirectory("lib/Files") # Subdirectories # -------------- @@ -86,4 +88,15 @@ install(TARGETS BayesNet LIBRARY DESTINATION lib CONFIGURATIONS Release) install(DIRECTORY bayesnet/ DESTINATION include/bayesnet FILES_MATCHING CONFIGURATIONS Release PATTERN "*.h") -install(FILES ${CMAKE_BINARY_DIR}/configured_files/include/bayesnet/config.h DESTINATION include/bayesnet CONFIGURATIONS Release) \ No newline at end of file +install(FILES ${CMAKE_BINARY_DIR}/configured_files/include/bayesnet/config.h DESTINATION include/bayesnet CONFIGURATIONS Release) + +# Documentation +# ------------- +find_package(Doxygen) +set(DOC_DIR ${CMAKE_CURRENT_SOURCE_DIR}/docs) +set(doxyfile_in ${DOC_DIR}/Doxyfile.in) +set(doxyfile ${DOC_DIR}/Doxyfile) +configure_file(${doxyfile_in} ${doxyfile} @ONLY) +doxygen_add_docs(doxygen + WORKING_DIRECTORY ${DOC_DIR} + CONFIG_FILE ${doxyfile}) diff --git a/Makefile b/Makefile index 729db2f..3515580 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,6 @@ SHELL := /bin/bash .DEFAULT_GOAL := help -.PHONY: viewcoverage coverage setup help install uninstall diagrams buildr buildd test clean debug release sample updatebadge +.PHONY: viewcoverage coverage setup help install uninstall diagrams buildr buildd test clean debug release sample updatebadge doc doc-install f_release = build_Release f_debug = build_Debug @@ -13,6 +13,11 @@ lcov = lcov genhtml = genhtml dot = dot n_procs = -j 16 +docsrcdir = docs/manual +mansrcdir = docs/man3 +mandestdir = /usr/local/share/man +sed_command_link = 's/e">LCOV -/e">Back to manual<\/a> LCOV -/g' +sed_command_diagram = 's/Diagram"/Diagram" width="100%" height="100%" /g' define ClearTests @for t in $(test_targets); do \ @@ -130,9 +135,14 @@ coverage: ## Run tests and generate coverage report (build/index.html) @echo ">>> Done"; viewcoverage: ## View the html coverage report - @which $(genhtml) || (echo ">>> Please install lcov (genhtml not found)"; exit 1) - @$(genhtml) $(f_debug)/tests/coverage.info --demangle-cpp --output-directory html --title "BayesNet Coverage Report" -s -k -f --legend >/dev/null 2>&1; - @xdg-open html/index.html || open html/index.html 2>/dev/null + @which $(genhtml) >/dev/null || (echo ">>> Please install lcov (genhtml not found)"; exit 1) + @if [ ! -d $(docsrcdir)/coverage ]; then mkdir -p $(docsrcdir)/coverage; fi + @if [ ! -f $(f_debug)/tests/coverage.info ]; then \ + echo ">>> No coverage.info file found. Run make coverage first!"; \ + exit 1; \ + fi + @$(genhtml) $(f_debug)/tests/coverage.info --demangle-cpp --output-directory $(docsrcdir)/coverage --title "BayesNet Coverage Report" -s -k -f --legend >/dev/null 2>&1; + @xdg-open $(docsrcdir)/coverage/index.html || open $(docsrcdir)/coverage/index.html 2>/dev/null @echo ">>> Done"; updatebadge: ## Update the coverage badge in README.md @@ -145,6 +155,34 @@ updatebadge: ## Update the coverage badge in README.md @env python update_coverage.py $(f_debug)/tests @echo ">>> Done"; +doc: ## Generate documentation + @echo ">>> Generating documentation..." + @cmake --build $(f_release) -t doxygen + @cp -rp diagrams $(docsrcdir) + @ + @if [ "$(shell uname)" = "Darwin" ]; then \ + sed -i "" $(sed_command_link) $(docsrcdir)/coverage/index.html ; \ + sed -i "" $(sed_command_diagram) $(docsrcdir)/index.html ; \ + else \ + sed -i $(sed_command_link) $(docsrcdir)/coverage/index.html ; \ + sed -i $(sed_command_diagram) $(docsrcdir)/index.html ; \ + fi + @echo ">>> Done"; + +docdir = "" +doc-install: ## Install documentation + @echo ">>> Installing documentation..." + @if [ "$(docdir)" = "" ]; then \ + echo "docdir parameter has to be set when calling doc-install"; \ + exit 1; \ + fi + @if [ ! -d $(docdir) ]; then \ + @$(MAKE) doc; \ + fi + @cp -rp $(docsrcdir)/* $(docdir) + @sudo cp -rp $(mansrcdir) $(mandestdir) + @echo ">>> Done"; + help: ## Show help message @IFS=$$'\n' ; \ help_lines=(`fgrep -h "##" $(MAKEFILE_LIST) | fgrep -v fgrep | sed -e 's/\\$$//' | sed -e 's/##/:/'`); \ diff --git a/README.md b/README.md index 861499b..e444046 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,7 @@ [![Security Rating](https://sonarcloud.io/api/project_badges/measure?project=rmontanana_BayesNet&metric=security_rating)](https://sonarcloud.io/summary/new_code?id=rmontanana_BayesNet) [![Reliability Rating](https://sonarcloud.io/api/project_badges/measure?project=rmontanana_BayesNet&metric=reliability_rating)](https://sonarcloud.io/summary/new_code?id=rmontanana_BayesNet) ![Gitea Last Commit](https://img.shields.io/gitea/last-commit/rmontanana/bayesnet?gitea_url=https://gitea.rmontanana.es:3000&logo=gitea) -[![Coverage Badge](https://img.shields.io/badge/Coverage-99,0%25-green)](html/index.html) +[![Coverage Badge](https://img.shields.io/badge/Coverage-97,3%25-green)](html/index.html) Bayesian Network Classifiers using libtorch from scratch @@ -67,10 +67,14 @@ make sample fname=tests/data/glass.arff #### - SPODE +#### - SPnDE + #### - AODE #### - [BoostAODE](docs/BoostAODE.md) +#### - BoostA2DE + ### With Local Discretization #### - TANLd @@ -81,6 +85,12 @@ make sample fname=tests/data/glass.arff #### - AODELd +## Documentation + +### [Manual](https://rmontanana.github.io/bayesnet/) + +### [Coverage report](https://rmontanana.github.io/bayesnet/coverage/index.html) + ## Diagrams ### UML Class Diagram @@ -90,7 +100,3 @@ make sample fname=tests/data/glass.arff ### Dependency Diagram ![BayesNet Dependency Diagram](diagrams/dependency.svg) - -## Coverage report - -### [Coverage report](docs/coverage.pdf) diff --git a/bayesnet/CMakeLists.txt b/bayesnet/CMakeLists.txt index c1aebe9..2aef26a 100644 --- a/bayesnet/CMakeLists.txt +++ b/bayesnet/CMakeLists.txt @@ -1,6 +1,5 @@ include_directories( ${BayesNet_SOURCE_DIR}/lib/mdlp - ${BayesNet_SOURCE_DIR}/lib/Files ${BayesNet_SOURCE_DIR}/lib/folding ${BayesNet_SOURCE_DIR}/lib/json/include ${BayesNet_SOURCE_DIR} diff --git a/bayesnet/classifiers/Proposal.cc b/bayesnet/classifiers/Proposal.cc index 3ee9cda..2dfadb7 100644 --- a/bayesnet/classifiers/Proposal.cc +++ b/bayesnet/classifiers/Proposal.cc @@ -4,7 +4,6 @@ // SPDX-License-Identifier: MIT // *************************************************************** -#include #include "Proposal.h" namespace bayesnet { @@ -54,8 +53,7 @@ namespace bayesnet { yJoinParents[i] += to_string(pDataset.index({ idx, i }).item()); } } - auto arff = ArffFiles(); - auto yxv = arff.factorize(yJoinParents); + auto yxv = factorize(yJoinParents); auto xvf_ptr = Xf.index({ index }).data_ptr(); auto xvf = std::vector(xvf_ptr, xvf_ptr + Xf.size(1)); discretizers[feature]->fit(xvf, yxv); @@ -113,4 +111,19 @@ namespace bayesnet { } return Xtd; } + std::vector Proposal::factorize(const std::vector& labels_t) + { + std::vector yy; + yy.reserve(labels_t.size()); + std::map labelMap; + int i = 0; + for (const std::string& label : labels_t) { + if (labelMap.find(label) == labelMap.end()) { + labelMap[label] = i++; + bool allDigits = std::all_of(label.begin(), label.end(), ::isdigit); + } + yy.push_back(labelMap[label]); + } + return yy; + } } \ No newline at end of file diff --git a/bayesnet/classifiers/Proposal.h b/bayesnet/classifiers/Proposal.h index 6e7c351..dd011d8 100644 --- a/bayesnet/classifiers/Proposal.h +++ b/bayesnet/classifiers/Proposal.h @@ -27,6 +27,7 @@ namespace bayesnet { torch::Tensor y; // y discrete nx1 tensor map discretizers; private: + std::vector factorize(const std::vector& labels_t); torch::Tensor& pDataset; // (n+1)xm tensor std::vector& pFeatures; std::string& pClassName; diff --git a/bayesnet/ensembles/Boost.cc b/bayesnet/ensembles/Boost.cc new file mode 100644 index 0000000..a582811 --- /dev/null +++ b/bayesnet/ensembles/Boost.cc @@ -0,0 +1,246 @@ +// *************************************************************** +// SPDX-FileCopyrightText: Copyright 2024 Ricardo Montañana Gómez +// SPDX-FileType: SOURCE +// SPDX-License-Identifier: MIT +// *************************************************************** +#include +#include "bayesnet/feature_selection/CFS.h" +#include "bayesnet/feature_selection/FCBF.h" +#include "bayesnet/feature_selection/IWSS.h" +#include "Boost.h" + +namespace bayesnet { + Boost::Boost(bool predict_voting) : Ensemble(predict_voting) + { + validHyperparameters = { "order", "convergence", "convergence_best", "bisection", "threshold", "maxTolerance", + "predict_voting", "select_features", "block_update" }; + } + void Boost::setHyperparameters(const nlohmann::json& hyperparameters_) + { + auto hyperparameters = hyperparameters_; + if (hyperparameters.contains("order")) { + std::vector algos = { Orders.ASC, Orders.DESC, Orders.RAND }; + order_algorithm = hyperparameters["order"]; + if (std::find(algos.begin(), algos.end(), order_algorithm) == algos.end()) { + throw std::invalid_argument("Invalid order algorithm, valid values [" + Orders.ASC + ", " + Orders.DESC + ", " + Orders.RAND + "]"); + } + hyperparameters.erase("order"); + } + if (hyperparameters.contains("convergence")) { + convergence = hyperparameters["convergence"]; + hyperparameters.erase("convergence"); + } + if (hyperparameters.contains("convergence_best")) { + convergence_best = hyperparameters["convergence_best"]; + hyperparameters.erase("convergence_best"); + } + if (hyperparameters.contains("bisection")) { + bisection = hyperparameters["bisection"]; + hyperparameters.erase("bisection"); + } + if (hyperparameters.contains("threshold")) { + threshold = hyperparameters["threshold"]; + hyperparameters.erase("threshold"); + } + if (hyperparameters.contains("maxTolerance")) { + maxTolerance = hyperparameters["maxTolerance"]; + if (maxTolerance < 1 || maxTolerance > 4) + throw std::invalid_argument("Invalid maxTolerance value, must be greater in [1, 4]"); + hyperparameters.erase("maxTolerance"); + } + if (hyperparameters.contains("predict_voting")) { + predict_voting = hyperparameters["predict_voting"]; + hyperparameters.erase("predict_voting"); + } + if (hyperparameters.contains("select_features")) { + auto selectedAlgorithm = hyperparameters["select_features"]; + std::vector algos = { SelectFeatures.IWSS, SelectFeatures.CFS, SelectFeatures.FCBF }; + selectFeatures = true; + select_features_algorithm = selectedAlgorithm; + if (std::find(algos.begin(), algos.end(), selectedAlgorithm) == algos.end()) { + throw std::invalid_argument("Invalid selectFeatures value, valid values [" + SelectFeatures.IWSS + ", " + SelectFeatures.CFS + ", " + SelectFeatures.FCBF + "]"); + } + hyperparameters.erase("select_features"); + } + if (hyperparameters.contains("block_update")) { + block_update = hyperparameters["block_update"]; + hyperparameters.erase("block_update"); + } + Classifier::setHyperparameters(hyperparameters); + } + void Boost::buildModel(const torch::Tensor& weights) + { + // Models shall be built in trainModel + models.clear(); + significanceModels.clear(); + n_models = 0; + // Prepare the validation dataset + auto y_ = dataset.index({ -1, "..." }); + if (convergence) { + // Prepare train & validation sets from train data + auto fold = folding::StratifiedKFold(5, y_, 271); + auto [train, test] = fold.getFold(0); + auto train_t = torch::tensor(train); + auto test_t = torch::tensor(test); + // Get train and validation sets + X_train = dataset.index({ torch::indexing::Slice(0, dataset.size(0) - 1), train_t }); + y_train = dataset.index({ -1, train_t }); + X_test = dataset.index({ torch::indexing::Slice(0, dataset.size(0) - 1), test_t }); + y_test = dataset.index({ -1, test_t }); + dataset = X_train; + m = X_train.size(1); + auto n_classes = states.at(className).size(); + // Build dataset with train data + buildDataset(y_train); + metrics = Metrics(dataset, features, className, n_classes); + } else { + // Use all data to train + X_train = dataset.index({ torch::indexing::Slice(0, dataset.size(0) - 1), "..." }); + y_train = y_; + } + } + std::vector Boost::featureSelection(torch::Tensor& weights_) + { + int maxFeatures = 0; + if (select_features_algorithm == SelectFeatures.CFS) { + featureSelector = new CFS(dataset, features, className, maxFeatures, states.at(className).size(), weights_); + } else if (select_features_algorithm == SelectFeatures.IWSS) { + if (threshold < 0 || threshold >0.5) { + throw std::invalid_argument("Invalid threshold value for " + SelectFeatures.IWSS + " [0, 0.5]"); + } + featureSelector = new IWSS(dataset, features, className, maxFeatures, states.at(className).size(), weights_, threshold); + } else if (select_features_algorithm == SelectFeatures.FCBF) { + if (threshold < 1e-7 || threshold > 1) { + throw std::invalid_argument("Invalid threshold value for " + SelectFeatures.FCBF + " [1e-7, 1]"); + } + featureSelector = new FCBF(dataset, features, className, maxFeatures, states.at(className).size(), weights_, threshold); + } + featureSelector->fit(); + auto featuresUsed = featureSelector->getFeatures(); + delete featureSelector; + return featuresUsed; + } + std::tuple Boost::update_weights(torch::Tensor& ytrain, torch::Tensor& ypred, torch::Tensor& weights) + { + bool terminate = false; + double alpha_t = 0; + auto mask_wrong = ypred != ytrain; + auto mask_right = ypred == ytrain; + auto masked_weights = weights * mask_wrong.to(weights.dtype()); + double epsilon_t = masked_weights.sum().item(); + if (epsilon_t > 0.5) { + // Inverse the weights policy (plot ln(wt)) + // "In each round of AdaBoost, there is a sanity check to ensure that the current base + // learner is better than random guess" (Zhi-Hua Zhou, 2012) + terminate = true; + } else { + double wt = (1 - epsilon_t) / epsilon_t; + alpha_t = epsilon_t == 0 ? 1 : 0.5 * log(wt); + // Step 3.2: Update weights for next classifier + // Step 3.2.1: Update weights of wrong samples + weights += mask_wrong.to(weights.dtype()) * exp(alpha_t) * weights; + // Step 3.2.2: Update weights of right samples + weights += mask_right.to(weights.dtype()) * exp(-alpha_t) * weights; + // Step 3.3: Normalise the weights + double totalWeights = torch::sum(weights).item(); + weights = weights / totalWeights; + } + return { weights, alpha_t, terminate }; + } + std::tuple Boost::update_weights_block(int k, torch::Tensor& ytrain, torch::Tensor& weights) + { + /* Update Block algorithm + k = # of models in block + n_models = # of models in ensemble to make predictions + n_models_bak = # models saved + models = vector of models to make predictions + models_bak = models not used to make predictions + significances_bak = backup of significances vector + + Case list + A) k = 1, n_models = 1 => n = 0 , n_models = n + k + B) k = 1, n_models = n + 1 => n_models = n + k + C) k > 1, n_models = k + 1 => n= 1, n_models = n + k + D) k > 1, n_models = k => n = 0, n_models = n + k + E) k > 1, n_models = k + n => n_models = n + k + + A, D) n=0, k > 0, n_models == k + 1. n_models_bak <- n_models + 2. significances_bak <- significances + 3. significances = vector(k, 1) + 4. Don’t move any classifiers out of models + 5. n_models <- k + 6. Make prediction, compute alpha, update weights + 7. Don’t restore any classifiers to models + 8. significances <- significances_bak + 9. Update last k significances + 10. n_models <- n_models_bak + + B, C, E) n > 0, k > 0, n_models == n + k + 1. n_models_bak <- n_models + 2. significances_bak <- significances + 3. significances = vector(k, 1) + 4. Move first n classifiers to models_bak + 5. n_models <- k + 6. Make prediction, compute alpha, update weights + 7. Insert classifiers in models_bak to be the first n models + 8. significances <- significances_bak + 9. Update last k significances + 10. n_models <- n_models_bak + */ + // + // Make predict with only the last k models + // + std::unique_ptr model; + std::vector> models_bak; + // 1. n_models_bak <- n_models 2. significances_bak <- significances + auto significance_bak = significanceModels; + auto n_models_bak = n_models; + // 3. significances = vector(k, 1) + significanceModels = std::vector(k, 1.0); + // 4. Move first n classifiers to models_bak + // backup the first n_models - k models (if n_models == k, don't backup any) + for (int i = 0; i < n_models - k; ++i) { + model = std::move(models[0]); + models.erase(models.begin()); + models_bak.push_back(std::move(model)); + } + assert(models.size() == k); + // 5. n_models <- k + n_models = k; + // 6. Make prediction, compute alpha, update weights + auto ypred = predict(X_train); + // + // Update weights + // + double alpha_t; + bool terminate; + std::tie(weights, alpha_t, terminate) = update_weights(y_train, ypred, weights); + // + // Restore the models if needed + // + // 7. Insert classifiers in models_bak to be the first n models + // if n_models_bak == k, don't restore any, because none of them were moved + if (k != n_models_bak) { + // Insert in the same order as they were extracted + int bak_size = models_bak.size(); + for (int i = 0; i < bak_size; ++i) { + model = std::move(models_bak[bak_size - 1 - i]); + models_bak.erase(models_bak.end() - 1); + models.insert(models.begin(), std::move(model)); + } + } + // 8. significances <- significances_bak + significanceModels = significance_bak; + // + // Update the significance of the last k models + // + // 9. Update last k significances + for (int i = 0; i < k; ++i) { + significanceModels[n_models_bak - k + i] = alpha_t; + } + // 10. n_models <- n_models_bak + n_models = n_models_bak; + return { weights, alpha_t, terminate }; + } +} \ No newline at end of file diff --git a/bayesnet/ensembles/Boost.h b/bayesnet/ensembles/Boost.h new file mode 100644 index 0000000..2594bcb --- /dev/null +++ b/bayesnet/ensembles/Boost.h @@ -0,0 +1,52 @@ +// *************************************************************** +// SPDX-FileCopyrightText: Copyright 2024 Ricardo Montañana Gómez +// SPDX-FileType: SOURCE +// SPDX-License-Identifier: MIT +// *************************************************************** + +#ifndef BOOST_H +#define BOOST_H +#include +#include +#include +#include +#include +#include "Ensemble.h" +#include "bayesnet/feature_selection/FeatureSelect.h" +namespace bayesnet { + const struct { + std::string CFS = "CFS"; + std::string FCBF = "FCBF"; + std::string IWSS = "IWSS"; + }SelectFeatures; + const struct { + std::string ASC = "asc"; + std::string DESC = "desc"; + std::string RAND = "rand"; + }Orders; + class Boost : public Ensemble { + public: + explicit Boost(bool predict_voting = false); + virtual ~Boost() = default; + void setHyperparameters(const nlohmann::json& hyperparameters_) override; + protected: + std::vector featureSelection(torch::Tensor& weights_); + void buildModel(const torch::Tensor& weights) override; + std::tuple update_weights(torch::Tensor& ytrain, torch::Tensor& ypred, torch::Tensor& weights); + std::tuple update_weights_block(int k, torch::Tensor& ytrain, torch::Tensor& weights); + torch::Tensor X_train, y_train, X_test, y_test; + // Hyperparameters + bool bisection = true; // if true, use bisection stratety to add k models at once to the ensemble + int maxTolerance = 3; + std::string order_algorithm; // order to process the KBest features asc, desc, rand + bool convergence = true; //if true, stop when the model does not improve + bool convergence_best = false; // wether to keep the best accuracy to the moment or the last accuracy as prior accuracy + bool selectFeatures = false; // if true, use feature selection + std::string select_features_algorithm = Orders.DESC; // Selected feature selection algorithm + FeatureSelect* featureSelector = nullptr; + double threshold = -1; + bool block_update = false; + + }; +} +#endif \ No newline at end of file diff --git a/bayesnet/ensembles/BoostA2DE.cc b/bayesnet/ensembles/BoostA2DE.cc new file mode 100644 index 0000000..4738358 --- /dev/null +++ b/bayesnet/ensembles/BoostA2DE.cc @@ -0,0 +1,167 @@ +// *************************************************************** +// SPDX-FileCopyrightText: Copyright 2024 Ricardo Montañana Gómez +// SPDX-FileType: SOURCE +// SPDX-License-Identifier: MIT +// *************************************************************** + +#include +#include +#include +#include +#include +#include "bayesnet/feature_selection/CFS.h" +#include "bayesnet/feature_selection/FCBF.h" +#include "bayesnet/feature_selection/IWSS.h" +#include "BoostA2DE.h" + +namespace bayesnet { + + BoostA2DE::BoostA2DE(bool predict_voting) : Boost(predict_voting) + { + } + std::vector BoostA2DE::initializeModels() + { + torch::Tensor weights_ = torch::full({ m }, 1.0 / m, torch::kFloat64); + std::vector featuresSelected = featureSelection(weights_); + if (featuresSelected.size() < 2) { + notes.push_back("No features selected in initialization"); + status = ERROR; + return std::vector(); + } + for (int i = 0; i < featuresSelected.size() - 1; i++) { + for (int j = i + 1; j < featuresSelected.size(); j++) { + auto parents = { featuresSelected[i], featuresSelected[j] }; + std::unique_ptr model = std::make_unique(parents); + model->fit(dataset, features, className, states, weights_); + models.push_back(std::move(model)); + significanceModels.push_back(1.0); // They will be updated later in trainModel + n_models++; + } + } + notes.push_back("Used features in initialization: " + std::to_string(featuresSelected.size()) + " of " + std::to_string(features.size()) + " with " + select_features_algorithm); + return featuresSelected; + } + void BoostA2DE::trainModel(const torch::Tensor& weights) + { + // + // Logging setup + // + // loguru::set_thread_name("BoostA2DE"); + // loguru::g_stderr_verbosity = loguru::Verbosity_OFF; + // loguru::add_file("boostA2DE.log", loguru::Truncate, loguru::Verbosity_MAX); + + // Algorithm based on the adaboost algorithm for classification + // as explained in Ensemble methods (Zhi-Hua Zhou, 2012) + fitted = true; + double alpha_t = 0; + torch::Tensor weights_ = torch::full({ m }, 1.0 / m, torch::kFloat64); + bool finished = false; + std::vector featuresUsed; + if (selectFeatures) { + featuresUsed = initializeModels(); + auto ypred = predict(X_train); + std::tie(weights_, alpha_t, finished) = update_weights(y_train, ypred, weights_); + // Update significance of the models + for (int i = 0; i < n_models; ++i) { + significanceModels[i] = alpha_t; + } + if (finished) { + return; + } + } + int numItemsPack = 0; // The counter of the models inserted in the current pack + // Variables to control the accuracy finish condition + double priorAccuracy = 0.0; + double improvement = 1.0; + double convergence_threshold = 1e-4; + int tolerance = 0; // number of times the accuracy is lower than the convergence_threshold + // Step 0: Set the finish condition + // epsilon sub t > 0.5 => inverse the weights policy + // validation error is not decreasing + // run out of features + bool ascending = order_algorithm == Orders.ASC; + std::mt19937 g{ 173 }; + std::vector> pairSelection; + while (!finished) { + // Step 1: Build ranking with mutual information + pairSelection = metrics.SelectKPairs(weights_, featuresUsed, ascending, 0); // Get all the pairs sorted + if (order_algorithm == Orders.RAND) { + std::shuffle(pairSelection.begin(), pairSelection.end(), g); + } + int k = bisection ? pow(2, tolerance) : 1; + int counter = 0; // The model counter of the current pack + // VLOG_SCOPE_F(1, "counter=%d k=%d featureSelection.size: %zu", counter, k, featureSelection.size()); + while (counter++ < k && pairSelection.size() > 0) { + auto feature_pair = pairSelection[0]; + pairSelection.erase(pairSelection.begin()); + std::unique_ptr model; + model = std::make_unique(std::vector({ feature_pair.first, feature_pair.second })); + model->fit(dataset, features, className, states, weights_); + alpha_t = 0.0; + if (!block_update) { + auto ypred = model->predict(X_train); + // Step 3.1: Compute the classifier amout of say + std::tie(weights_, alpha_t, finished) = update_weights(y_train, ypred, weights_); + } + // Step 3.4: Store classifier and its accuracy to weigh its future vote + numItemsPack++; + models.push_back(std::move(model)); + significanceModels.push_back(alpha_t); + n_models++; + // VLOG_SCOPE_F(2, "numItemsPack: %d n_models: %d featuresUsed: %zu", numItemsPack, n_models, featuresUsed.size()); + } + if (block_update) { + std::tie(weights_, alpha_t, finished) = update_weights_block(k, y_train, weights_); + } + if (convergence && !finished) { + auto y_val_predict = predict(X_test); + double accuracy = (y_val_predict == y_test).sum().item() / (double)y_test.size(0); + if (priorAccuracy == 0) { + priorAccuracy = accuracy; + } else { + improvement = accuracy - priorAccuracy; + } + if (improvement < convergence_threshold) { + // VLOG_SCOPE_F(3, " (improvement=threshold) Reset. tolerance: %d numItemsPack: %d improvement: %f prior: %f current: %f", tolerance, numItemsPack, improvement, priorAccuracy, accuracy); + tolerance = 0; // Reset the counter if the model performs better + numItemsPack = 0; + } + if (convergence_best) { + // Keep the best accuracy until now as the prior accuracy + priorAccuracy = std::max(accuracy, priorAccuracy); + } else { + // Keep the last accuray obtained as the prior accuracy + priorAccuracy = accuracy; + } + } + // VLOG_SCOPE_F(1, "tolerance: %d featuresUsed.size: %zu features.size: %zu", tolerance, featuresUsed.size(), features.size()); + finished = finished || tolerance > maxTolerance || pairSelection.size() == 0; + } + if (tolerance > maxTolerance) { + if (numItemsPack < n_models) { + notes.push_back("Convergence threshold reached & " + std::to_string(numItemsPack) + " models eliminated"); + // VLOG_SCOPE_F(4, "Convergence threshold reached & %d models eliminated of %d", numItemsPack, n_models); + for (int i = 0; i < numItemsPack; ++i) { + significanceModels.pop_back(); + models.pop_back(); + n_models--; + } + } else { + notes.push_back("Convergence threshold reached & 0 models eliminated"); + // VLOG_SCOPE_F(4, "Convergence threshold reached & 0 models eliminated n_models=%d numItemsPack=%d", n_models, numItemsPack); + } + } + if (pairSelection.size() > 0) { + notes.push_back("Pairs not used in train: " + std::to_string(pairSelection.size())); + status = WARNING; + } + notes.push_back("Number of models: " + std::to_string(n_models)); + } + std::vector BoostA2DE::graph(const std::string& title) const + { + return Ensemble::graph(title); + } +} \ No newline at end of file diff --git a/bayesnet/ensembles/BoostA2DE.h b/bayesnet/ensembles/BoostA2DE.h new file mode 100644 index 0000000..ff56b79 --- /dev/null +++ b/bayesnet/ensembles/BoostA2DE.h @@ -0,0 +1,25 @@ +// *************************************************************** +// SPDX-FileCopyrightText: Copyright 2024 Ricardo Montañana Gómez +// SPDX-FileType: SOURCE +// SPDX-License-Identifier: MIT +// *************************************************************** + +#ifndef BOOSTA2DE_H +#define BOOSTA2DE_H +#include +#include +#include "bayesnet/classifiers/SPnDE.h" +#include "Boost.h" +namespace bayesnet { + class BoostA2DE : public Boost { + public: + explicit BoostA2DE(bool predict_voting = false); + virtual ~BoostA2DE() = default; + std::vector graph(const std::string& title = "BoostA2DE") const override; + protected: + void trainModel(const torch::Tensor& weights) override; + private: + std::vector initializeModels(); + }; +} +#endif \ No newline at end of file diff --git a/bayesnet/ensembles/BoostAODE.cc b/bayesnet/ensembles/BoostAODE.cc index 1e855c9..30137df 100644 --- a/bayesnet/ensembles/BoostAODE.cc +++ b/bayesnet/ensembles/BoostAODE.cc @@ -4,275 +4,40 @@ // SPDX-License-Identifier: MIT // *************************************************************** +#include #include #include #include #include -#include -#include "bayesnet/feature_selection/CFS.h" -#include "bayesnet/feature_selection/FCBF.h" -#include "bayesnet/feature_selection/IWSS.h" #include "BoostAODE.h" -#include "lib/log/loguru.cpp" namespace bayesnet { - BoostAODE::BoostAODE(bool predict_voting) : Ensemble(predict_voting) + BoostAODE::BoostAODE(bool predict_voting) : Boost(predict_voting) { - validHyperparameters = { - "maxModels", "bisection", "order", "convergence", "convergence_best", "threshold", - "select_features", "maxTolerance", "predict_voting", "block_update" - }; - - } - void BoostAODE::buildModel(const torch::Tensor& weights) - { - // Models shall be built in trainModel - models.clear(); - significanceModels.clear(); - n_models = 0; - // Prepare the validation dataset - auto y_ = dataset.index({ -1, "..." }); - if (convergence) { - // Prepare train & validation sets from train data - auto fold = folding::StratifiedKFold(5, y_, 271); - auto [train, test] = fold.getFold(0); - auto train_t = torch::tensor(train); - auto test_t = torch::tensor(test); - // Get train and validation sets - X_train = dataset.index({ torch::indexing::Slice(0, dataset.size(0) - 1), train_t }); - y_train = dataset.index({ -1, train_t }); - X_test = dataset.index({ torch::indexing::Slice(0, dataset.size(0) - 1), test_t }); - y_test = dataset.index({ -1, test_t }); - dataset = X_train; - m = X_train.size(1); - auto n_classes = states.at(className).size(); - // Build dataset with train data - buildDataset(y_train); - metrics = Metrics(dataset, features, className, n_classes); - } else { - // Use all data to train - X_train = dataset.index({ torch::indexing::Slice(0, dataset.size(0) - 1), "..." }); - y_train = y_; - } - } - void BoostAODE::setHyperparameters(const nlohmann::json& hyperparameters_) - { - auto hyperparameters = hyperparameters_; - if (hyperparameters.contains("order")) { - std::vector algos = { Orders.ASC, Orders.DESC, Orders.RAND }; - order_algorithm = hyperparameters["order"]; - if (std::find(algos.begin(), algos.end(), order_algorithm) == algos.end()) { - throw std::invalid_argument("Invalid order algorithm, valid values [" + Orders.ASC + ", " + Orders.DESC + ", " + Orders.RAND + "]"); - } - hyperparameters.erase("order"); - } - if (hyperparameters.contains("convergence")) { - convergence = hyperparameters["convergence"]; - hyperparameters.erase("convergence"); - } - if (hyperparameters.contains("convergence_best")) { - convergence_best = hyperparameters["convergence_best"]; - hyperparameters.erase("convergence_best"); - } - if (hyperparameters.contains("bisection")) { - bisection = hyperparameters["bisection"]; - hyperparameters.erase("bisection"); - } - if (hyperparameters.contains("threshold")) { - threshold = hyperparameters["threshold"]; - hyperparameters.erase("threshold"); - } - if (hyperparameters.contains("maxTolerance")) { - maxTolerance = hyperparameters["maxTolerance"]; - if (maxTolerance < 1 || maxTolerance > 4) - throw std::invalid_argument("Invalid maxTolerance value, must be greater in [1, 4]"); - hyperparameters.erase("maxTolerance"); - } - if (hyperparameters.contains("predict_voting")) { - predict_voting = hyperparameters["predict_voting"]; - hyperparameters.erase("predict_voting"); - } - if (hyperparameters.contains("select_features")) { - auto selectedAlgorithm = hyperparameters["select_features"]; - std::vector algos = { SelectFeatures.IWSS, SelectFeatures.CFS, SelectFeatures.FCBF }; - selectFeatures = true; - select_features_algorithm = selectedAlgorithm; - if (std::find(algos.begin(), algos.end(), selectedAlgorithm) == algos.end()) { - throw std::invalid_argument("Invalid selectFeatures value, valid values [" + SelectFeatures.IWSS + ", " + SelectFeatures.CFS + ", " + SelectFeatures.FCBF + "]"); - } - hyperparameters.erase("select_features"); - } - if (hyperparameters.contains("block_update")) { - block_update = hyperparameters["block_update"]; - hyperparameters.erase("block_update"); - } - Classifier::setHyperparameters(hyperparameters); - } - std::tuple update_weights(torch::Tensor& ytrain, torch::Tensor& ypred, torch::Tensor& weights) - { - bool terminate = false; - double alpha_t = 0; - auto mask_wrong = ypred != ytrain; - auto mask_right = ypred == ytrain; - auto masked_weights = weights * mask_wrong.to(weights.dtype()); - double epsilon_t = masked_weights.sum().item(); - if (epsilon_t > 0.5) { - // Inverse the weights policy (plot ln(wt)) - // "In each round of AdaBoost, there is a sanity check to ensure that the current base - // learner is better than random guess" (Zhi-Hua Zhou, 2012) - terminate = true; - } else { - double wt = (1 - epsilon_t) / epsilon_t; - alpha_t = epsilon_t == 0 ? 1 : 0.5 * log(wt); - // Step 3.2: Update weights for next classifier - // Step 3.2.1: Update weights of wrong samples - weights += mask_wrong.to(weights.dtype()) * exp(alpha_t) * weights; - // Step 3.2.2: Update weights of right samples - weights += mask_right.to(weights.dtype()) * exp(-alpha_t) * weights; - // Step 3.3: Normalise the weights - double totalWeights = torch::sum(weights).item(); - weights = weights / totalWeights; - } - return { weights, alpha_t, terminate }; - } - std::tuple BoostAODE::update_weights_block(int k, torch::Tensor& ytrain, torch::Tensor& weights) - { - /* Update Block algorithm - k = # of models in block - n_models = # of models in ensemble to make predictions - n_models_bak = # models saved - models = vector of models to make predictions - models_bak = models not used to make predictions - significances_bak = backup of significances vector - - Case list - A) k = 1, n_models = 1 => n = 0 , n_models = n + k - B) k = 1, n_models = n + 1 => n_models = n + k - C) k > 1, n_models = k + 1 => n= 1, n_models = n + k - D) k > 1, n_models = k => n = 0, n_models = n + k - E) k > 1, n_models = k + n => n_models = n + k - - A, D) n=0, k > 0, n_models == k - 1. n_models_bak <- n_models - 2. significances_bak <- significances - 3. significances = vector(k, 1) - 4. Don’t move any classifiers out of models - 5. n_models <- k - 6. Make prediction, compute alpha, update weights - 7. Don’t restore any classifiers to models - 8. significances <- significances_bak - 9. Update last k significances - 10. n_models <- n_models_bak - - B, C, E) n > 0, k > 0, n_models == n + k - 1. n_models_bak <- n_models - 2. significances_bak <- significances - 3. significances = vector(k, 1) - 4. Move first n classifiers to models_bak - 5. n_models <- k - 6. Make prediction, compute alpha, update weights - 7. Insert classifiers in models_bak to be the first n models - 8. significances <- significances_bak - 9. Update last k significances - 10. n_models <- n_models_bak - */ - // - // Make predict with only the last k models - // - std::unique_ptr model; - std::vector> models_bak; - // 1. n_models_bak <- n_models 2. significances_bak <- significances - auto significance_bak = significanceModels; - auto n_models_bak = n_models; - // 3. significances = vector(k, 1) - significanceModels = std::vector(k, 1.0); - // 4. Move first n classifiers to models_bak - // backup the first n_models - k models (if n_models == k, don't backup any) - for (int i = 0; i < n_models - k; ++i) { - model = std::move(models[0]); - models.erase(models.begin()); - models_bak.push_back(std::move(model)); - } - assert(models.size() == k); - // 5. n_models <- k - n_models = k; - // 6. Make prediction, compute alpha, update weights - auto ypred = predict(X_train); - // - // Update weights - // - double alpha_t; - bool terminate; - std::tie(weights, alpha_t, terminate) = update_weights(y_train, ypred, weights); - // - // Restore the models if needed - // - // 7. Insert classifiers in models_bak to be the first n models - // if n_models_bak == k, don't restore any, because none of them were moved - if (k != n_models_bak) { - // Insert in the same order as they were extracted - int bak_size = models_bak.size(); - for (int i = 0; i < bak_size; ++i) { - model = std::move(models_bak[bak_size - 1 - i]); - models_bak.erase(models_bak.end() - 1); - models.insert(models.begin(), std::move(model)); - } - } - // 8. significances <- significances_bak - significanceModels = significance_bak; - // - // Update the significance of the last k models - // - // 9. Update last k significances - for (int i = 0; i < k; ++i) { - significanceModels[n_models_bak - k + i] = alpha_t; - } - // 10. n_models <- n_models_bak - n_models = n_models_bak; - return { weights, alpha_t, terminate }; } std::vector BoostAODE::initializeModels() { - std::vector featuresUsed; torch::Tensor weights_ = torch::full({ m }, 1.0 / m, torch::kFloat64); - int maxFeatures = 0; - if (select_features_algorithm == SelectFeatures.CFS) { - featureSelector = new CFS(dataset, features, className, maxFeatures, states.at(className).size(), weights_); - } else if (select_features_algorithm == SelectFeatures.IWSS) { - if (threshold < 0 || threshold >0.5) { - throw std::invalid_argument("Invalid threshold value for " + SelectFeatures.IWSS + " [0, 0.5]"); - } - featureSelector = new IWSS(dataset, features, className, maxFeatures, states.at(className).size(), weights_, threshold); - } else if (select_features_algorithm == SelectFeatures.FCBF) { - if (threshold < 1e-7 || threshold > 1) { - throw std::invalid_argument("Invalid threshold value for " + SelectFeatures.FCBF + " [1e-7, 1]"); - } - featureSelector = new FCBF(dataset, features, className, maxFeatures, states.at(className).size(), weights_, threshold); - } - featureSelector->fit(); - auto cfsFeatures = featureSelector->getFeatures(); - auto scores = featureSelector->getScores(); - for (const int& feature : cfsFeatures) { - featuresUsed.push_back(feature); + std::vector featuresSelected = featureSelection(weights_); + for (const int& feature : featuresSelected) { std::unique_ptr model = std::make_unique(feature); model->fit(dataset, features, className, states, weights_); models.push_back(std::move(model)); significanceModels.push_back(1.0); // They will be updated later in trainModel n_models++; } - notes.push_back("Used features in initialization: " + std::to_string(featuresUsed.size()) + " of " + std::to_string(features.size()) + " with " + select_features_algorithm); - delete featureSelector; - return featuresUsed; + notes.push_back("Used features in initialization: " + std::to_string(featuresSelected.size()) + " of " + std::to_string(features.size()) + " with " + select_features_algorithm); + return featuresSelected; } void BoostAODE::trainModel(const torch::Tensor& weights) { // // Logging setup // - loguru::set_thread_name("BoostAODE"); - loguru::g_stderr_verbosity = loguru::Verbosity_OFF; - loguru::add_file("boostAODE.log", loguru::Truncate, loguru::Verbosity_MAX); + // loguru::set_thread_name("BoostAODE"); + // loguru::g_stderr_verbosity = loguru::Verbosity_OFF; + // loguru::add_file("boostAODE.log", loguru::Truncate, loguru::Verbosity_MAX); // Algorithm based on the adaboost algorithm for classification // as explained in Ensemble methods (Zhi-Hua Zhou, 2012) @@ -318,7 +83,7 @@ namespace bayesnet { ); int k = bisection ? pow(2, tolerance) : 1; int counter = 0; // The model counter of the current pack - VLOG_SCOPE_F(1, "counter=%d k=%d featureSelection.size: %zu", counter, k, featureSelection.size()); + // VLOG_SCOPE_F(1, "counter=%d k=%d featureSelection.size: %zu", counter, k, featureSelection.size()); while (counter++ < k && featureSelection.size() > 0) { auto feature = featureSelection[0]; featureSelection.erase(featureSelection.begin()); @@ -337,7 +102,7 @@ namespace bayesnet { models.push_back(std::move(model)); significanceModels.push_back(alpha_t); n_models++; - VLOG_SCOPE_F(2, "numItemsPack: %d n_models: %d featuresUsed: %zu", numItemsPack, n_models, featuresUsed.size()); + // VLOG_SCOPE_F(2, "numItemsPack: %d n_models: %d featuresUsed: %zu", numItemsPack, n_models, featuresUsed.size()); } if (block_update) { std::tie(weights_, alpha_t, finished) = update_weights_block(k, y_train, weights_); @@ -351,10 +116,10 @@ namespace bayesnet { improvement = accuracy - priorAccuracy; } if (improvement < convergence_threshold) { - VLOG_SCOPE_F(3, " (improvement=threshold) Reset. tolerance: %d numItemsPack: %d improvement: %f prior: %f current: %f", tolerance, numItemsPack, improvement, priorAccuracy, accuracy); + // VLOG_SCOPE_F(3, "* (improvement>=threshold) Reset. tolerance: %d numItemsPack: %d improvement: %f prior: %f current: %f", tolerance, numItemsPack, improvement, priorAccuracy, accuracy); tolerance = 0; // Reset the counter if the model performs better numItemsPack = 0; } @@ -366,13 +131,13 @@ namespace bayesnet { priorAccuracy = accuracy; } } - VLOG_SCOPE_F(1, "tolerance: %d featuresUsed.size: %zu features.size: %zu", tolerance, featuresUsed.size(), features.size()); + // VLOG_SCOPE_F(1, "tolerance: %d featuresUsed.size: %zu features.size: %zu", tolerance, featuresUsed.size(), features.size()); finished = finished || tolerance > maxTolerance || featuresUsed.size() == features.size(); } if (tolerance > maxTolerance) { if (numItemsPack < n_models) { notes.push_back("Convergence threshold reached & " + std::to_string(numItemsPack) + " models eliminated"); - VLOG_SCOPE_F(4, "Convergence threshold reached & %d models eliminated of %d", numItemsPack, n_models); + // VLOG_SCOPE_F(4, "Convergence threshold reached & %d models eliminated of %d", numItemsPack, n_models); for (int i = 0; i < numItemsPack; ++i) { significanceModels.pop_back(); models.pop_back(); @@ -380,7 +145,7 @@ namespace bayesnet { } } else { notes.push_back("Convergence threshold reached & 0 models eliminated"); - VLOG_SCOPE_F(4, "Convergence threshold reached & 0 models eliminated n_models=%d numItemsPack=%d", n_models, numItemsPack); + // VLOG_SCOPE_F(4, "Convergence threshold reached & 0 models eliminated n_models=%d numItemsPack=%d", n_models, numItemsPack); } } if (featuresUsed.size() != features.size()) { diff --git a/bayesnet/ensembles/BoostAODE.h b/bayesnet/ensembles/BoostAODE.h index dac0004..e4eb250 100644 --- a/bayesnet/ensembles/BoostAODE.h +++ b/bayesnet/ensembles/BoostAODE.h @@ -6,45 +6,21 @@ #ifndef BOOSTAODE_H #define BOOSTAODE_H -#include +#include +#include #include "bayesnet/classifiers/SPODE.h" -#include "bayesnet/feature_selection/FeatureSelect.h" -#include "Ensemble.h" +#include "Boost.h" + namespace bayesnet { - const struct { - std::string CFS = "CFS"; - std::string FCBF = "FCBF"; - std::string IWSS = "IWSS"; - }SelectFeatures; - const struct { - std::string ASC = "asc"; - std::string DESC = "desc"; - std::string RAND = "rand"; - }Orders; - class BoostAODE : public Ensemble { + class BoostAODE : public Boost { public: explicit BoostAODE(bool predict_voting = false); virtual ~BoostAODE() = default; std::vector graph(const std::string& title = "BoostAODE") const override; - void setHyperparameters(const nlohmann::json& hyperparameters_) override; protected: - void buildModel(const torch::Tensor& weights) override; void trainModel(const torch::Tensor& weights) override; private: - std::tuple update_weights_block(int k, torch::Tensor& ytrain, torch::Tensor& weights); std::vector initializeModels(); - torch::Tensor X_train, y_train, X_test, y_test; - // Hyperparameters - bool bisection = true; // if true, use bisection stratety to add k models at once to the ensemble - int maxTolerance = 3; - std::string order_algorithm; // order to process the KBest features asc, desc, rand - bool convergence = true; //if true, stop when the model does not improve - bool convergence_best = false; // wether to keep the best accuracy to the moment or the last accuracy as prior accuracy - bool selectFeatures = false; // if true, use feature selection - std::string select_features_algorithm = Orders.DESC; // Selected feature selection algorithm - FeatureSelect* featureSelector = nullptr; - double threshold = -1; - bool block_update = false; }; } #endif \ No newline at end of file diff --git a/bayesnet/utils/BayesMetrics.cc b/bayesnet/utils/BayesMetrics.cc index 3e63038..b4b12cc 100644 --- a/bayesnet/utils/BayesMetrics.cc +++ b/bayesnet/utils/BayesMetrics.cc @@ -30,6 +30,53 @@ namespace bayesnet { } samples.index_put_({ -1, "..." }, torch::tensor(labels, torch::kInt32)); } + std::vector> Metrics::SelectKPairs(const torch::Tensor& weights, std::vector& featuresExcluded, bool ascending, unsigned k) + { + // Return the K Best features + auto n = features.size(); + // compute scores + scoresKPairs.clear(); + pairsKBest.clear(); + auto labels = samples.index({ -1, "..." }); + for (int i = 0; i < n - 1; ++i) { + if (std::find(featuresExcluded.begin(), featuresExcluded.end(), i) != featuresExcluded.end()) { + continue; + } + for (int j = i + 1; j < n; ++j) { + if (std::find(featuresExcluded.begin(), featuresExcluded.end(), j) != featuresExcluded.end()) { + continue; + } + auto key = std::make_pair(i, j); + auto value = conditionalMutualInformation(samples.index({ i, "..." }), samples.index({ j, "..." }), labels, weights); + scoresKPairs.push_back({ key, value }); + } + } + // sort scores + if (ascending) { + sort(scoresKPairs.begin(), scoresKPairs.end(), [](auto& a, auto& b) + { return a.second < b.second; }); + + } else { + sort(scoresKPairs.begin(), scoresKPairs.end(), [](auto& a, auto& b) + { return a.second > b.second; }); + } + for (auto& [pairs, score] : scoresKPairs) { + pairsKBest.push_back(pairs); + } + if (k != 0 && k < pairsKBest.size()) { + if (ascending) { + int limit = pairsKBest.size() - k; + for (int i = 0; i < limit; i++) { + pairsKBest.erase(pairsKBest.begin()); + scoresKPairs.erase(scoresKPairs.begin()); + } + } else { + pairsKBest.resize(k); + scoresKPairs.resize(k); + } + } + return pairsKBest; + } std::vector Metrics::SelectKBestWeighted(const torch::Tensor& weights, bool ascending, unsigned k) { // Return the K Best features @@ -69,7 +116,10 @@ namespace bayesnet { { return scoresKBest; } - + std::vector, double>> Metrics::getScoresKPairs() const + { + return scoresKPairs; + } torch::Tensor Metrics::conditionalEdge(const torch::Tensor& weights) { auto result = std::vector(); @@ -148,24 +198,20 @@ namespace bayesnet { } return entropyValue; } - // H(Y|X,C) = sum_{x in X, c in C} p(x,c) H(Y|X=x,C=c) + // H(X|Y,C) = sum_{y in Y, c in C} p(x,c) H(X|Y=y,C=c) double Metrics::conditionalEntropy(const torch::Tensor& firstFeature, const torch::Tensor& secondFeature, const torch::Tensor& labels, const torch::Tensor& weights) { // Ensure the tensors are of the same length assert(firstFeature.size(0) == secondFeature.size(0) && firstFeature.size(0) == labels.size(0) && firstFeature.size(0) == weights.size(0)); - // Convert tensors to vectors for easier processing auto firstFeatureData = firstFeature.accessor(); auto secondFeatureData = secondFeature.accessor(); auto labelsData = labels.accessor(); auto weightsData = weights.accessor(); - int numSamples = firstFeature.size(0); - // Maps for joint and marginal probabilities std::map, double> jointCount; std::map, double> marginalCount; - // Compute joint and marginal counts for (int i = 0; i < numSamples; ++i) { auto keyJoint = std::make_tuple(firstFeatureData[i], labelsData[i], secondFeatureData[i]); @@ -174,34 +220,29 @@ namespace bayesnet { jointCount[keyJoint] += weightsData[i]; marginalCount[keyMarginal] += weightsData[i]; } - // Total weight sum double totalWeight = torch::sum(weights).item(); if (totalWeight == 0) return 0; - // Compute the conditional entropy double conditionalEntropy = 0.0; - for (const auto& [keyJoint, jointFreq] : jointCount) { auto [x, c, y] = keyJoint; auto keyMarginal = std::make_tuple(x, c); - - double p_xc = marginalCount[keyMarginal] / totalWeight; + //double p_xc = marginalCount[keyMarginal] / totalWeight; double p_y_given_xc = jointFreq / marginalCount[keyMarginal]; - if (p_y_given_xc > 0) { conditionalEntropy -= (jointFreq / totalWeight) * std::log(p_y_given_xc); } } return conditionalEntropy; } - // I(X;Y) = H(Y) - H(Y|X) + // I(X;Y) = H(Y) - H(Y|X) ; I(X;Y) >= 0 double Metrics::mutualInformation(const torch::Tensor& firstFeature, const torch::Tensor& secondFeature, const torch::Tensor& weights) { - return entropy(firstFeature, weights) - conditionalEntropy(firstFeature, secondFeature, weights); + return std::max(entropy(firstFeature, weights) - conditionalEntropy(firstFeature, secondFeature, weights), 0.0); } - // I(X;Y|C) = H(Y|C) - H(Y|X,C) + // I(X;Y|C) = H(X|C) - H(X|Y,C) >= 0 double Metrics::conditionalMutualInformation(const torch::Tensor& firstFeature, const torch::Tensor& secondFeature, const torch::Tensor& labels, const torch::Tensor& weights) { return std::max(conditionalEntropy(firstFeature, labels, weights) - conditionalEntropy(firstFeature, secondFeature, labels, weights), 0.0); diff --git a/bayesnet/utils/BayesMetrics.h b/bayesnet/utils/BayesMetrics.h index 6c20852..5b62a72 100644 --- a/bayesnet/utils/BayesMetrics.h +++ b/bayesnet/utils/BayesMetrics.h @@ -16,7 +16,9 @@ namespace bayesnet { Metrics(const torch::Tensor& samples, const std::vector& features, const std::string& className, const int classNumStates); Metrics(const std::vector>& vsamples, const std::vector& labels, const std::vector& features, const std::string& className, const int classNumStates); std::vector SelectKBestWeighted(const torch::Tensor& weights, bool ascending = false, unsigned k = 0); + std::vector> SelectKPairs(const torch::Tensor& weights, std::vector& featuresExcluded, bool ascending = false, unsigned k = 0); std::vector getScoresKBest() const; + std::vector, double>> getScoresKPairs() const; double mutualInformation(const torch::Tensor& firstFeature, const torch::Tensor& secondFeature, const torch::Tensor& weights); double conditionalMutualInformation(const torch::Tensor& firstFeature, const torch::Tensor& secondFeature, const torch::Tensor& labels, const torch::Tensor& weights); torch::Tensor conditionalEdge(const torch::Tensor& weights); @@ -33,7 +35,7 @@ namespace bayesnet { std::vector> doCombinations(const std::vector& source) { std::vector> result; - for (int i = 0; i < source.size(); ++i) { + for (int i = 0; i < source.size() - 1; ++i) { T temp = source[i]; for (int j = i + 1; j < source.size(); ++j) { result.push_back({ temp, source[j] }); @@ -52,6 +54,8 @@ namespace bayesnet { int classNumStates = 0; std::vector scoresKBest; std::vector featuresKBest; // sorted indices of the features + std::vector> pairsKBest; // sorted indices of the pairs + std::vector, double>> scoresKPairs; double conditionalEntropy(const torch::Tensor& firstFeature, const torch::Tensor& secondFeature, const torch::Tensor& weights); }; } diff --git a/docs/BoostAODE.md b/docs/BoostAODE.md index def453d..308d00c 100644 --- a/docs/BoostAODE.md +++ b/docs/BoostAODE.md @@ -27,4 +27,4 @@ The hyperparameters defined in the algorithm are: ## Operation -### [Algorithm](./algorithm.md) +### [Base Algorithm](./algorithm.md) diff --git a/docs/Doxyfile.in b/docs/Doxyfile.in new file mode 100644 index 0000000..e030387 --- /dev/null +++ b/docs/Doxyfile.in @@ -0,0 +1,2912 @@ +# Doxyfile 1.11.0 + +# This file describes the settings to be used by the documentation system +# doxygen (www.doxygen.org) for a project. +# +# All text after a double hash (##) is considered a comment and is placed in +# front of the TAG it is preceding. +# +# All text after a single hash (#) is considered a comment and will be ignored. +# The format is: +# TAG = value [value, ...] +# For lists, items can also be appended using: +# TAG += value [value, ...] +# Values that contain spaces should be placed between quotes (\" \"). +# +# Note: +# +# Use doxygen to compare the used configuration file with the template +# configuration file: +# doxygen -x [configFile] +# Use doxygen to compare the used configuration file with the template +# configuration file without replacing the environment variables or CMake type +# replacement variables: +# doxygen -x_noenv [configFile] + +#--------------------------------------------------------------------------- +# Project related configuration options +#--------------------------------------------------------------------------- + +# This tag specifies the encoding used for all characters in the configuration +# file that follow. The default is UTF-8 which is also the encoding used for all +# text before the first occurrence of this tag. Doxygen uses libiconv (or the +# iconv built into libc) for the transcoding. See +# https://www.gnu.org/software/libiconv/ for the list of possible encodings. +# The default value is: UTF-8. + +DOXYFILE_ENCODING = UTF-8 + +# The PROJECT_NAME tag is a single word (or a sequence of words surrounded by +# double-quotes, unless you are using Doxywizard) that should identify the +# project for which the documentation is generated. This name is used in the +# title of most generated pages and in a few other places. +# The default value is: My Project. + +PROJECT_NAME = "@CMAKE_PROJECT_NAME@" + +# The PROJECT_NUMBER tag can be used to enter a project or revision number. This +# could be handy for archiving the generated documentation or if some version +# control system is used. + +PROJECT_NUMBER = @PROJECT_VERSION_MAJOR@.@PROJECT_VERSION_MINOR@.@PROJECT_VERSION_PATCH@.@PROJECT_VERSION_TWEAK@ + +# Using the PROJECT_BRIEF tag one can provide an optional one line description +# for a project that appears at the top of each page and should give viewer a +# quick idea about the purpose of the project. Keep the description short. + +PROJECT_BRIEF = "@CMAKE_PROJECT_DESCRIPTION@" + +# With the PROJECT_LOGO tag one can specify a logo or an icon that is included +# in the documentation. The maximum height of the logo should not exceed 55 +# pixels and the maximum width should not exceed 200 pixels. Doxygen will copy +# the logo to the output directory. + +PROJECT_LOGO = logo_small.png + +# With the PROJECT_ICON tag one can specify an icon that is included in the tabs +# when the HTML document is shown. Doxygen will copy the logo to the output +# directory. + +PROJECT_ICON = + +# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) path +# into which the generated documentation will be written. If a relative path is +# entered, it will be relative to the location where doxygen was started. If +# left blank the current directory will be used. + +OUTPUT_DIRECTORY = + +# If the CREATE_SUBDIRS tag is set to YES then doxygen will create up to 4096 +# sub-directories (in 2 levels) under the output directory of each output format +# and will distribute the generated files over these directories. Enabling this +# option can be useful when feeding doxygen a huge amount of source files, where +# putting all generated files in the same directory would otherwise causes +# performance problems for the file system. Adapt CREATE_SUBDIRS_LEVEL to +# control the number of sub-directories. +# The default value is: NO. + +CREATE_SUBDIRS = NO + +# Controls the number of sub-directories that will be created when +# CREATE_SUBDIRS tag is set to YES. Level 0 represents 16 directories, and every +# level increment doubles the number of directories, resulting in 4096 +# directories at level 8 which is the default and also the maximum value. The +# sub-directories are organized in 2 levels, the first level always has a fixed +# number of 16 directories. +# Minimum value: 0, maximum value: 8, default value: 8. +# This tag requires that the tag CREATE_SUBDIRS is set to YES. + +CREATE_SUBDIRS_LEVEL = 8 + +# If the ALLOW_UNICODE_NAMES tag is set to YES, doxygen will allow non-ASCII +# characters to appear in the names of generated files. If set to NO, non-ASCII +# characters will be escaped, for example _xE3_x81_x84 will be used for Unicode +# U+3044. +# The default value is: NO. + +ALLOW_UNICODE_NAMES = NO + +# The OUTPUT_LANGUAGE tag is used to specify the language in which all +# documentation generated by doxygen is written. Doxygen will use this +# information to generate all constant output in the proper language. +# Possible values are: Afrikaans, Arabic, Armenian, Brazilian, Bulgarian, +# Catalan, Chinese, Chinese-Traditional, Croatian, Czech, Danish, Dutch, English +# (United States), Esperanto, Farsi (Persian), Finnish, French, German, Greek, +# Hindi, Hungarian, Indonesian, Italian, Japanese, Japanese-en (Japanese with +# English messages), Korean, Korean-en (Korean with English messages), Latvian, +# Lithuanian, Macedonian, Norwegian, Persian (Farsi), Polish, Portuguese, +# Romanian, Russian, Serbian, Serbian-Cyrillic, Slovak, Slovene, Spanish, +# Swedish, Turkish, Ukrainian and Vietnamese. +# The default value is: English. + +OUTPUT_LANGUAGE = English + +# If the BRIEF_MEMBER_DESC tag is set to YES, doxygen will include brief member +# descriptions after the members that are listed in the file and class +# documentation (similar to Javadoc). Set to NO to disable this. +# The default value is: YES. + +BRIEF_MEMBER_DESC = YES + +# If the REPEAT_BRIEF tag is set to YES, doxygen will prepend the brief +# description of a member or function before the detailed description +# +# Note: If both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the +# brief descriptions will be completely suppressed. +# The default value is: YES. + +REPEAT_BRIEF = YES + +# This tag implements a quasi-intelligent brief description abbreviator that is +# used to form the text in various listings. Each string in this list, if found +# as the leading text of the brief description, will be stripped from the text +# and the result, after processing the whole list, is used as the annotated +# text. Otherwise, the brief description is used as-is. If left blank, the +# following values are used ($name is automatically replaced with the name of +# the entity):The $name class, The $name widget, The $name file, is, provides, +# specifies, contains, represents, a, an and the. + +ABBREVIATE_BRIEF = "The $name class" \ + "The $name widget" \ + "The $name file" \ + is \ + provides \ + specifies \ + contains \ + represents \ + a \ + an \ + the + +# If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then +# doxygen will generate a detailed section even if there is only a brief +# description. +# The default value is: NO. + +ALWAYS_DETAILED_SEC = NO + +# If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all +# inherited members of a class in the documentation of that class as if those +# members were ordinary class members. Constructors, destructors and assignment +# operators of the base classes will not be shown. +# The default value is: NO. + +INLINE_INHERITED_MEMB = NO + +# If the FULL_PATH_NAMES tag is set to YES, doxygen will prepend the full path +# before files name in the file list and in the header files. If set to NO the +# shortest path that makes the file name unique will be used +# The default value is: YES. + +FULL_PATH_NAMES = YES + +# The STRIP_FROM_PATH tag can be used to strip a user-defined part of the path. +# Stripping is only done if one of the specified strings matches the left-hand +# part of the path. The tag can be used to show relative paths in the file list. +# If left blank the directory from which doxygen is run is used as the path to +# strip. +# +# Note that you can specify absolute paths here, but also relative paths, which +# will be relative from the directory where doxygen is started. +# This tag requires that the tag FULL_PATH_NAMES is set to YES. + +STRIP_FROM_PATH = + +# The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of the +# path mentioned in the documentation of a class, which tells the reader which +# header file to include in order to use a class. If left blank only the name of +# the header file containing the class definition is used. Otherwise one should +# specify the list of include paths that are normally passed to the compiler +# using the -I flag. + +STRIP_FROM_INC_PATH = + +# If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter (but +# less readable) file names. This can be useful is your file systems doesn't +# support long names like on DOS, Mac, or CD-ROM. +# The default value is: NO. + +SHORT_NAMES = NO + +# If the JAVADOC_AUTOBRIEF tag is set to YES then doxygen will interpret the +# first line (until the first dot) of a Javadoc-style comment as the brief +# description. If set to NO, the Javadoc-style will behave just like regular Qt- +# style comments (thus requiring an explicit @brief command for a brief +# description.) +# The default value is: NO. + +JAVADOC_AUTOBRIEF = NO + +# If the JAVADOC_BANNER tag is set to YES then doxygen will interpret a line +# such as +# /*************** +# as being the beginning of a Javadoc-style comment "banner". If set to NO, the +# Javadoc-style will behave just like regular comments and it will not be +# interpreted by doxygen. +# The default value is: NO. + +JAVADOC_BANNER = NO + +# If the QT_AUTOBRIEF tag is set to YES then doxygen will interpret the first +# line (until the first dot) of a Qt-style comment as the brief description. If +# set to NO, the Qt-style will behave just like regular Qt-style comments (thus +# requiring an explicit \brief command for a brief description.) +# The default value is: NO. + +QT_AUTOBRIEF = NO + +# The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make doxygen treat a +# multi-line C++ special comment block (i.e. a block of //! or /// comments) as +# a brief description. This used to be the default behavior. The new default is +# to treat a multi-line C++ comment block as a detailed description. Set this +# tag to YES if you prefer the old behavior instead. +# +# Note that setting this tag to YES also means that rational rose comments are +# not recognized any more. +# The default value is: NO. + +MULTILINE_CPP_IS_BRIEF = NO + +# By default Python docstrings are displayed as preformatted text and doxygen's +# special commands cannot be used. By setting PYTHON_DOCSTRING to NO the +# doxygen's special commands can be used and the contents of the docstring +# documentation blocks is shown as doxygen documentation. +# The default value is: YES. + +PYTHON_DOCSTRING = YES + +# If the INHERIT_DOCS tag is set to YES then an undocumented member inherits the +# documentation from any documented member that it re-implements. +# The default value is: YES. + +INHERIT_DOCS = YES + +# If the SEPARATE_MEMBER_PAGES tag is set to YES then doxygen will produce a new +# page for each member. If set to NO, the documentation of a member will be part +# of the file/class/namespace that contains it. +# The default value is: NO. + +SEPARATE_MEMBER_PAGES = NO + +# The TAB_SIZE tag can be used to set the number of spaces in a tab. Doxygen +# uses this value to replace tabs by spaces in code fragments. +# Minimum value: 1, maximum value: 16, default value: 4. + +TAB_SIZE = 4 + +# This tag can be used to specify a number of aliases that act as commands in +# the documentation. An alias has the form: +# name=value +# For example adding +# "sideeffect=@par Side Effects:^^" +# will allow you to put the command \sideeffect (or @sideeffect) in the +# documentation, which will result in a user-defined paragraph with heading +# "Side Effects:". Note that you cannot put \n's in the value part of an alias +# to insert newlines (in the resulting output). You can put ^^ in the value part +# of an alias to insert a newline as if a physical newline was in the original +# file. When you need a literal { or } or , in the value part of an alias you +# have to escape them by means of a backslash (\), this can lead to conflicts +# with the commands \{ and \} for these it is advised to use the version @{ and +# @} or use a double escape (\\{ and \\}) + +ALIASES = + +# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C sources +# only. Doxygen will then generate output that is more tailored for C. For +# instance, some of the names that are used will be different. The list of all +# members will be omitted, etc. +# The default value is: NO. + +OPTIMIZE_OUTPUT_FOR_C = NO + +# Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java or +# Python sources only. Doxygen will then generate output that is more tailored +# for that language. For instance, namespaces will be presented as packages, +# qualified scopes will look different, etc. +# The default value is: NO. + +OPTIMIZE_OUTPUT_JAVA = NO + +# Set the OPTIMIZE_FOR_FORTRAN tag to YES if your project consists of Fortran +# sources. Doxygen will then generate output that is tailored for Fortran. +# The default value is: NO. + +OPTIMIZE_FOR_FORTRAN = NO + +# Set the OPTIMIZE_OUTPUT_VHDL tag to YES if your project consists of VHDL +# sources. Doxygen will then generate output that is tailored for VHDL. +# The default value is: NO. + +OPTIMIZE_OUTPUT_VHDL = NO + +# Set the OPTIMIZE_OUTPUT_SLICE tag to YES if your project consists of Slice +# sources only. Doxygen will then generate output that is more tailored for that +# language. For instance, namespaces will be presented as modules, types will be +# separated into more groups, etc. +# The default value is: NO. + +OPTIMIZE_OUTPUT_SLICE = NO + +# Doxygen selects the parser to use depending on the extension of the files it +# parses. With this tag you can assign which parser to use for a given +# extension. Doxygen has a built-in mapping, but you can override or extend it +# using this tag. The format is ext=language, where ext is a file extension, and +# language is one of the parsers supported by doxygen: IDL, Java, JavaScript, +# Csharp (C#), C, C++, Lex, D, PHP, md (Markdown), Objective-C, Python, Slice, +# VHDL, Fortran (fixed format Fortran: FortranFixed, free formatted Fortran: +# FortranFree, unknown formatted Fortran: Fortran. In the later case the parser +# tries to guess whether the code is fixed or free formatted code, this is the +# default for Fortran type files). For instance to make doxygen treat .inc files +# as Fortran files (default is PHP), and .f files as C (default is Fortran), +# use: inc=Fortran f=C. +# +# Note: For files without extension you can use no_extension as a placeholder. +# +# Note that for custom extensions you also need to set FILE_PATTERNS otherwise +# the files are not read by doxygen. When specifying no_extension you should add +# * to the FILE_PATTERNS. +# +# Note see also the list of default file extension mappings. + +EXTENSION_MAPPING = + +# If the MARKDOWN_SUPPORT tag is enabled then doxygen pre-processes all comments +# according to the Markdown format, which allows for more readable +# documentation. See https://daringfireball.net/projects/markdown/ for details. +# The output of markdown processing is further processed by doxygen, so you can +# mix doxygen, HTML, and XML commands with Markdown formatting. Disable only in +# case of backward compatibilities issues. +# The default value is: YES. + +MARKDOWN_SUPPORT = YES + +# When the TOC_INCLUDE_HEADINGS tag is set to a non-zero value, all headings up +# to that level are automatically included in the table of contents, even if +# they do not have an id attribute. +# Note: This feature currently applies only to Markdown headings. +# Minimum value: 0, maximum value: 99, default value: 6. +# This tag requires that the tag MARKDOWN_SUPPORT is set to YES. + +TOC_INCLUDE_HEADINGS = 6 + +# The MARKDOWN_ID_STYLE tag can be used to specify the algorithm used to +# generate identifiers for the Markdown headings. Note: Every identifier is +# unique. +# Possible values are: DOXYGEN use a fixed 'autotoc_md' string followed by a +# sequence number starting at 0 and GITHUB use the lower case version of title +# with any whitespace replaced by '-' and punctuation characters removed. +# The default value is: DOXYGEN. +# This tag requires that the tag MARKDOWN_SUPPORT is set to YES. + +MARKDOWN_ID_STYLE = DOXYGEN + +# When enabled doxygen tries to link words that correspond to documented +# classes, or namespaces to their corresponding documentation. Such a link can +# be prevented in individual cases by putting a % sign in front of the word or +# globally by setting AUTOLINK_SUPPORT to NO. +# The default value is: YES. + +AUTOLINK_SUPPORT = YES + +# If you use STL classes (i.e. std::string, std::vector, etc.) but do not want +# to include (a tag file for) the STL sources as input, then you should set this +# tag to YES in order to let doxygen match functions declarations and +# definitions whose arguments contain STL classes (e.g. func(std::string); +# versus func(std::string) {}). This also makes the inheritance and +# collaboration diagrams that involve STL classes more complete and accurate. +# The default value is: NO. + +BUILTIN_STL_SUPPORT = NO + +# If you use Microsoft's C++/CLI language, you should set this option to YES to +# enable parsing support. +# The default value is: NO. + +CPP_CLI_SUPPORT = NO + +# Set the SIP_SUPPORT tag to YES if your project consists of sip (see: +# https://www.riverbankcomputing.com/software) sources only. Doxygen will parse +# them like normal C++ but will assume all classes use public instead of private +# inheritance when no explicit protection keyword is present. +# The default value is: NO. + +SIP_SUPPORT = NO + +# For Microsoft's IDL there are propget and propput attributes to indicate +# getter and setter methods for a property. Setting this option to YES will make +# doxygen to replace the get and set methods by a property in the documentation. +# This will only work if the methods are indeed getting or setting a simple +# type. If this is not the case, or you want to show the methods anyway, you +# should set this option to NO. +# The default value is: YES. + +IDL_PROPERTY_SUPPORT = YES + +# If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC +# tag is set to YES then doxygen will reuse the documentation of the first +# member in the group (if any) for the other members of the group. By default +# all members of a group must be documented explicitly. +# The default value is: NO. + +DISTRIBUTE_GROUP_DOC = NO + +# If one adds a struct or class to a group and this option is enabled, then also +# any nested class or struct is added to the same group. By default this option +# is disabled and one has to add nested compounds explicitly via \ingroup. +# The default value is: NO. + +GROUP_NESTED_COMPOUNDS = NO + +# Set the SUBGROUPING tag to YES to allow class member groups of the same type +# (for instance a group of public functions) to be put as a subgroup of that +# type (e.g. under the Public Functions section). Set it to NO to prevent +# subgrouping. Alternatively, this can be done per class using the +# \nosubgrouping command. +# The default value is: YES. + +SUBGROUPING = YES + +# When the INLINE_GROUPED_CLASSES tag is set to YES, classes, structs and unions +# are shown inside the group in which they are included (e.g. using \ingroup) +# instead of on a separate page (for HTML and Man pages) or section (for LaTeX +# and RTF). +# +# Note that this feature does not work in combination with +# SEPARATE_MEMBER_PAGES. +# The default value is: NO. + +INLINE_GROUPED_CLASSES = NO + +# When the INLINE_SIMPLE_STRUCTS tag is set to YES, structs, classes, and unions +# with only public data fields or simple typedef fields will be shown inline in +# the documentation of the scope in which they are defined (i.e. file, +# namespace, or group documentation), provided this scope is documented. If set +# to NO, structs, classes, and unions are shown on a separate page (for HTML and +# Man pages) or section (for LaTeX and RTF). +# The default value is: NO. + +INLINE_SIMPLE_STRUCTS = NO + +# When TYPEDEF_HIDES_STRUCT tag is enabled, a typedef of a struct, union, or +# enum is documented as struct, union, or enum with the name of the typedef. So +# typedef struct TypeS {} TypeT, will appear in the documentation as a struct +# with name TypeT. When disabled the typedef will appear as a member of a file, +# namespace, or class. And the struct will be named TypeS. This can typically be +# useful for C code in case the coding convention dictates that all compound +# types are typedef'ed and only the typedef is referenced, never the tag name. +# The default value is: NO. + +TYPEDEF_HIDES_STRUCT = NO + +# The size of the symbol lookup cache can be set using LOOKUP_CACHE_SIZE. This +# cache is used to resolve symbols given their name and scope. Since this can be +# an expensive process and often the same symbol appears multiple times in the +# code, doxygen keeps a cache of pre-resolved symbols. If the cache is too small +# doxygen will become slower. If the cache is too large, memory is wasted. The +# cache size is given by this formula: 2^(16+LOOKUP_CACHE_SIZE). The valid range +# is 0..9, the default is 0, corresponding to a cache size of 2^16=65536 +# symbols. At the end of a run doxygen will report the cache usage and suggest +# the optimal cache size from a speed point of view. +# Minimum value: 0, maximum value: 9, default value: 0. + +LOOKUP_CACHE_SIZE = 0 + +# The NUM_PROC_THREADS specifies the number of threads doxygen is allowed to use +# during processing. When set to 0 doxygen will based this on the number of +# cores available in the system. You can set it explicitly to a value larger +# than 0 to get more control over the balance between CPU load and processing +# speed. At this moment only the input processing can be done using multiple +# threads. Since this is still an experimental feature the default is set to 1, +# which effectively disables parallel processing. Please report any issues you +# encounter. Generating dot graphs in parallel is controlled by the +# DOT_NUM_THREADS setting. +# Minimum value: 0, maximum value: 32, default value: 1. + +NUM_PROC_THREADS = 1 + +# If the TIMESTAMP tag is set different from NO then each generated page will +# contain the date or date and time when the page was generated. Setting this to +# NO can help when comparing the output of multiple runs. +# Possible values are: YES, NO, DATETIME and DATE. +# The default value is: NO. + +TIMESTAMP = NO + +#--------------------------------------------------------------------------- +# Build related configuration options +#--------------------------------------------------------------------------- + +# If the EXTRACT_ALL tag is set to YES, doxygen will assume all entities in +# documentation are documented, even if no documentation was available. Private +# class members and static file members will be hidden unless the +# EXTRACT_PRIVATE respectively EXTRACT_STATIC tags are set to YES. +# Note: This will also disable the warnings about undocumented members that are +# normally produced when WARNINGS is set to YES. +# The default value is: NO. + +EXTRACT_ALL = NO + +# If the EXTRACT_PRIVATE tag is set to YES, all private members of a class will +# be included in the documentation. +# The default value is: NO. + +EXTRACT_PRIVATE = NO + +# If the EXTRACT_PRIV_VIRTUAL tag is set to YES, documented private virtual +# methods of a class will be included in the documentation. +# The default value is: NO. + +EXTRACT_PRIV_VIRTUAL = NO + +# If the EXTRACT_PACKAGE tag is set to YES, all members with package or internal +# scope will be included in the documentation. +# The default value is: NO. + +EXTRACT_PACKAGE = NO + +# If the EXTRACT_STATIC tag is set to YES, all static members of a file will be +# included in the documentation. +# The default value is: NO. + +EXTRACT_STATIC = NO + +# If the EXTRACT_LOCAL_CLASSES tag is set to YES, classes (and structs) defined +# locally in source files will be included in the documentation. If set to NO, +# only classes defined in header files are included. Does not have any effect +# for Java sources. +# The default value is: YES. + +EXTRACT_LOCAL_CLASSES = YES + +# This flag is only useful for Objective-C code. If set to YES, local methods, +# which are defined in the implementation section but not in the interface are +# included in the documentation. If set to NO, only methods in the interface are +# included. +# The default value is: NO. + +EXTRACT_LOCAL_METHODS = NO + +# If this flag is set to YES, the members of anonymous namespaces will be +# extracted and appear in the documentation as a namespace called +# 'anonymous_namespace{file}', where file will be replaced with the base name of +# the file that contains the anonymous namespace. By default anonymous namespace +# are hidden. +# The default value is: NO. + +EXTRACT_ANON_NSPACES = NO + +# If this flag is set to YES, the name of an unnamed parameter in a declaration +# will be determined by the corresponding definition. By default unnamed +# parameters remain unnamed in the output. +# The default value is: YES. + +RESOLVE_UNNAMED_PARAMS = YES + +# If the HIDE_UNDOC_MEMBERS tag is set to YES, doxygen will hide all +# undocumented members inside documented classes or files. If set to NO these +# members will be included in the various overviews, but no documentation +# section is generated. This option has no effect if EXTRACT_ALL is enabled. +# The default value is: NO. + +HIDE_UNDOC_MEMBERS = NO + +# If the HIDE_UNDOC_CLASSES tag is set to YES, doxygen will hide all +# undocumented classes that are normally visible in the class hierarchy. If set +# to NO, these classes will be included in the various overviews. This option +# will also hide undocumented C++ concepts if enabled. This option has no effect +# if EXTRACT_ALL is enabled. +# The default value is: NO. + +HIDE_UNDOC_CLASSES = NO + +# If the HIDE_FRIEND_COMPOUNDS tag is set to YES, doxygen will hide all friend +# declarations. If set to NO, these declarations will be included in the +# documentation. +# The default value is: NO. + +HIDE_FRIEND_COMPOUNDS = NO + +# If the HIDE_IN_BODY_DOCS tag is set to YES, doxygen will hide any +# documentation blocks found inside the body of a function. If set to NO, these +# blocks will be appended to the function's detailed documentation block. +# The default value is: NO. + +HIDE_IN_BODY_DOCS = NO + +# The INTERNAL_DOCS tag determines if documentation that is typed after a +# \internal command is included. If the tag is set to NO then the documentation +# will be excluded. Set it to YES to include the internal documentation. +# The default value is: NO. + +INTERNAL_DOCS = NO + +# With the correct setting of option CASE_SENSE_NAMES doxygen will better be +# able to match the capabilities of the underlying filesystem. In case the +# filesystem is case sensitive (i.e. it supports files in the same directory +# whose names only differ in casing), the option must be set to YES to properly +# deal with such files in case they appear in the input. For filesystems that +# are not case sensitive the option should be set to NO to properly deal with +# output files written for symbols that only differ in casing, such as for two +# classes, one named CLASS and the other named Class, and to also support +# references to files without having to specify the exact matching casing. On +# Windows (including Cygwin) and MacOS, users should typically set this option +# to NO, whereas on Linux or other Unix flavors it should typically be set to +# YES. +# Possible values are: SYSTEM, NO and YES. +# The default value is: SYSTEM. + +CASE_SENSE_NAMES = SYSTEM + +# If the HIDE_SCOPE_NAMES tag is set to NO then doxygen will show members with +# their full class and namespace scopes in the documentation. If set to YES, the +# scope will be hidden. +# The default value is: NO. + +HIDE_SCOPE_NAMES = NO + +# If the HIDE_COMPOUND_REFERENCE tag is set to NO (default) then doxygen will +# append additional text to a page's title, such as Class Reference. If set to +# YES the compound reference will be hidden. +# The default value is: NO. + +HIDE_COMPOUND_REFERENCE= NO + +# If the SHOW_HEADERFILE tag is set to YES then the documentation for a class +# will show which file needs to be included to use the class. +# The default value is: YES. + +SHOW_HEADERFILE = YES + +# If the SHOW_INCLUDE_FILES tag is set to YES then doxygen will put a list of +# the files that are included by a file in the documentation of that file. +# The default value is: YES. + +SHOW_INCLUDE_FILES = YES + +# If the SHOW_GROUPED_MEMB_INC tag is set to YES then Doxygen will add for each +# grouped member an include statement to the documentation, telling the reader +# which file to include in order to use the member. +# The default value is: NO. + +SHOW_GROUPED_MEMB_INC = NO + +# If the FORCE_LOCAL_INCLUDES tag is set to YES then doxygen will list include +# files with double quotes in the documentation rather than with sharp brackets. +# The default value is: NO. + +FORCE_LOCAL_INCLUDES = NO + +# If the INLINE_INFO tag is set to YES then a tag [inline] is inserted in the +# documentation for inline members. +# The default value is: YES. + +INLINE_INFO = YES + +# If the SORT_MEMBER_DOCS tag is set to YES then doxygen will sort the +# (detailed) documentation of file and class members alphabetically by member +# name. If set to NO, the members will appear in declaration order. +# The default value is: YES. + +SORT_MEMBER_DOCS = YES + +# If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the brief +# descriptions of file, namespace and class members alphabetically by member +# name. If set to NO, the members will appear in declaration order. Note that +# this will also influence the order of the classes in the class list. +# The default value is: NO. + +SORT_BRIEF_DOCS = NO + +# If the SORT_MEMBERS_CTORS_1ST tag is set to YES then doxygen will sort the +# (brief and detailed) documentation of class members so that constructors and +# destructors are listed first. If set to NO the constructors will appear in the +# respective orders defined by SORT_BRIEF_DOCS and SORT_MEMBER_DOCS. +# Note: If SORT_BRIEF_DOCS is set to NO this option is ignored for sorting brief +# member documentation. +# Note: If SORT_MEMBER_DOCS is set to NO this option is ignored for sorting +# detailed member documentation. +# The default value is: NO. + +SORT_MEMBERS_CTORS_1ST = NO + +# If the SORT_GROUP_NAMES tag is set to YES then doxygen will sort the hierarchy +# of group names into alphabetical order. If set to NO the group names will +# appear in their defined order. +# The default value is: NO. + +SORT_GROUP_NAMES = NO + +# If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be sorted by +# fully-qualified names, including namespaces. If set to NO, the class list will +# be sorted only by class name, not including the namespace part. +# Note: This option is not very useful if HIDE_SCOPE_NAMES is set to YES. +# Note: This option applies only to the class list, not to the alphabetical +# list. +# The default value is: NO. + +SORT_BY_SCOPE_NAME = NO + +# If the STRICT_PROTO_MATCHING option is enabled and doxygen fails to do proper +# type resolution of all parameters of a function it will reject a match between +# the prototype and the implementation of a member function even if there is +# only one candidate or it is obvious which candidate to choose by doing a +# simple string match. By disabling STRICT_PROTO_MATCHING doxygen will still +# accept a match between prototype and implementation in such cases. +# The default value is: NO. + +STRICT_PROTO_MATCHING = NO + +# The GENERATE_TODOLIST tag can be used to enable (YES) or disable (NO) the todo +# list. This list is created by putting \todo commands in the documentation. +# The default value is: YES. + +GENERATE_TODOLIST = YES + +# The GENERATE_TESTLIST tag can be used to enable (YES) or disable (NO) the test +# list. This list is created by putting \test commands in the documentation. +# The default value is: YES. + +GENERATE_TESTLIST = YES + +# The GENERATE_BUGLIST tag can be used to enable (YES) or disable (NO) the bug +# list. This list is created by putting \bug commands in the documentation. +# The default value is: YES. + +GENERATE_BUGLIST = YES + +# The GENERATE_DEPRECATEDLIST tag can be used to enable (YES) or disable (NO) +# the deprecated list. This list is created by putting \deprecated commands in +# the documentation. +# The default value is: YES. + +GENERATE_DEPRECATEDLIST= YES + +# The ENABLED_SECTIONS tag can be used to enable conditional documentation +# sections, marked by \if ... \endif and \cond +# ... \endcond blocks. + +ENABLED_SECTIONS = + +# The MAX_INITIALIZER_LINES tag determines the maximum number of lines that the +# initial value of a variable or macro / define can have for it to appear in the +# documentation. If the initializer consists of more lines than specified here +# it will be hidden. Use a value of 0 to hide initializers completely. The +# appearance of the value of individual variables and macros / defines can be +# controlled using \showinitializer or \hideinitializer command in the +# documentation regardless of this setting. +# Minimum value: 0, maximum value: 10000, default value: 30. + +MAX_INITIALIZER_LINES = 30 + +# Set the SHOW_USED_FILES tag to NO to disable the list of files generated at +# the bottom of the documentation of classes and structs. If set to YES, the +# list will mention the files that were used to generate the documentation. +# The default value is: YES. + +SHOW_USED_FILES = YES + +# Set the SHOW_FILES tag to NO to disable the generation of the Files page. This +# will remove the Files entry from the Quick Index and from the Folder Tree View +# (if specified). +# The default value is: YES. + +SHOW_FILES = YES + +# Set the SHOW_NAMESPACES tag to NO to disable the generation of the Namespaces +# page. This will remove the Namespaces entry from the Quick Index and from the +# Folder Tree View (if specified). +# The default value is: YES. + +SHOW_NAMESPACES = YES + +# The FILE_VERSION_FILTER tag can be used to specify a program or script that +# doxygen should invoke to get the current version for each file (typically from +# the version control system). Doxygen will invoke the program by executing (via +# popen()) the command command input-file, where command is the value of the +# FILE_VERSION_FILTER tag, and input-file is the name of an input file provided +# by doxygen. Whatever the program writes to standard output is used as the file +# version. For an example see the documentation. + +FILE_VERSION_FILTER = + +# The LAYOUT_FILE tag can be used to specify a layout file which will be parsed +# by doxygen. The layout file controls the global structure of the generated +# output files in an output format independent way. To create the layout file +# that represents doxygen's defaults, run doxygen with the -l option. You can +# optionally specify a file name after the option, if omitted DoxygenLayout.xml +# will be used as the name of the layout file. See also section "Changing the +# layout of pages" for information. +# +# Note that if you run doxygen from a directory containing a file called +# DoxygenLayout.xml, doxygen will parse it automatically even if the LAYOUT_FILE +# tag is left empty. + +LAYOUT_FILE = + +# The CITE_BIB_FILES tag can be used to specify one or more bib files containing +# the reference definitions. This must be a list of .bib files. The .bib +# extension is automatically appended if omitted. This requires the bibtex tool +# to be installed. See also https://en.wikipedia.org/wiki/BibTeX for more info. +# For LaTeX the style of the bibliography can be controlled using +# LATEX_BIB_STYLE. To use this feature you need bibtex and perl available in the +# search path. See also \cite for info how to create references. + +CITE_BIB_FILES = + +#--------------------------------------------------------------------------- +# Configuration options related to warning and progress messages +#--------------------------------------------------------------------------- + +# The QUIET tag can be used to turn on/off the messages that are generated to +# standard output by doxygen. If QUIET is set to YES this implies that the +# messages are off. +# The default value is: NO. + +QUIET = NO + +# The WARNINGS tag can be used to turn on/off the warning messages that are +# generated to standard error (stderr) by doxygen. If WARNINGS is set to YES +# this implies that the warnings are on. +# +# Tip: Turn warnings on while writing the documentation. +# The default value is: YES. + +WARNINGS = YES + +# If the WARN_IF_UNDOCUMENTED tag is set to YES then doxygen will generate +# warnings for undocumented members. If EXTRACT_ALL is set to YES then this flag +# will automatically be disabled. +# The default value is: YES. + +WARN_IF_UNDOCUMENTED = YES + +# If the WARN_IF_DOC_ERROR tag is set to YES, doxygen will generate warnings for +# potential errors in the documentation, such as documenting some parameters in +# a documented function twice, or documenting parameters that don't exist or +# using markup commands wrongly. +# The default value is: YES. + +WARN_IF_DOC_ERROR = YES + +# If WARN_IF_INCOMPLETE_DOC is set to YES, doxygen will warn about incomplete +# function parameter documentation. If set to NO, doxygen will accept that some +# parameters have no documentation without warning. +# The default value is: YES. + +WARN_IF_INCOMPLETE_DOC = YES + +# This WARN_NO_PARAMDOC option can be enabled to get warnings for functions that +# are documented, but have no documentation for their parameters or return +# value. If set to NO, doxygen will only warn about wrong parameter +# documentation, but not about the absence of documentation. If EXTRACT_ALL is +# set to YES then this flag will automatically be disabled. See also +# WARN_IF_INCOMPLETE_DOC +# The default value is: NO. + +WARN_NO_PARAMDOC = NO + +# If WARN_IF_UNDOC_ENUM_VAL option is set to YES, doxygen will warn about +# undocumented enumeration values. If set to NO, doxygen will accept +# undocumented enumeration values. If EXTRACT_ALL is set to YES then this flag +# will automatically be disabled. +# The default value is: NO. + +WARN_IF_UNDOC_ENUM_VAL = NO + +# If the WARN_AS_ERROR tag is set to YES then doxygen will immediately stop when +# a warning is encountered. If the WARN_AS_ERROR tag is set to FAIL_ON_WARNINGS +# then doxygen will continue running as if WARN_AS_ERROR tag is set to NO, but +# at the end of the doxygen process doxygen will return with a non-zero status. +# If the WARN_AS_ERROR tag is set to FAIL_ON_WARNINGS_PRINT then doxygen behaves +# like FAIL_ON_WARNINGS but in case no WARN_LOGFILE is defined doxygen will not +# write the warning messages in between other messages but write them at the end +# of a run, in case a WARN_LOGFILE is defined the warning messages will be +# besides being in the defined file also be shown at the end of a run, unless +# the WARN_LOGFILE is defined as - i.e. standard output (stdout) in that case +# the behavior will remain as with the setting FAIL_ON_WARNINGS. +# Possible values are: NO, YES, FAIL_ON_WARNINGS and FAIL_ON_WARNINGS_PRINT. +# The default value is: NO. + +WARN_AS_ERROR = NO + +# The WARN_FORMAT tag determines the format of the warning messages that doxygen +# can produce. The string should contain the $file, $line, and $text tags, which +# will be replaced by the file and line number from which the warning originated +# and the warning text. Optionally the format may contain $version, which will +# be replaced by the version of the file (if it could be obtained via +# FILE_VERSION_FILTER) +# See also: WARN_LINE_FORMAT +# The default value is: $file:$line: $text. + +WARN_FORMAT = "$file:$line: $text" + +# In the $text part of the WARN_FORMAT command it is possible that a reference +# to a more specific place is given. To make it easier to jump to this place +# (outside of doxygen) the user can define a custom "cut" / "paste" string. +# Example: +# WARN_LINE_FORMAT = "'vi $file +$line'" +# See also: WARN_FORMAT +# The default value is: at line $line of file $file. + +WARN_LINE_FORMAT = "at line $line of file $file" + +# The WARN_LOGFILE tag can be used to specify a file to which warning and error +# messages should be written. If left blank the output is written to standard +# error (stderr). In case the file specified cannot be opened for writing the +# warning and error messages are written to standard error. When as file - is +# specified the warning and error messages are written to standard output +# (stdout). + +WARN_LOGFILE = + +#--------------------------------------------------------------------------- +# Configuration options related to the input files +#--------------------------------------------------------------------------- + +# The INPUT tag is used to specify the files and/or directories that contain +# documented source files. You may enter file names like myfile.cpp or +# directories like /usr/src/myproject. Separate the files or directories with +# spaces. See also FILE_PATTERNS and EXTENSION_MAPPING +# Note: If this tag is empty the current directory is searched. + +INPUT = ../bayesnet +INPUT += ../README.md + +# This tag can be used to specify the character encoding of the source files +# that doxygen parses. Internally doxygen uses the UTF-8 encoding. Doxygen uses +# libiconv (or the iconv built into libc) for the transcoding. See the libiconv +# documentation (see: +# https://www.gnu.org/software/libiconv/) for the list of possible encodings. +# See also: INPUT_FILE_ENCODING +# The default value is: UTF-8. + +INPUT_ENCODING = UTF-8 + +# This tag can be used to specify the character encoding of the source files +# that doxygen parses The INPUT_FILE_ENCODING tag can be used to specify +# character encoding on a per file pattern basis. Doxygen will compare the file +# name with each pattern and apply the encoding instead of the default +# INPUT_ENCODING) if there is a match. The character encodings are a list of the +# form: pattern=encoding (like *.php=ISO-8859-1). +# See also: INPUT_ENCODING for further information on supported encodings. + +INPUT_FILE_ENCODING = + +# If the value of the INPUT tag contains directories, you can use the +# FILE_PATTERNS tag to specify one or more wildcard patterns (like *.cpp and +# *.h) to filter out the source-files in the directories. +# +# Note that for custom extensions or not directly supported extensions you also +# need to set EXTENSION_MAPPING for the extension otherwise the files are not +# read by doxygen. +# +# Note the list of default checked file patterns might differ from the list of +# default file extension mappings. +# +# If left blank the following patterns are tested:*.c, *.cc, *.cxx, *.cxxm, +# *.cpp, *.cppm, *.ccm, *.c++, *.c++m, *.java, *.ii, *.ixx, *.ipp, *.i++, *.inl, +# *.idl, *.ddl, *.odl, *.h, *.hh, *.hxx, *.hpp, *.h++, *.ixx, *.l, *.cs, *.d, +# *.php, *.php4, *.php5, *.phtml, *.inc, *.m, *.markdown, *.md, *.mm, *.dox (to +# be provided as doxygen C comment), *.py, *.pyw, *.f90, *.f95, *.f03, *.f08, +# *.f18, *.f, *.for, *.vhd, *.vhdl, *.ucf, *.qsf and *.ice. + +FILE_PATTERNS = *.c \ + *.cc \ + *.cxx \ + *.cxxm \ + *.cpp \ + *.cppm \ + *.ccm \ + *.c++ \ + *.c++m \ + *.java \ + *.ii \ + *.ixx \ + *.ipp \ + *.i++ \ + *.inl \ + *.idl \ + *.ddl \ + *.odl \ + *.h \ + *.hh \ + *.hxx \ + *.hpp \ + *.h++ \ + *.ixx \ + *.l \ + *.cs \ + *.d \ + *.php \ + *.php4 \ + *.php5 \ + *.phtml \ + *.inc \ + *.m \ + *.markdown \ + *.md \ + *.mm \ + *.dox \ + *.py \ + *.pyw \ + *.f90 \ + *.f95 \ + *.f03 \ + *.f08 \ + *.f18 \ + *.f \ + *.for \ + *.vhd \ + *.vhdl \ + *.ucf \ + *.qsf \ + *.ice + +# The RECURSIVE tag can be used to specify whether or not subdirectories should +# be searched for input files as well. +# The default value is: NO. + +RECURSIVE = YES + +# The EXCLUDE tag can be used to specify files and/or directories that should be +# excluded from the INPUT source files. This way you can easily exclude a +# subdirectory from a directory tree whose root is specified with the INPUT tag. +# +# Note that relative paths are relative to the directory from which doxygen is +# run. + +EXCLUDE = feature_selection/* \ + utils/* \ + tests/* \ + examples/* \ + bayesnet/tests/* \ + bayesnet/examples/* \ + bayesnet/utils/* \ + bayesnet/feature_selection/* +EXCLUDE += utils/* + +# The EXCLUDE_SYMLINKS tag can be used to select whether or not files or +# directories that are symbolic links (a Unix file system feature) are excluded +# from the input. +# The default value is: NO. + +EXCLUDE_SYMLINKS = NO + +# If the value of the INPUT tag contains directories, you can use the +# EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude +# certain files from those directories. +# +# Note that the wildcards are matched against the file with absolute path, so to +# exclude all test directories for example use the pattern */test/* + +EXCLUDE_PATTERNS = */feature_selection/* +EXCLUDE_PATTERNS += */utils/* + +# The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names +# (namespaces, classes, functions, etc.) that should be excluded from the +# output. The symbol name can be a fully qualified name, a word, or if the +# wildcard * is used, a substring. Examples: ANamespace, AClass, +# ANamespace::AClass, ANamespace::*Test + +EXCLUDE_SYMBOLS = + +# The EXAMPLE_PATH tag can be used to specify one or more files or directories +# that contain example code fragments that are included (see the \include +# command). + +EXAMPLE_PATH = + +# If the value of the EXAMPLE_PATH tag contains directories, you can use the +# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp and +# *.h) to filter out the source-files in the directories. If left blank all +# files are included. + +EXAMPLE_PATTERNS = * + +# If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be +# searched for input files to be used with the \include or \dontinclude commands +# irrespective of the value of the RECURSIVE tag. +# The default value is: NO. + +EXAMPLE_RECURSIVE = NO + +# The IMAGE_PATH tag can be used to specify one or more files or directories +# that contain images that are to be included in the documentation (see the +# \image command). + +IMAGE_PATH = + +# The INPUT_FILTER tag can be used to specify a program that doxygen should +# invoke to filter for each input file. Doxygen will invoke the filter program +# by executing (via popen()) the command: +# +# +# +# where is the value of the INPUT_FILTER tag, and is the +# name of an input file. Doxygen will then use the output that the filter +# program writes to standard output. If FILTER_PATTERNS is specified, this tag +# will be ignored. +# +# Note that the filter must not add or remove lines; it is applied before the +# code is scanned, but not when the output code is generated. If lines are added +# or removed, the anchors will not be placed correctly. +# +# Note that doxygen will use the data processed and written to standard output +# for further processing, therefore nothing else, like debug statements or used +# commands (so in case of a Windows batch file always use @echo OFF), should be +# written to standard output. +# +# Note that for custom extensions or not directly supported extensions you also +# need to set EXTENSION_MAPPING for the extension otherwise the files are not +# properly processed by doxygen. + +INPUT_FILTER = + +# The FILTER_PATTERNS tag can be used to specify filters on a per file pattern +# basis. Doxygen will compare the file name with each pattern and apply the +# filter if there is a match. The filters are a list of the form: pattern=filter +# (like *.cpp=my_cpp_filter). See INPUT_FILTER for further information on how +# filters are used. If the FILTER_PATTERNS tag is empty or if none of the +# patterns match the file name, INPUT_FILTER is applied. +# +# Note that for custom extensions or not directly supported extensions you also +# need to set EXTENSION_MAPPING for the extension otherwise the files are not +# properly processed by doxygen. + +FILTER_PATTERNS = + +# If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using +# INPUT_FILTER) will also be used to filter the input files that are used for +# producing the source files to browse (i.e. when SOURCE_BROWSER is set to YES). +# The default value is: NO. + +FILTER_SOURCE_FILES = NO + +# The FILTER_SOURCE_PATTERNS tag can be used to specify source filters per file +# pattern. A pattern will override the setting for FILTER_PATTERN (if any) and +# it is also possible to disable source filtering for a specific pattern using +# *.ext= (so without naming a filter). +# This tag requires that the tag FILTER_SOURCE_FILES is set to YES. + +FILTER_SOURCE_PATTERNS = + +# If the USE_MDFILE_AS_MAINPAGE tag refers to the name of a markdown file that +# is part of the input, its contents will be placed on the main page +# (index.html). This can be useful if you have a project on for instance GitHub +# and want to reuse the introduction page also for the doxygen output. + +USE_MDFILE_AS_MAINPAGE = README.md + +# The Fortran standard specifies that for fixed formatted Fortran code all +# characters from position 72 are to be considered as comment. A common +# extension is to allow longer lines before the automatic comment starts. The +# setting FORTRAN_COMMENT_AFTER will also make it possible that longer lines can +# be processed before the automatic comment starts. +# Minimum value: 7, maximum value: 10000, default value: 72. + +FORTRAN_COMMENT_AFTER = 72 + +#--------------------------------------------------------------------------- +# Configuration options related to source browsing +#--------------------------------------------------------------------------- + +# If the SOURCE_BROWSER tag is set to YES then a list of source files will be +# generated. Documented entities will be cross-referenced with these sources. +# +# Note: To get rid of all source code in the generated output, make sure that +# also VERBATIM_HEADERS is set to NO. +# The default value is: NO. + +SOURCE_BROWSER = YES + +# Setting the INLINE_SOURCES tag to YES will include the body of functions, +# multi-line macros, enums or list initialized variables directly into the +# documentation. +# The default value is: NO. + +INLINE_SOURCES = NO + +# Setting the STRIP_CODE_COMMENTS tag to YES will instruct doxygen to hide any +# special comment blocks from generated source code fragments. Normal C, C++ and +# Fortran comments will always remain visible. +# The default value is: YES. + +STRIP_CODE_COMMENTS = YES + +# If the REFERENCED_BY_RELATION tag is set to YES then for each documented +# entity all documented functions referencing it will be listed. +# The default value is: NO. + +REFERENCED_BY_RELATION = NO + +# If the REFERENCES_RELATION tag is set to YES then for each documented function +# all documented entities called/used by that function will be listed. +# The default value is: NO. + +REFERENCES_RELATION = NO + +# If the REFERENCES_LINK_SOURCE tag is set to YES and SOURCE_BROWSER tag is set +# to YES then the hyperlinks from functions in REFERENCES_RELATION and +# REFERENCED_BY_RELATION lists will link to the source code. Otherwise they will +# link to the documentation. +# The default value is: YES. + +REFERENCES_LINK_SOURCE = YES + +# If SOURCE_TOOLTIPS is enabled (the default) then hovering a hyperlink in the +# source code will show a tooltip with additional information such as prototype, +# brief description and links to the definition and documentation. Since this +# will make the HTML file larger and loading of large files a bit slower, you +# can opt to disable this feature. +# The default value is: YES. +# This tag requires that the tag SOURCE_BROWSER is set to YES. + +SOURCE_TOOLTIPS = YES + +# If the USE_HTAGS tag is set to YES then the references to source code will +# point to the HTML generated by the htags(1) tool instead of doxygen built-in +# source browser. The htags tool is part of GNU's global source tagging system +# (see https://www.gnu.org/software/global/global.html). You will need version +# 4.8.6 or higher. +# +# To use it do the following: +# - Install the latest version of global +# - Enable SOURCE_BROWSER and USE_HTAGS in the configuration file +# - Make sure the INPUT points to the root of the source tree +# - Run doxygen as normal +# +# Doxygen will invoke htags (and that will in turn invoke gtags), so these +# tools must be available from the command line (i.e. in the search path). +# +# The result: instead of the source browser generated by doxygen, the links to +# source code will now point to the output of htags. +# The default value is: NO. +# This tag requires that the tag SOURCE_BROWSER is set to YES. + +USE_HTAGS = NO + +# If the VERBATIM_HEADERS tag is set the YES then doxygen will generate a +# verbatim copy of the header file for each class for which an include is +# specified. Set to NO to disable this. +# See also: Section \class. +# The default value is: YES. + +VERBATIM_HEADERS = YES + +# If the CLANG_ASSISTED_PARSING tag is set to YES then doxygen will use the +# clang parser (see: +# http://clang.llvm.org/) for more accurate parsing at the cost of reduced +# performance. This can be particularly helpful with template rich C++ code for +# which doxygen's built-in parser lacks the necessary type information. +# Note: The availability of this option depends on whether or not doxygen was +# generated with the -Duse_libclang=ON option for CMake. +# The default value is: NO. + +CLANG_ASSISTED_PARSING = NO + +# If the CLANG_ASSISTED_PARSING tag is set to YES and the CLANG_ADD_INC_PATHS +# tag is set to YES then doxygen will add the directory of each input to the +# include path. +# The default value is: YES. +# This tag requires that the tag CLANG_ASSISTED_PARSING is set to YES. + +CLANG_ADD_INC_PATHS = YES + +# If clang assisted parsing is enabled you can provide the compiler with command +# line options that you would normally use when invoking the compiler. Note that +# the include paths will already be set by doxygen for the files and directories +# specified with INPUT and INCLUDE_PATH. +# This tag requires that the tag CLANG_ASSISTED_PARSING is set to YES. + +CLANG_OPTIONS = + +# If clang assisted parsing is enabled you can provide the clang parser with the +# path to the directory containing a file called compile_commands.json. This +# file is the compilation database (see: +# http://clang.llvm.org/docs/HowToSetupToolingForLLVM.html) containing the +# options used when the source files were built. This is equivalent to +# specifying the -p option to a clang tool, such as clang-check. These options +# will then be passed to the parser. Any options specified with CLANG_OPTIONS +# will be added as well. +# Note: The availability of this option depends on whether or not doxygen was +# generated with the -Duse_libclang=ON option for CMake. + +CLANG_DATABASE_PATH = + +#--------------------------------------------------------------------------- +# Configuration options related to the alphabetical class index +#--------------------------------------------------------------------------- + +# If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index of all +# compounds will be generated. Enable this if the project contains a lot of +# classes, structs, unions or interfaces. +# The default value is: YES. + +ALPHABETICAL_INDEX = YES + +# The IGNORE_PREFIX tag can be used to specify a prefix (or a list of prefixes) +# that should be ignored while generating the index headers. The IGNORE_PREFIX +# tag works for classes, function and member names. The entity will be placed in +# the alphabetical list under the first letter of the entity name that remains +# after removing the prefix. +# This tag requires that the tag ALPHABETICAL_INDEX is set to YES. + +IGNORE_PREFIX = + +#--------------------------------------------------------------------------- +# Configuration options related to the HTML output +#--------------------------------------------------------------------------- + +# If the GENERATE_HTML tag is set to YES, doxygen will generate HTML output +# The default value is: YES. + +GENERATE_HTML = YES + +# The HTML_OUTPUT tag is used to specify where the HTML docs will be put. If a +# relative path is entered the value of OUTPUT_DIRECTORY will be put in front of +# it. +# The default directory is: html. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_OUTPUT = manual + +# The HTML_FILE_EXTENSION tag can be used to specify the file extension for each +# generated HTML page (for example: .htm, .php, .asp). +# The default value is: .html. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_FILE_EXTENSION = .html + +# The HTML_HEADER tag can be used to specify a user-defined HTML header file for +# each generated HTML page. If the tag is left blank doxygen will generate a +# standard header. +# +# To get valid HTML the header file that includes any scripts and style sheets +# that doxygen needs, which is dependent on the configuration options used (e.g. +# the setting GENERATE_TREEVIEW). It is highly recommended to start with a +# default header using +# doxygen -w html new_header.html new_footer.html new_stylesheet.css +# YourConfigFile +# and then modify the file new_header.html. See also section "Doxygen usage" +# for information on how to generate the default header that doxygen normally +# uses. +# Note: The header is subject to change so you typically have to regenerate the +# default header when upgrading to a newer version of doxygen. For a description +# of the possible markers and block names see the documentation. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_HEADER = + +# The HTML_FOOTER tag can be used to specify a user-defined HTML footer for each +# generated HTML page. If the tag is left blank doxygen will generate a standard +# footer. See HTML_HEADER for more information on how to generate a default +# footer and what special commands can be used inside the footer. See also +# section "Doxygen usage" for information on how to generate the default footer +# that doxygen normally uses. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_FOOTER = + +# The HTML_STYLESHEET tag can be used to specify a user-defined cascading style +# sheet that is used by each HTML page. It can be used to fine-tune the look of +# the HTML output. If left blank doxygen will generate a default style sheet. +# See also section "Doxygen usage" for information on how to generate the style +# sheet that doxygen normally uses. +# Note: It is recommended to use HTML_EXTRA_STYLESHEET instead of this tag, as +# it is more robust and this tag (HTML_STYLESHEET) will in the future become +# obsolete. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_STYLESHEET = + +# The HTML_EXTRA_STYLESHEET tag can be used to specify additional user-defined +# cascading style sheets that are included after the standard style sheets +# created by doxygen. Using this option one can overrule certain style aspects. +# This is preferred over using HTML_STYLESHEET since it does not replace the +# standard style sheet and is therefore more robust against future updates. +# Doxygen will copy the style sheet files to the output directory. +# Note: The order of the extra style sheet files is of importance (e.g. the last +# style sheet in the list overrules the setting of the previous ones in the +# list). +# Note: Since the styling of scrollbars can currently not be overruled in +# Webkit/Chromium, the styling will be left out of the default doxygen.css if +# one or more extra stylesheets have been specified. So if scrollbar +# customization is desired it has to be added explicitly. For an example see the +# documentation. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_EXTRA_STYLESHEET = + +# The HTML_EXTRA_FILES tag can be used to specify one or more extra images or +# other source files which should be copied to the HTML output directory. Note +# that these files will be copied to the base HTML output directory. Use the +# $relpath^ marker in the HTML_HEADER and/or HTML_FOOTER files to load these +# files. In the HTML_STYLESHEET file, use the file name only. Also note that the +# files will be copied as-is; there are no commands or markers available. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_EXTRA_FILES = ../logo.png + +# The HTML_COLORSTYLE tag can be used to specify if the generated HTML output +# should be rendered with a dark or light theme. +# Possible values are: LIGHT always generates light mode output, DARK always +# generates dark mode output, AUTO_LIGHT automatically sets the mode according +# to the user preference, uses light mode if no preference is set (the default), +# AUTO_DARK automatically sets the mode according to the user preference, uses +# dark mode if no preference is set and TOGGLE allows a user to switch between +# light and dark mode via a button. +# The default value is: AUTO_LIGHT. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_COLORSTYLE = AUTO_LIGHT + +# The HTML_COLORSTYLE_HUE tag controls the color of the HTML output. Doxygen +# will adjust the colors in the style sheet and background images according to +# this color. Hue is specified as an angle on a color-wheel, see +# https://en.wikipedia.org/wiki/Hue for more information. For instance the value +# 0 represents red, 60 is yellow, 120 is green, 180 is cyan, 240 is blue, 300 +# purple, and 360 is red again. +# Minimum value: 0, maximum value: 359, default value: 220. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_COLORSTYLE_HUE = 220 + +# The HTML_COLORSTYLE_SAT tag controls the purity (or saturation) of the colors +# in the HTML output. For a value of 0 the output will use gray-scales only. A +# value of 255 will produce the most vivid colors. +# Minimum value: 0, maximum value: 255, default value: 100. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_COLORSTYLE_SAT = 100 + +# The HTML_COLORSTYLE_GAMMA tag controls the gamma correction applied to the +# luminance component of the colors in the HTML output. Values below 100 +# gradually make the output lighter, whereas values above 100 make the output +# darker. The value divided by 100 is the actual gamma applied, so 80 represents +# a gamma of 0.8, The value 220 represents a gamma of 2.2, and 100 does not +# change the gamma. +# Minimum value: 40, maximum value: 240, default value: 80. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_COLORSTYLE_GAMMA = 80 + +# If the HTML_DYNAMIC_MENUS tag is set to YES then the generated HTML +# documentation will contain a main index with vertical navigation menus that +# are dynamically created via JavaScript. If disabled, the navigation index will +# consists of multiple levels of tabs that are statically embedded in every HTML +# page. Disable this option to support browsers that do not have JavaScript, +# like the Qt help browser. +# The default value is: YES. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_DYNAMIC_MENUS = YES + +# If the HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML +# documentation will contain sections that can be hidden and shown after the +# page has loaded. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_DYNAMIC_SECTIONS = NO + +# If the HTML_CODE_FOLDING tag is set to YES then classes and functions can be +# dynamically folded and expanded in the generated HTML source code. +# The default value is: YES. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_CODE_FOLDING = YES + +# If the HTML_COPY_CLIPBOARD tag is set to YES then doxygen will show an icon in +# the top right corner of code and text fragments that allows the user to copy +# its content to the clipboard. Note this only works if supported by the browser +# and the web page is served via a secure context (see: +# https://www.w3.org/TR/secure-contexts/), i.e. using the https: or file: +# protocol. +# The default value is: YES. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_COPY_CLIPBOARD = YES + +# Doxygen stores a couple of settings persistently in the browser (via e.g. +# cookies). By default these settings apply to all HTML pages generated by +# doxygen across all projects. The HTML_PROJECT_COOKIE tag can be used to store +# the settings under a project specific key, such that the user preferences will +# be stored separately. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_PROJECT_COOKIE = + +# With HTML_INDEX_NUM_ENTRIES one can control the preferred number of entries +# shown in the various tree structured indices initially; the user can expand +# and collapse entries dynamically later on. Doxygen will expand the tree to +# such a level that at most the specified number of entries are visible (unless +# a fully collapsed tree already exceeds this amount). So setting the number of +# entries 1 will produce a full collapsed tree by default. 0 is a special value +# representing an infinite number of entries and will result in a full expanded +# tree by default. +# Minimum value: 0, maximum value: 9999, default value: 100. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_INDEX_NUM_ENTRIES = 100 + +# If the GENERATE_DOCSET tag is set to YES, additional index files will be +# generated that can be used as input for Apple's Xcode 3 integrated development +# environment (see: +# https://developer.apple.com/xcode/), introduced with OSX 10.5 (Leopard). To +# create a documentation set, doxygen will generate a Makefile in the HTML +# output directory. Running make will produce the docset in that directory and +# running make install will install the docset in +# ~/Library/Developer/Shared/Documentation/DocSets so that Xcode will find it at +# startup. See https://developer.apple.com/library/archive/featuredarticles/Doxy +# genXcode/_index.html for more information. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTML is set to YES. + +GENERATE_DOCSET = NO + +# This tag determines the name of the docset feed. A documentation feed provides +# an umbrella under which multiple documentation sets from a single provider +# (such as a company or product suite) can be grouped. +# The default value is: Doxygen generated docs. +# This tag requires that the tag GENERATE_DOCSET is set to YES. + +DOCSET_FEEDNAME = "Doxygen generated docs" + +# This tag determines the URL of the docset feed. A documentation feed provides +# an umbrella under which multiple documentation sets from a single provider +# (such as a company or product suite) can be grouped. +# This tag requires that the tag GENERATE_DOCSET is set to YES. + +DOCSET_FEEDURL = + +# This tag specifies a string that should uniquely identify the documentation +# set bundle. This should be a reverse domain-name style string, e.g. +# com.mycompany.MyDocSet. Doxygen will append .docset to the name. +# The default value is: org.doxygen.Project. +# This tag requires that the tag GENERATE_DOCSET is set to YES. + +DOCSET_BUNDLE_ID = org.doxygen.Project + +# The DOCSET_PUBLISHER_ID tag specifies a string that should uniquely identify +# the documentation publisher. This should be a reverse domain-name style +# string, e.g. com.mycompany.MyDocSet.documentation. +# The default value is: org.doxygen.Publisher. +# This tag requires that the tag GENERATE_DOCSET is set to YES. + +DOCSET_PUBLISHER_ID = org.doxygen.Publisher + +# The DOCSET_PUBLISHER_NAME tag identifies the documentation publisher. +# The default value is: Publisher. +# This tag requires that the tag GENERATE_DOCSET is set to YES. + +DOCSET_PUBLISHER_NAME = Ricardo Montañana Gómez + +# If the GENERATE_HTMLHELP tag is set to YES then doxygen generates three +# additional HTML index files: index.hhp, index.hhc, and index.hhk. The +# index.hhp is a project file that can be read by Microsoft's HTML Help Workshop +# on Windows. In the beginning of 2021 Microsoft took the original page, with +# a.o. the download links, offline the HTML help workshop was already many years +# in maintenance mode). You can download the HTML help workshop from the web +# archives at Installation executable (see: +# http://web.archive.org/web/20160201063255/http://download.microsoft.com/downlo +# ad/0/A/9/0A939EF6-E31C-430F-A3DF-DFAE7960D564/htmlhelp.exe). +# +# The HTML Help Workshop contains a compiler that can convert all HTML output +# generated by doxygen into a single compiled HTML file (.chm). Compiled HTML +# files are now used as the Windows 98 help format, and will replace the old +# Windows help format (.hlp) on all Windows platforms in the future. Compressed +# HTML files also contain an index, a table of contents, and you can search for +# words in the documentation. The HTML workshop also contains a viewer for +# compressed HTML files. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTML is set to YES. + +GENERATE_HTMLHELP = NO + +# The CHM_FILE tag can be used to specify the file name of the resulting .chm +# file. You can add a path in front of the file if the result should not be +# written to the html output directory. +# This tag requires that the tag GENERATE_HTMLHELP is set to YES. + +CHM_FILE = + +# The HHC_LOCATION tag can be used to specify the location (absolute path +# including file name) of the HTML help compiler (hhc.exe). If non-empty, +# doxygen will try to run the HTML help compiler on the generated index.hhp. +# The file has to be specified with full path. +# This tag requires that the tag GENERATE_HTMLHELP is set to YES. + +HHC_LOCATION = + +# The GENERATE_CHI flag controls if a separate .chi index file is generated +# (YES) or that it should be included in the main .chm file (NO). +# The default value is: NO. +# This tag requires that the tag GENERATE_HTMLHELP is set to YES. + +GENERATE_CHI = NO + +# The CHM_INDEX_ENCODING is used to encode HtmlHelp index (hhk), content (hhc) +# and project file content. +# This tag requires that the tag GENERATE_HTMLHELP is set to YES. + +CHM_INDEX_ENCODING = + +# The BINARY_TOC flag controls whether a binary table of contents is generated +# (YES) or a normal table of contents (NO) in the .chm file. Furthermore it +# enables the Previous and Next buttons. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTMLHELP is set to YES. + +BINARY_TOC = NO + +# The TOC_EXPAND flag can be set to YES to add extra items for group members to +# the table of contents of the HTML help documentation and to the tree view. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTMLHELP is set to YES. + +TOC_EXPAND = NO + +# The SITEMAP_URL tag is used to specify the full URL of the place where the +# generated documentation will be placed on the server by the user during the +# deployment of the documentation. The generated sitemap is called sitemap.xml +# and placed on the directory specified by HTML_OUTPUT. In case no SITEMAP_URL +# is specified no sitemap is generated. For information about the sitemap +# protocol see https://www.sitemaps.org +# This tag requires that the tag GENERATE_HTML is set to YES. + +SITEMAP_URL = + +# If the GENERATE_QHP tag is set to YES and both QHP_NAMESPACE and +# QHP_VIRTUAL_FOLDER are set, an additional index file will be generated that +# can be used as input for Qt's qhelpgenerator to generate a Qt Compressed Help +# (.qch) of the generated HTML documentation. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTML is set to YES. + +GENERATE_QHP = NO + +# If the QHG_LOCATION tag is specified, the QCH_FILE tag can be used to specify +# the file name of the resulting .qch file. The path specified is relative to +# the HTML output folder. +# This tag requires that the tag GENERATE_QHP is set to YES. + +QCH_FILE = + +# The QHP_NAMESPACE tag specifies the namespace to use when generating Qt Help +# Project output. For more information please see Qt Help Project / Namespace +# (see: +# https://doc.qt.io/archives/qt-4.8/qthelpproject.html#namespace). +# The default value is: org.doxygen.Project. +# This tag requires that the tag GENERATE_QHP is set to YES. + +QHP_NAMESPACE = org.doxygen.Project + +# The QHP_VIRTUAL_FOLDER tag specifies the namespace to use when generating Qt +# Help Project output. For more information please see Qt Help Project / Virtual +# Folders (see: +# https://doc.qt.io/archives/qt-4.8/qthelpproject.html#virtual-folders). +# The default value is: doc. +# This tag requires that the tag GENERATE_QHP is set to YES. + +QHP_VIRTUAL_FOLDER = doc + +# If the QHP_CUST_FILTER_NAME tag is set, it specifies the name of a custom +# filter to add. For more information please see Qt Help Project / Custom +# Filters (see: +# https://doc.qt.io/archives/qt-4.8/qthelpproject.html#custom-filters). +# This tag requires that the tag GENERATE_QHP is set to YES. + +QHP_CUST_FILTER_NAME = + +# The QHP_CUST_FILTER_ATTRS tag specifies the list of the attributes of the +# custom filter to add. For more information please see Qt Help Project / Custom +# Filters (see: +# https://doc.qt.io/archives/qt-4.8/qthelpproject.html#custom-filters). +# This tag requires that the tag GENERATE_QHP is set to YES. + +QHP_CUST_FILTER_ATTRS = + +# The QHP_SECT_FILTER_ATTRS tag specifies the list of the attributes this +# project's filter section matches. Qt Help Project / Filter Attributes (see: +# https://doc.qt.io/archives/qt-4.8/qthelpproject.html#filter-attributes). +# This tag requires that the tag GENERATE_QHP is set to YES. + +QHP_SECT_FILTER_ATTRS = + +# The QHG_LOCATION tag can be used to specify the location (absolute path +# including file name) of Qt's qhelpgenerator. If non-empty doxygen will try to +# run qhelpgenerator on the generated .qhp file. +# This tag requires that the tag GENERATE_QHP is set to YES. + +QHG_LOCATION = + +# If the GENERATE_ECLIPSEHELP tag is set to YES, additional index files will be +# generated, together with the HTML files, they form an Eclipse help plugin. To +# install this plugin and make it available under the help contents menu in +# Eclipse, the contents of the directory containing the HTML and XML files needs +# to be copied into the plugins directory of eclipse. The name of the directory +# within the plugins directory should be the same as the ECLIPSE_DOC_ID value. +# After copying Eclipse needs to be restarted before the help appears. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTML is set to YES. + +GENERATE_ECLIPSEHELP = NO + +# A unique identifier for the Eclipse help plugin. When installing the plugin +# the directory name containing the HTML and XML files should also have this +# name. Each documentation set should have its own identifier. +# The default value is: org.doxygen.Project. +# This tag requires that the tag GENERATE_ECLIPSEHELP is set to YES. + +ECLIPSE_DOC_ID = org.doxygen.Project + +# If you want full control over the layout of the generated HTML pages it might +# be necessary to disable the index and replace it with your own. The +# DISABLE_INDEX tag can be used to turn on/off the condensed index (tabs) at top +# of each HTML page. A value of NO enables the index and the value YES disables +# it. Since the tabs in the index contain the same information as the navigation +# tree, you can set this option to YES if you also set GENERATE_TREEVIEW to YES. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTML is set to YES. + +DISABLE_INDEX = NO + +# The GENERATE_TREEVIEW tag is used to specify whether a tree-like index +# structure should be generated to display hierarchical information. If the tag +# value is set to YES, a side panel will be generated containing a tree-like +# index structure (just like the one that is generated for HTML Help). For this +# to work a browser that supports JavaScript, DHTML, CSS and frames is required +# (i.e. any modern browser). Windows users are probably better off using the +# HTML help feature. Via custom style sheets (see HTML_EXTRA_STYLESHEET) one can +# further fine tune the look of the index (see "Fine-tuning the output"). As an +# example, the default style sheet generated by doxygen has an example that +# shows how to put an image at the root of the tree instead of the PROJECT_NAME. +# Since the tree basically has the same information as the tab index, you could +# consider setting DISABLE_INDEX to YES when enabling this option. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTML is set to YES. + +GENERATE_TREEVIEW = YES + +# When both GENERATE_TREEVIEW and DISABLE_INDEX are set to YES, then the +# FULL_SIDEBAR option determines if the side bar is limited to only the treeview +# area (value NO) or if it should extend to the full height of the window (value +# YES). Setting this to YES gives a layout similar to +# https://docs.readthedocs.io with more room for contents, but less room for the +# project logo, title, and description. If either GENERATE_TREEVIEW or +# DISABLE_INDEX is set to NO, this option has no effect. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTML is set to YES. + +FULL_SIDEBAR = YES + +# The ENUM_VALUES_PER_LINE tag can be used to set the number of enum values that +# doxygen will group on one line in the generated HTML documentation. +# +# Note that a value of 0 will completely suppress the enum values from appearing +# in the overview section. +# Minimum value: 0, maximum value: 20, default value: 4. +# This tag requires that the tag GENERATE_HTML is set to YES. + +ENUM_VALUES_PER_LINE = 4 + +# If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be used +# to set the initial width (in pixels) of the frame in which the tree is shown. +# Minimum value: 0, maximum value: 1500, default value: 250. +# This tag requires that the tag GENERATE_HTML is set to YES. + +TREEVIEW_WIDTH = 250 + +# If the EXT_LINKS_IN_WINDOW option is set to YES, doxygen will open links to +# external symbols imported via tag files in a separate window. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTML is set to YES. + +EXT_LINKS_IN_WINDOW = NO + +# If the OBFUSCATE_EMAILS tag is set to YES, doxygen will obfuscate email +# addresses. +# The default value is: YES. +# This tag requires that the tag GENERATE_HTML is set to YES. + +OBFUSCATE_EMAILS = YES + +# If the HTML_FORMULA_FORMAT option is set to svg, doxygen will use the pdf2svg +# tool (see https://github.com/dawbarton/pdf2svg) or inkscape (see +# https://inkscape.org) to generate formulas as SVG images instead of PNGs for +# the HTML output. These images will generally look nicer at scaled resolutions. +# Possible values are: png (the default) and svg (looks nicer but requires the +# pdf2svg or inkscape tool). +# The default value is: png. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_FORMULA_FORMAT = png + +# Use this tag to change the font size of LaTeX formulas included as images in +# the HTML documentation. When you change the font size after a successful +# doxygen run you need to manually remove any form_*.png images from the HTML +# output directory to force them to be regenerated. +# Minimum value: 8, maximum value: 50, default value: 10. +# This tag requires that the tag GENERATE_HTML is set to YES. + +FORMULA_FONTSIZE = 10 + +# The FORMULA_MACROFILE can contain LaTeX \newcommand and \renewcommand commands +# to create new LaTeX commands to be used in formulas as building blocks. See +# the section "Including formulas" for details. + +FORMULA_MACROFILE = + +# Enable the USE_MATHJAX option to render LaTeX formulas using MathJax (see +# https://www.mathjax.org) which uses client side JavaScript for the rendering +# instead of using pre-rendered bitmaps. Use this if you do not have LaTeX +# installed or if you want to formulas look prettier in the HTML output. When +# enabled you may also need to install MathJax separately and configure the path +# to it using the MATHJAX_RELPATH option. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTML is set to YES. + +USE_MATHJAX = NO + +# With MATHJAX_VERSION it is possible to specify the MathJax version to be used. +# Note that the different versions of MathJax have different requirements with +# regards to the different settings, so it is possible that also other MathJax +# settings have to be changed when switching between the different MathJax +# versions. +# Possible values are: MathJax_2 and MathJax_3. +# The default value is: MathJax_2. +# This tag requires that the tag USE_MATHJAX is set to YES. + +MATHJAX_VERSION = MathJax_2 + +# When MathJax is enabled you can set the default output format to be used for +# the MathJax output. For more details about the output format see MathJax +# version 2 (see: +# http://docs.mathjax.org/en/v2.7-latest/output.html) and MathJax version 3 +# (see: +# http://docs.mathjax.org/en/latest/web/components/output.html). +# Possible values are: HTML-CSS (which is slower, but has the best +# compatibility. This is the name for Mathjax version 2, for MathJax version 3 +# this will be translated into chtml), NativeMML (i.e. MathML. Only supported +# for MathJax 2. For MathJax version 3 chtml will be used instead.), chtml (This +# is the name for Mathjax version 3, for MathJax version 2 this will be +# translated into HTML-CSS) and SVG. +# The default value is: HTML-CSS. +# This tag requires that the tag USE_MATHJAX is set to YES. + +MATHJAX_FORMAT = HTML-CSS + +# When MathJax is enabled you need to specify the location relative to the HTML +# output directory using the MATHJAX_RELPATH option. The destination directory +# should contain the MathJax.js script. For instance, if the mathjax directory +# is located at the same level as the HTML output directory, then +# MATHJAX_RELPATH should be ../mathjax. The default value points to the MathJax +# Content Delivery Network so you can quickly see the result without installing +# MathJax. However, it is strongly recommended to install a local copy of +# MathJax from https://www.mathjax.org before deployment. The default value is: +# - in case of MathJax version 2: https://cdn.jsdelivr.net/npm/mathjax@2 +# - in case of MathJax version 3: https://cdn.jsdelivr.net/npm/mathjax@3 +# This tag requires that the tag USE_MATHJAX is set to YES. + +MATHJAX_RELPATH = + +# The MATHJAX_EXTENSIONS tag can be used to specify one or more MathJax +# extension names that should be enabled during MathJax rendering. For example +# for MathJax version 2 (see +# https://docs.mathjax.org/en/v2.7-latest/tex.html#tex-and-latex-extensions): +# MATHJAX_EXTENSIONS = TeX/AMSmath TeX/AMSsymbols +# For example for MathJax version 3 (see +# http://docs.mathjax.org/en/latest/input/tex/extensions/index.html): +# MATHJAX_EXTENSIONS = ams +# This tag requires that the tag USE_MATHJAX is set to YES. + +MATHJAX_EXTENSIONS = + +# The MATHJAX_CODEFILE tag can be used to specify a file with javascript pieces +# of code that will be used on startup of the MathJax code. See the MathJax site +# (see: +# http://docs.mathjax.org/en/v2.7-latest/output.html) for more details. For an +# example see the documentation. +# This tag requires that the tag USE_MATHJAX is set to YES. + +MATHJAX_CODEFILE = + +# When the SEARCHENGINE tag is enabled doxygen will generate a search box for +# the HTML output. The underlying search engine uses javascript and DHTML and +# should work on any modern browser. Note that when using HTML help +# (GENERATE_HTMLHELP), Qt help (GENERATE_QHP), or docsets (GENERATE_DOCSET) +# there is already a search function so this one should typically be disabled. +# For large projects the javascript based search engine can be slow, then +# enabling SERVER_BASED_SEARCH may provide a better solution. It is possible to +# search using the keyboard; to jump to the search box use + S +# (what the is depends on the OS and browser, but it is typically +# , /Node, +# Edge and Graph Attributes specification You need to make sure dot is able +# to find the font, which can be done by putting it in a standard location or by +# setting the DOTFONTPATH environment variable or by setting DOT_FONTPATH to the +# directory containing the font. Default graphviz fontsize is 14. +# The default value is: fontname=Helvetica,fontsize=10. +# This tag requires that the tag HAVE_DOT is set to YES. + +DOT_COMMON_ATTR = "fontname=Helvetica,fontsize=10" + +# DOT_EDGE_ATTR is concatenated with DOT_COMMON_ATTR. For elegant style you can +# add 'arrowhead=open, arrowtail=open, arrowsize=0.5'. Complete documentation about +# arrows shapes. +# The default value is: labelfontname=Helvetica,labelfontsize=10. +# This tag requires that the tag HAVE_DOT is set to YES. + +DOT_EDGE_ATTR = "labelfontname=Helvetica,labelfontsize=10" + +# DOT_NODE_ATTR is concatenated with DOT_COMMON_ATTR. For view without boxes +# around nodes set 'shape=plain' or 'shape=plaintext' Shapes specification +# The default value is: shape=box,height=0.2,width=0.4. +# This tag requires that the tag HAVE_DOT is set to YES. + +DOT_NODE_ATTR = "shape=box,height=0.2,width=0.4" + +# You can set the path where dot can find font specified with fontname in +# DOT_COMMON_ATTR and others dot attributes. +# This tag requires that the tag HAVE_DOT is set to YES. + +DOT_FONTPATH = + +# If the CLASS_GRAPH tag is set to YES or GRAPH or BUILTIN then doxygen will +# generate a graph for each documented class showing the direct and indirect +# inheritance relations. In case the CLASS_GRAPH tag is set to YES or GRAPH and +# HAVE_DOT is enabled as well, then dot will be used to draw the graph. In case +# the CLASS_GRAPH tag is set to YES and HAVE_DOT is disabled or if the +# CLASS_GRAPH tag is set to BUILTIN, then the built-in generator will be used. +# If the CLASS_GRAPH tag is set to TEXT the direct and indirect inheritance +# relations will be shown as texts / links. Explicit enabling an inheritance +# graph or choosing a different representation for an inheritance graph of a +# specific class, can be accomplished by means of the command \inheritancegraph. +# Disabling an inheritance graph can be accomplished by means of the command +# \hideinheritancegraph. +# Possible values are: NO, YES, TEXT, GRAPH and BUILTIN. +# The default value is: YES. + +CLASS_GRAPH = YES + +# If the COLLABORATION_GRAPH tag is set to YES then doxygen will generate a +# graph for each documented class showing the direct and indirect implementation +# dependencies (inheritance, containment, and class references variables) of the +# class with other documented classes. Explicit enabling a collaboration graph, +# when COLLABORATION_GRAPH is set to NO, can be accomplished by means of the +# command \collaborationgraph. Disabling a collaboration graph can be +# accomplished by means of the command \hidecollaborationgraph. +# The default value is: YES. +# This tag requires that the tag HAVE_DOT is set to YES. + +COLLABORATION_GRAPH = YES + +# If the GROUP_GRAPHS tag is set to YES then doxygen will generate a graph for +# groups, showing the direct groups dependencies. Explicit enabling a group +# dependency graph, when GROUP_GRAPHS is set to NO, can be accomplished by means +# of the command \groupgraph. Disabling a directory graph can be accomplished by +# means of the command \hidegroupgraph. See also the chapter Grouping in the +# manual. +# The default value is: YES. +# This tag requires that the tag HAVE_DOT is set to YES. + +GROUP_GRAPHS = YES + +# If the UML_LOOK tag is set to YES, doxygen will generate inheritance and +# collaboration diagrams in a style similar to the OMG's Unified Modeling +# Language. +# The default value is: NO. +# This tag requires that the tag HAVE_DOT is set to YES. + +UML_LOOK = NO + +# If the UML_LOOK tag is enabled, the fields and methods are shown inside the +# class node. If there are many fields or methods and many nodes the graph may +# become too big to be useful. The UML_LIMIT_NUM_FIELDS threshold limits the +# number of items for each type to make the size more manageable. Set this to 0 +# for no limit. Note that the threshold may be exceeded by 50% before the limit +# is enforced. So when you set the threshold to 10, up to 15 fields may appear, +# but if the number exceeds 15, the total amount of fields shown is limited to +# 10. +# Minimum value: 0, maximum value: 100, default value: 10. +# This tag requires that the tag UML_LOOK is set to YES. + +UML_LIMIT_NUM_FIELDS = 10 + +# If the DOT_UML_DETAILS tag is set to NO, doxygen will show attributes and +# methods without types and arguments in the UML graphs. If the DOT_UML_DETAILS +# tag is set to YES, doxygen will add type and arguments for attributes and +# methods in the UML graphs. If the DOT_UML_DETAILS tag is set to NONE, doxygen +# will not generate fields with class member information in the UML graphs. The +# class diagrams will look similar to the default class diagrams but using UML +# notation for the relationships. +# Possible values are: NO, YES and NONE. +# The default value is: NO. +# This tag requires that the tag UML_LOOK is set to YES. + +DOT_UML_DETAILS = NO + +# The DOT_WRAP_THRESHOLD tag can be used to set the maximum number of characters +# to display on a single line. If the actual line length exceeds this threshold +# significantly it will be wrapped across multiple lines. Some heuristics are +# applied to avoid ugly line breaks. +# Minimum value: 0, maximum value: 1000, default value: 17. +# This tag requires that the tag HAVE_DOT is set to YES. + +DOT_WRAP_THRESHOLD = 17 + +# If the TEMPLATE_RELATIONS tag is set to YES then the inheritance and +# collaboration graphs will show the relations between templates and their +# instances. +# The default value is: NO. +# This tag requires that the tag HAVE_DOT is set to YES. + +TEMPLATE_RELATIONS = NO + +# If the INCLUDE_GRAPH, ENABLE_PREPROCESSING and SEARCH_INCLUDES tags are set to +# YES then doxygen will generate a graph for each documented file showing the +# direct and indirect include dependencies of the file with other documented +# files. Explicit enabling an include graph, when INCLUDE_GRAPH is is set to NO, +# can be accomplished by means of the command \includegraph. Disabling an +# include graph can be accomplished by means of the command \hideincludegraph. +# The default value is: YES. +# This tag requires that the tag HAVE_DOT is set to YES. + +INCLUDE_GRAPH = YES + +# If the INCLUDED_BY_GRAPH, ENABLE_PREPROCESSING and SEARCH_INCLUDES tags are +# set to YES then doxygen will generate a graph for each documented file showing +# the direct and indirect include dependencies of the file with other documented +# files. Explicit enabling an included by graph, when INCLUDED_BY_GRAPH is set +# to NO, can be accomplished by means of the command \includedbygraph. Disabling +# an included by graph can be accomplished by means of the command +# \hideincludedbygraph. +# The default value is: YES. +# This tag requires that the tag HAVE_DOT is set to YES. + +INCLUDED_BY_GRAPH = YES + +# If the CALL_GRAPH tag is set to YES then doxygen will generate a call +# dependency graph for every global function or class method. +# +# Note that enabling this option will significantly increase the time of a run. +# So in most cases it will be better to enable call graphs for selected +# functions only using the \callgraph command. Disabling a call graph can be +# accomplished by means of the command \hidecallgraph. +# The default value is: NO. +# This tag requires that the tag HAVE_DOT is set to YES. + +CALL_GRAPH = YES + +# If the CALLER_GRAPH tag is set to YES then doxygen will generate a caller +# dependency graph for every global function or class method. +# +# Note that enabling this option will significantly increase the time of a run. +# So in most cases it will be better to enable caller graphs for selected +# functions only using the \callergraph command. Disabling a caller graph can be +# accomplished by means of the command \hidecallergraph. +# The default value is: NO. +# This tag requires that the tag HAVE_DOT is set to YES. + +CALLER_GRAPH = YES + +# If the GRAPHICAL_HIERARCHY tag is set to YES then doxygen will graphical +# hierarchy of all classes instead of a textual one. +# The default value is: YES. +# This tag requires that the tag HAVE_DOT is set to YES. + +GRAPHICAL_HIERARCHY = YES + +# If the DIRECTORY_GRAPH tag is set to YES then doxygen will show the +# dependencies a directory has on other directories in a graphical way. The +# dependency relations are determined by the #include relations between the +# files in the directories. Explicit enabling a directory graph, when +# DIRECTORY_GRAPH is set to NO, can be accomplished by means of the command +# \directorygraph. Disabling a directory graph can be accomplished by means of +# the command \hidedirectorygraph. +# The default value is: YES. +# This tag requires that the tag HAVE_DOT is set to YES. + +DIRECTORY_GRAPH = YES + +# The DIR_GRAPH_MAX_DEPTH tag can be used to limit the maximum number of levels +# of child directories generated in directory dependency graphs by dot. +# Minimum value: 1, maximum value: 25, default value: 1. +# This tag requires that the tag DIRECTORY_GRAPH is set to YES. + +DIR_GRAPH_MAX_DEPTH = 1 + +# The DOT_IMAGE_FORMAT tag can be used to set the image format of the images +# generated by dot. For an explanation of the image formats see the section +# output formats in the documentation of the dot tool (Graphviz (see: +# https://www.graphviz.org/)). +# Note: If you choose svg you need to set HTML_FILE_EXTENSION to xhtml in order +# to make the SVG files visible in IE 9+ (other browsers do not have this +# requirement). +# Possible values are: png, jpg, gif, svg, png:gd, png:gd:gd, png:cairo, +# png:cairo:gd, png:cairo:cairo, png:cairo:gdiplus, png:gdiplus and +# png:gdiplus:gdiplus. +# The default value is: png. +# This tag requires that the tag HAVE_DOT is set to YES. + +DOT_IMAGE_FORMAT = png + +# If DOT_IMAGE_FORMAT is set to svg, then this option can be set to YES to +# enable generation of interactive SVG images that allow zooming and panning. +# +# Note that this requires a modern browser other than Internet Explorer. Tested +# and working are Firefox, Chrome, Safari, and Opera. +# Note: For IE 9+ you need to set HTML_FILE_EXTENSION to xhtml in order to make +# the SVG files visible. Older versions of IE do not have SVG support. +# The default value is: NO. +# This tag requires that the tag HAVE_DOT is set to YES. + +INTERACTIVE_SVG = NO + +# The DOT_PATH tag can be used to specify the path where the dot tool can be +# found. If left blank, it is assumed the dot tool can be found in the path. +# This tag requires that the tag HAVE_DOT is set to YES. + +DOT_PATH = + +# The DOTFILE_DIRS tag can be used to specify one or more directories that +# contain dot files that are included in the documentation (see the \dotfile +# command). +# This tag requires that the tag HAVE_DOT is set to YES. + +DOTFILE_DIRS = + +# You can include diagrams made with dia in doxygen documentation. Doxygen will +# then run dia to produce the diagram and insert it in the documentation. The +# DIA_PATH tag allows you to specify the directory where the dia binary resides. +# If left empty dia is assumed to be found in the default search path. + +DIA_PATH = + +# The DIAFILE_DIRS tag can be used to specify one or more directories that +# contain dia files that are included in the documentation (see the \diafile +# command). + +DIAFILE_DIRS = + +# When using plantuml, the PLANTUML_JAR_PATH tag should be used to specify the +# path where java can find the plantuml.jar file or to the filename of jar file +# to be used. If left blank, it is assumed PlantUML is not used or called during +# a preprocessing step. Doxygen will generate a warning when it encounters a +# \startuml command in this case and will not generate output for the diagram. + +PLANTUML_JAR_PATH = + +# When using plantuml, the PLANTUML_CFG_FILE tag can be used to specify a +# configuration file for plantuml. + +PLANTUML_CFG_FILE = + +# When using plantuml, the specified paths are searched for files specified by +# the !include statement in a plantuml block. + +PLANTUML_INCLUDE_PATH = + +# The DOT_GRAPH_MAX_NODES tag can be used to set the maximum number of nodes +# that will be shown in the graph. If the number of nodes in a graph becomes +# larger than this value, doxygen will truncate the graph, which is visualized +# by representing a node as a red box. Note that if the number of direct +# children of the root node in a graph is already larger than +# DOT_GRAPH_MAX_NODES then the graph will not be shown at all. Also note that +# the size of a graph can be further restricted by MAX_DOT_GRAPH_DEPTH. +# Minimum value: 0, maximum value: 10000, default value: 50. +# This tag requires that the tag HAVE_DOT is set to YES. + +DOT_GRAPH_MAX_NODES = 50 + +# The MAX_DOT_GRAPH_DEPTH tag can be used to set the maximum depth of the graphs +# generated by dot. A depth value of 3 means that only nodes reachable from the +# root by following a path via at most 3 edges will be shown. Nodes that lay +# further from the root node will be omitted. Note that setting this option to 1 +# or 2 may greatly reduce the computation time needed for large code bases. Also +# note that the size of a graph can be further restricted by +# DOT_GRAPH_MAX_NODES. Using a depth of 0 means no depth restriction. +# Minimum value: 0, maximum value: 1000, default value: 0. +# This tag requires that the tag HAVE_DOT is set to YES. + +MAX_DOT_GRAPH_DEPTH = 0 + +# Set the DOT_MULTI_TARGETS tag to YES to allow dot to generate multiple output +# files in one run (i.e. multiple -o and -T options on the command line). This +# makes dot run faster, but since only newer versions of dot (>1.8.10) support +# this, this feature is disabled by default. +# The default value is: NO. +# This tag requires that the tag HAVE_DOT is set to YES. + +DOT_MULTI_TARGETS = NO + +# If the GENERATE_LEGEND tag is set to YES doxygen will generate a legend page +# explaining the meaning of the various boxes and arrows in the dot generated +# graphs. +# Note: This tag requires that UML_LOOK isn't set, i.e. the doxygen internal +# graphical representation for inheritance and collaboration diagrams is used. +# The default value is: YES. +# This tag requires that the tag HAVE_DOT is set to YES. + +GENERATE_LEGEND = YES + +# If the DOT_CLEANUP tag is set to YES, doxygen will remove the intermediate +# files that are used to generate the various graphs. +# +# Note: This setting is not only used for dot files but also for msc temporary +# files. +# The default value is: YES. + +DOT_CLEANUP = YES + +# You can define message sequence charts within doxygen comments using the \msc +# command. If the MSCGEN_TOOL tag is left empty (the default), then doxygen will +# use a built-in version of mscgen tool to produce the charts. Alternatively, +# the MSCGEN_TOOL tag can also specify the name an external tool. For instance, +# specifying prog as the value, doxygen will call the tool as prog -T +# -o . The external tool should support +# output file formats "png", "eps", "svg", and "ismap". + +MSCGEN_TOOL = + +# The MSCFILE_DIRS tag can be used to specify one or more directories that +# contain msc files that are included in the documentation (see the \mscfile +# command). + +MSCFILE_DIRS = diff --git a/docs/coverage.pdf b/docs/coverage.pdf deleted file mode 100644 index 3d4b011..0000000 Binary files a/docs/coverage.pdf and /dev/null differ diff --git a/docs/logo_small.png b/docs/logo_small.png new file mode 100644 index 0000000..33030fb Binary files /dev/null and b/docs/logo_small.png differ diff --git a/html/amber.png b/html/amber.png deleted file mode 100644 index 2cab170..0000000 Binary files a/html/amber.png and /dev/null differ diff --git a/html/bayesnet/BaseClassifier.h.func-c.html b/html/bayesnet/BaseClassifier.h.func-c.html deleted file mode 100644 index 7dd3cc5..0000000 --- a/html/bayesnet/BaseClassifier.h.func-c.html +++ /dev/null @@ -1,90 +0,0 @@ - - - - - - - LCOV - BayesNet Coverage Report - bayesnet/BaseClassifier.h - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - bayesnet - BaseClassifier.h (source / functions)CoverageTotalHit
Test:BayesNet Coverage ReportLines:100.0 %11
Test Date:2024-05-06 17:54:04Functions:100.0 %11
Legend: Lines: - hit - not hit -
-
- -
- - - - - - - - - - - - - - - - -

Function Name Sort by function nameHit count Sort by function hit count
bayesnet::BaseClassifier::~BaseClassifier()1680
-
-
- - - -
Generated by: LCOV version 2.0-1
-
- - - diff --git a/html/bayesnet/BaseClassifier.h.func.html b/html/bayesnet/BaseClassifier.h.func.html deleted file mode 100644 index 8418b7d..0000000 --- a/html/bayesnet/BaseClassifier.h.func.html +++ /dev/null @@ -1,90 +0,0 @@ - - - - - - - LCOV - BayesNet Coverage Report - bayesnet/BaseClassifier.h - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - bayesnet - BaseClassifier.h (source / functions)CoverageTotalHit
Test:BayesNet Coverage ReportLines:100.0 %11
Test Date:2024-05-06 17:54:04Functions:100.0 %11
Legend: Lines: - hit - not hit -
-
- -
- - - - - - - - - - - - - - - - -

Function Name Sort by function nameHit count Sort by function hit count
bayesnet::BaseClassifier::~BaseClassifier()1680
-
-
- - - -
Generated by: LCOV version 2.0-1
-
- - - diff --git a/html/bayesnet/BaseClassifier.h.gcov.frameset.html b/html/bayesnet/BaseClassifier.h.gcov.frameset.html deleted file mode 100644 index 92b4ff4..0000000 --- a/html/bayesnet/BaseClassifier.h.gcov.frameset.html +++ /dev/null @@ -1,19 +0,0 @@ - - - - - - - LCOV - BayesNet Coverage Report - bayesnet/BaseClassifier.h - - - - - - - - <center>Frames not supported by your browser!<br></center> - - - - diff --git a/html/bayesnet/BaseClassifier.h.gcov.html b/html/bayesnet/BaseClassifier.h.gcov.html deleted file mode 100644 index 9d3ca81..0000000 --- a/html/bayesnet/BaseClassifier.h.gcov.html +++ /dev/null @@ -1,129 +0,0 @@ - - - - - - - LCOV - BayesNet Coverage Report - bayesnet/BaseClassifier.h - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - bayesnet - BaseClassifier.h (source / functions)CoverageTotalHit
Test:BayesNet Coverage ReportLines:100.0 %11
Test Date:2024-05-06 17:54:04Functions:100.0 %11
Legend: Lines: - hit - not hit -
-
- - - - - - - - -

-
            Line data    Source code
-
-       1              : // ***************************************************************
-       2              : // SPDX-FileCopyrightText: Copyright 2024 Ricardo Montañana Gómez
-       3              : // SPDX-FileType: SOURCE
-       4              : // SPDX-License-Identifier: MIT
-       5              : // ***************************************************************
-       6              : 
-       7              : #pragma once
-       8              : #include <vector>
-       9              : #include <torch/torch.h>
-      10              : #include <nlohmann/json.hpp>
-      11              : namespace bayesnet {
-      12              :     enum status_t { NORMAL, WARNING, ERROR };
-      13              :     class BaseClassifier {
-      14              :     public:
-      15              :         // X is nxm std::vector, y is nx1 std::vector
-      16              :         virtual BaseClassifier& fit(std::vector<std::vector<int>>& X, std::vector<int>& y, const std::vector<std::string>& features, const std::string& className, std::map<std::string, std::vector<int>>& states) = 0;
-      17              :         // X is nxm tensor, y is nx1 tensor
-      18              :         virtual BaseClassifier& 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;
-      19              :         virtual BaseClassifier& fit(torch::Tensor& dataset, const std::vector<std::string>& features, const std::string& className, std::map<std::string, std::vector<int>>& states) = 0;
-      20              :         virtual BaseClassifier& fit(torch::Tensor& dataset, const std::vector<std::string>& features, const std::string& className, std::map<std::string, std::vector<int>>& states, const torch::Tensor& weights) = 0;
-      21         1680 :         virtual ~BaseClassifier() = default;
-      22              :         torch::Tensor virtual predict(torch::Tensor& X) = 0;
-      23              :         std::vector<int> virtual predict(std::vector<std::vector<int >>& X) = 0;
-      24              :         torch::Tensor virtual predict_proba(torch::Tensor& X) = 0;
-      25              :         std::vector<std::vector<double>> virtual predict_proba(std::vector<std::vector<int >>& X) = 0;
-      26              :         status_t virtual getStatus() const = 0;
-      27              :         float virtual score(std::vector<std::vector<int>>& X, std::vector<int>& y) = 0;
-      28              :         float virtual score(torch::Tensor& X, torch::Tensor& y) = 0;
-      29              :         int virtual getNumberOfNodes()const = 0;
-      30              :         int virtual getNumberOfEdges()const = 0;
-      31              :         int virtual getNumberOfStates() const = 0;
-      32              :         int virtual getClassNumStates() const = 0;
-      33              :         std::vector<std::string> virtual show() const = 0;
-      34              :         std::vector<std::string> virtual graph(const std::string& title = "") const = 0;
-      35              :         virtual std::string getVersion() = 0;
-      36              :         std::vector<std::string> virtual topological_order() = 0;
-      37              :         std::vector<std::string> virtual getNotes() const = 0;
-      38              :         std::string virtual dump_cpt()const = 0;
-      39              :         virtual void setHyperparameters(const nlohmann::json& hyperparameters) = 0;
-      40              :         std::vector<std::string>& getValidHyperparameters() { return validHyperparameters; }
-      41              :     protected:
-      42              :         virtual void trainModel(const torch::Tensor& weights) = 0;
-      43              :         std::vector<std::string> validHyperparameters;
-      44              :     };
-      45              : }
-        
-
-
- - - - -
Generated by: LCOV version 2.0-1
-
- - - diff --git a/html/bayesnet/BaseClassifier.h.gcov.overview.html b/html/bayesnet/BaseClassifier.h.gcov.overview.html deleted file mode 100644 index 57bcea7..0000000 --- a/html/bayesnet/BaseClassifier.h.gcov.overview.html +++ /dev/null @@ -1,32 +0,0 @@ - - - - - - LCOV - BayesNet Coverage Report - bayesnet/BaseClassifier.h - - - - - - - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - - -
- Top

- Overview -
- - diff --git a/html/bayesnet/BaseClassifier.h.gcov.png b/html/bayesnet/BaseClassifier.h.gcov.png deleted file mode 100644 index 678d90a..0000000 Binary files a/html/bayesnet/BaseClassifier.h.gcov.png and /dev/null differ diff --git a/html/bayesnet/classifiers/Classifier.cc.func-c.html b/html/bayesnet/classifiers/Classifier.cc.func-c.html deleted file mode 100644 index 02b012a..0000000 --- a/html/bayesnet/classifiers/Classifier.cc.func-c.html +++ /dev/null @@ -1,251 +0,0 @@ - - - - - - - LCOV - BayesNet Coverage Report - bayesnet/classifiers/Classifier.cc - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - bayesnet/classifiers - Classifier.cc (source / functions)CoverageTotalHit
Test:BayesNet Coverage ReportLines:100.0 %126126
Test Date:2024-05-06 17:54:04Functions:100.0 %2424
Legend: Lines: - hit - not hit -
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Function Name Sort by function nameHit count Sort by function hit count
bayesnet::Classifier::dump_cpt[abi:cxx11]() const4
bayesnet::Classifier::topological_order[abi:cxx11]()4
bayesnet::Classifier::predict(std::vector<std::vector<int, std::allocator<int> >, std::allocator<std::vector<int, std::allocator<int> > > >&)16
bayesnet::Classifier::score(std::vector<std::vector<int, std::allocator<int> >, std::allocator<std::vector<int, std::allocator<int> > > >&, std::vector<int, std::allocator<int> >&)16
bayesnet::Classifier::getNumberOfStates() const24
bayesnet::Classifier::show[abi:cxx11]() const24
bayesnet::Classifier::setHyperparameters(nlohmann::json_abi_v3_11_3::basic_json<std::map, std::vector, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, bool, long, unsigned long, double, std::allocator, nlohmann::json_abi_v3_11_3::adl_serializer, std::vector<unsigned char, std::allocator<unsigned char> >, void> const&)92
bayesnet::Classifier::score(at::Tensor&, at::Tensor&)112
bayesnet::Classifier::fit(at::Tensor&, at::Tensor&, std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::map<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::vector<int, std::allocator<int> >, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, std::vector<int, std::allocator<int> > > > >&)128
bayesnet::Classifier::fit(std::vector<std::vector<int, std::allocator<int> >, std::allocator<std::vector<int, std::allocator<int> > > >&, std::vector<int, std::allocator<int> >&, std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::map<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::vector<int, std::allocator<int> >, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, std::vector<int, std::allocator<int> > > > >&)136
bayesnet::Classifier::getNumberOfEdges() const332
bayesnet::Classifier::getNumberOfNodes() const332
bayesnet::Classifier::buildDataset(at::Tensor&)340
bayesnet::Classifier::getClassNumStates() const348
bayesnet::Classifier::predict_proba(std::vector<std::vector<int, std::allocator<int> >, std::allocator<std::vector<int, std::allocator<int> > > >&)548
bayesnet::Classifier::fit(at::Tensor&, std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::map<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::vector<int, std::allocator<int> >, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, std::vector<int, std::allocator<int> > > > >&, at::Tensor const&)660
bayesnet::Classifier::fit(at::Tensor&, std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::map<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::vector<int, std::allocator<int> >, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, std::vector<int, std::allocator<int> > > > >&)852
bayesnet::Classifier::predict_proba(at::Tensor&)1484
bayesnet::Classifier::addNodes()1576
bayesnet::Classifier::trainModel(at::Tensor const&)1576
bayesnet::Classifier::build(std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::map<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::vector<int, std::allocator<int> >, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, std::vector<int, std::allocator<int> > > > >&, at::Tensor const&)1760
bayesnet::Classifier::checkFitParameters()1760
bayesnet::Classifier::predict(at::Tensor&)1844
bayesnet::Classifier::Classifier(bayesnet::Network)2240
-
-
- - - -
Generated by: LCOV version 2.0-1
-
- - - diff --git a/html/bayesnet/classifiers/Classifier.cc.func.html b/html/bayesnet/classifiers/Classifier.cc.func.html deleted file mode 100644 index 711837d..0000000 --- a/html/bayesnet/classifiers/Classifier.cc.func.html +++ /dev/null @@ -1,251 +0,0 @@ - - - - - - - LCOV - BayesNet Coverage Report - bayesnet/classifiers/Classifier.cc - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - bayesnet/classifiers - Classifier.cc (source / functions)CoverageTotalHit
Test:BayesNet Coverage ReportLines:100.0 %126126
Test Date:2024-05-06 17:54:04Functions:100.0 %2424
Legend: Lines: - hit - not hit -
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Function Name Sort by function nameHit count Sort by function hit count
bayesnet::Classifier::Classifier(bayesnet::Network)2240
bayesnet::Classifier::addNodes()1576
bayesnet::Classifier::build(std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::map<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::vector<int, std::allocator<int> >, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, std::vector<int, std::allocator<int> > > > >&, at::Tensor const&)1760
bayesnet::Classifier::buildDataset(at::Tensor&)340
bayesnet::Classifier::checkFitParameters()1760
bayesnet::Classifier::dump_cpt[abi:cxx11]() const4
bayesnet::Classifier::fit(at::Tensor&, at::Tensor&, std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::map<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::vector<int, std::allocator<int> >, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, std::vector<int, std::allocator<int> > > > >&)128
bayesnet::Classifier::fit(at::Tensor&, std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::map<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::vector<int, std::allocator<int> >, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, std::vector<int, std::allocator<int> > > > >&)852
bayesnet::Classifier::fit(at::Tensor&, std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::map<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::vector<int, std::allocator<int> >, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, std::vector<int, std::allocator<int> > > > >&, at::Tensor const&)660
bayesnet::Classifier::fit(std::vector<std::vector<int, std::allocator<int> >, std::allocator<std::vector<int, std::allocator<int> > > >&, std::vector<int, std::allocator<int> >&, std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::map<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::vector<int, std::allocator<int> >, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, std::vector<int, std::allocator<int> > > > >&)136
bayesnet::Classifier::getClassNumStates() const348
bayesnet::Classifier::getNumberOfEdges() const332
bayesnet::Classifier::getNumberOfNodes() const332
bayesnet::Classifier::getNumberOfStates() const24
bayesnet::Classifier::predict(at::Tensor&)1844
bayesnet::Classifier::predict(std::vector<std::vector<int, std::allocator<int> >, std::allocator<std::vector<int, std::allocator<int> > > >&)16
bayesnet::Classifier::predict_proba(at::Tensor&)1484
bayesnet::Classifier::predict_proba(std::vector<std::vector<int, std::allocator<int> >, std::allocator<std::vector<int, std::allocator<int> > > >&)548
bayesnet::Classifier::score(at::Tensor&, at::Tensor&)112
bayesnet::Classifier::score(std::vector<std::vector<int, std::allocator<int> >, std::allocator<std::vector<int, std::allocator<int> > > >&, std::vector<int, std::allocator<int> >&)16
bayesnet::Classifier::setHyperparameters(nlohmann::json_abi_v3_11_3::basic_json<std::map, std::vector, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, bool, long, unsigned long, double, std::allocator, nlohmann::json_abi_v3_11_3::adl_serializer, std::vector<unsigned char, std::allocator<unsigned char> >, void> const&)92
bayesnet::Classifier::show[abi:cxx11]() const24
bayesnet::Classifier::topological_order[abi:cxx11]()4
bayesnet::Classifier::trainModel(at::Tensor const&)1576
-
-
- - - -
Generated by: LCOV version 2.0-1
-
- - - diff --git a/html/bayesnet/classifiers/Classifier.cc.gcov.frameset.html b/html/bayesnet/classifiers/Classifier.cc.gcov.frameset.html deleted file mode 100644 index ced4c8c..0000000 --- a/html/bayesnet/classifiers/Classifier.cc.gcov.frameset.html +++ /dev/null @@ -1,19 +0,0 @@ - - - - - - - LCOV - BayesNet Coverage Report - bayesnet/classifiers/Classifier.cc - - - - - - - - <center>Frames not supported by your browser!<br></center> - - - - diff --git a/html/bayesnet/classifiers/Classifier.cc.gcov.html b/html/bayesnet/classifiers/Classifier.cc.gcov.html deleted file mode 100644 index 96d250b..0000000 --- a/html/bayesnet/classifiers/Classifier.cc.gcov.html +++ /dev/null @@ -1,278 +0,0 @@ - - - - - - - LCOV - BayesNet Coverage Report - bayesnet/classifiers/Classifier.cc - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - bayesnet/classifiers - Classifier.cc (source / functions)CoverageTotalHit
Test:BayesNet Coverage ReportLines:100.0 %126126
Test Date:2024-05-06 17:54:04Functions:100.0 %2424
Legend: Lines: - hit - not hit -
-
- - - - - - - - -

-
            Line data    Source code
-
-       1              : // ***************************************************************
-       2              : // SPDX-FileCopyrightText: Copyright 2024 Ricardo Montañana Gómez
-       3              : // SPDX-FileType: SOURCE
-       4              : // SPDX-License-Identifier: MIT
-       5              : // ***************************************************************
-       6              : 
-       7              : #include <sstream>
-       8              : #include "bayesnet/utils/bayesnetUtils.h"
-       9              : #include "Classifier.h"
-      10              : 
-      11              : namespace bayesnet {
-      12         2240 :     Classifier::Classifier(Network model) : model(model), m(0), n(0), metrics(Metrics()), fitted(false) {}
-      13              :     const std::string CLASSIFIER_NOT_FITTED = "Classifier has not been fitted";
-      14         1760 :     Classifier& Classifier::build(const std::vector<std::string>& features, const std::string& className, std::map<std::string, std::vector<int>>& states, const torch::Tensor& weights)
-      15              :     {
-      16         1760 :         this->features = features;
-      17         1760 :         this->className = className;
-      18         1760 :         this->states = states;
-      19         1760 :         m = dataset.size(1);
-      20         1760 :         n = features.size();
-      21         1760 :         checkFitParameters();
-      22         1728 :         auto n_classes = states.at(className).size();
-      23         1728 :         metrics = Metrics(dataset, features, className, n_classes);
-      24         1728 :         model.initialize();
-      25         1728 :         buildModel(weights);
-      26         1728 :         trainModel(weights);
-      27         1712 :         fitted = true;
-      28         1712 :         return *this;
-      29              :     }
-      30          340 :     void Classifier::buildDataset(torch::Tensor& ytmp)
-      31              :     {
-      32              :         try {
-      33          340 :             auto yresized = torch::transpose(ytmp.view({ ytmp.size(0), 1 }), 0, 1);
-      34         1052 :             dataset = torch::cat({ dataset, yresized }, 0);
-      35          340 :         }
-      36           16 :         catch (const std::exception& e) {
-      37           16 :             std::stringstream oss;
-      38           16 :             oss << "* Error in X and y dimensions *\n";
-      39           16 :             oss << "X dimensions: " << dataset.sizes() << "\n";
-      40           16 :             oss << "y dimensions: " << ytmp.sizes();
-      41           16 :             throw std::runtime_error(oss.str());
-      42           32 :         }
-      43          680 :     }
-      44         1576 :     void Classifier::trainModel(const torch::Tensor& weights)
-      45              :     {
-      46         1576 :         model.fit(dataset, weights, features, className, states);
-      47         1576 :     }
-      48              :     // X is nxm where n is the number of features and m the number of samples
-      49          128 :     Classifier& 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)
-      50              :     {
-      51          128 :         dataset = X;
-      52          128 :         buildDataset(y);
-      53          120 :         const torch::Tensor weights = torch::full({ dataset.size(1) }, 1.0 / dataset.size(1), torch::kDouble);
-      54          208 :         return build(features, className, states, weights);
-      55          120 :     }
-      56              :     // X is nxm where n is the number of features and m the number of samples
-      57          136 :     Classifier& Classifier::fit(std::vector<std::vector<int>>& X, std::vector<int>& y, const std::vector<std::string>& features, const std::string& className, std::map<std::string, std::vector<int>>& states)
-      58              :     {
-      59          136 :         dataset = torch::zeros({ static_cast<int>(X.size()), static_cast<int>(X[0].size()) }, torch::kInt32);
-      60          976 :         for (int i = 0; i < X.size(); ++i) {
-      61         3360 :             dataset.index_put_({ i, "..." }, torch::tensor(X[i], torch::kInt32));
-      62              :         }
-      63          136 :         auto ytmp = torch::tensor(y, torch::kInt32);
-      64          136 :         buildDataset(ytmp);
-      65          128 :         const torch::Tensor weights = torch::full({ dataset.size(1) }, 1.0 / dataset.size(1), torch::kDouble);
-      66          240 :         return build(features, className, states, weights);
-      67          992 :     }
-      68          852 :     Classifier& Classifier::fit(torch::Tensor& dataset, const std::vector<std::string>& features, const std::string& className, std::map<std::string, std::vector<int>>& states)
-      69              :     {
-      70          852 :         this->dataset = dataset;
-      71          852 :         const torch::Tensor weights = torch::full({ dataset.size(1) }, 1.0 / dataset.size(1), torch::kDouble);
-      72         1704 :         return build(features, className, states, weights);
-      73          852 :     }
-      74          660 :     Classifier& Classifier::fit(torch::Tensor& dataset, const std::vector<std::string>& features, const std::string& className, std::map<std::string, std::vector<int>>& states, const torch::Tensor& weights)
-      75              :     {
-      76          660 :         this->dataset = dataset;
-      77          660 :         return build(features, className, states, weights);
-      78              :     }
-      79         1760 :     void Classifier::checkFitParameters()
-      80              :     {
-      81         1760 :         if (torch::is_floating_point(dataset)) {
-      82            8 :             throw std::invalid_argument("dataset (X, y) must be of type Integer");
-      83              :         }
-      84         1752 :         if (dataset.size(0) - 1 != features.size()) {
-      85            8 :             throw std::invalid_argument("Classifier: X " + std::to_string(dataset.size(0) - 1) + " and features " + std::to_string(features.size()) + " must have the same number of features");
-      86              :         }
-      87         1744 :         if (states.find(className) == states.end()) {
-      88            8 :             throw std::invalid_argument("class name not found in states");
-      89              :         }
-      90        32996 :         for (auto feature : features) {
-      91        31268 :             if (states.find(feature) == states.end()) {
-      92            8 :                 throw std::invalid_argument("feature [" + feature + "] not found in states");
-      93              :             }
-      94        31268 :         }
-      95         1728 :     }
-      96         1844 :     torch::Tensor Classifier::predict(torch::Tensor& X)
-      97              :     {
-      98         1844 :         if (!fitted) {
-      99           16 :             throw std::logic_error(CLASSIFIER_NOT_FITTED);
-     100              :         }
-     101         1828 :         return model.predict(X);
-     102              :     }
-     103           16 :     std::vector<int> Classifier::predict(std::vector<std::vector<int>>& X)
-     104              :     {
-     105           16 :         if (!fitted) {
-     106            8 :             throw std::logic_error(CLASSIFIER_NOT_FITTED);
-     107              :         }
-     108            8 :         auto m_ = X[0].size();
-     109            8 :         auto n_ = X.size();
-     110            8 :         std::vector<std::vector<int>> Xd(n_, std::vector<int>(m_, 0));
-     111           40 :         for (auto i = 0; i < n_; i++) {
-     112           64 :             Xd[i] = std::vector<int>(X[i].begin(), X[i].end());
-     113              :         }
-     114            8 :         auto yp = model.predict(Xd);
-     115           16 :         return yp;
-     116            8 :     }
-     117         1484 :     torch::Tensor Classifier::predict_proba(torch::Tensor& X)
-     118              :     {
-     119         1484 :         if (!fitted) {
-     120            8 :             throw std::logic_error(CLASSIFIER_NOT_FITTED);
-     121              :         }
-     122         1476 :         return model.predict_proba(X);
-     123              :     }
-     124          548 :     std::vector<std::vector<double>> Classifier::predict_proba(std::vector<std::vector<int>>& X)
-     125              :     {
-     126          548 :         if (!fitted) {
-     127            8 :             throw std::logic_error(CLASSIFIER_NOT_FITTED);
-     128              :         }
-     129          540 :         auto m_ = X[0].size();
-     130          540 :         auto n_ = X.size();
-     131          540 :         std::vector<std::vector<int>> Xd(n_, std::vector<int>(m_, 0));
-     132              :         // Convert to nxm vector
-     133         5040 :         for (auto i = 0; i < n_; i++) {
-     134         9000 :             Xd[i] = std::vector<int>(X[i].begin(), X[i].end());
-     135              :         }
-     136          540 :         auto yp = model.predict_proba(Xd);
-     137         1080 :         return yp;
-     138          540 :     }
-     139          112 :     float Classifier::score(torch::Tensor& X, torch::Tensor& y)
-     140              :     {
-     141          112 :         torch::Tensor y_pred = predict(X);
-     142          208 :         return (y_pred == y).sum().item<float>() / y.size(0);
-     143          104 :     }
-     144           16 :     float Classifier::score(std::vector<std::vector<int>>& X, std::vector<int>& y)
-     145              :     {
-     146           16 :         if (!fitted) {
-     147            8 :             throw std::logic_error(CLASSIFIER_NOT_FITTED);
-     148              :         }
-     149            8 :         return model.score(X, y);
-     150              :     }
-     151           24 :     std::vector<std::string> Classifier::show() const
-     152              :     {
-     153           24 :         return model.show();
-     154              :     }
-     155         1576 :     void Classifier::addNodes()
-     156              :     {
-     157              :         // Add all nodes to the network
-     158        30872 :         for (const auto& feature : features) {
-     159        29296 :             model.addNode(feature);
-     160              :         }
-     161         1576 :         model.addNode(className);
-     162         1576 :     }
-     163          332 :     int Classifier::getNumberOfNodes() const
-     164              :     {
-     165              :         // Features does not include class
-     166          332 :         return fitted ? model.getFeatures().size() : 0;
-     167              :     }
-     168          332 :     int Classifier::getNumberOfEdges() const
-     169              :     {
-     170          332 :         return fitted ? model.getNumEdges() : 0;
-     171              :     }
-     172           24 :     int Classifier::getNumberOfStates() const
-     173              :     {
-     174           24 :         return fitted ? model.getStates() : 0;
-     175              :     }
-     176          348 :     int Classifier::getClassNumStates() const
-     177              :     {
-     178          348 :         return fitted ? model.getClassNumStates() : 0;
-     179              :     }
-     180            4 :     std::vector<std::string> Classifier::topological_order()
-     181              :     {
-     182            4 :         return model.topological_sort();
-     183              :     }
-     184            4 :     std::string Classifier::dump_cpt() const
-     185              :     {
-     186            4 :         return model.dump_cpt();
-     187              :     }
-     188           92 :     void Classifier::setHyperparameters(const nlohmann::json& hyperparameters)
-     189              :     {
-     190           92 :         if (!hyperparameters.empty()) {
-     191            8 :             throw std::invalid_argument("Invalid hyperparameters" + hyperparameters.dump());
-     192              :         }
-     193           84 :     }
-     194              : }
-        
-
-
- - - - -
Generated by: LCOV version 2.0-1
-
- - - diff --git a/html/bayesnet/classifiers/Classifier.cc.gcov.overview.html b/html/bayesnet/classifiers/Classifier.cc.gcov.overview.html deleted file mode 100644 index f6fa969..0000000 --- a/html/bayesnet/classifiers/Classifier.cc.gcov.overview.html +++ /dev/null @@ -1,69 +0,0 @@ - - - - - - LCOV - BayesNet Coverage Report - bayesnet/classifiers/Classifier.cc - - - - - - - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - - -
- Top

- Overview -
- - diff --git a/html/bayesnet/classifiers/Classifier.cc.gcov.png b/html/bayesnet/classifiers/Classifier.cc.gcov.png deleted file mode 100644 index 5148c17..0000000 Binary files a/html/bayesnet/classifiers/Classifier.cc.gcov.png and /dev/null differ diff --git a/html/bayesnet/classifiers/Classifier.h.func-c.html b/html/bayesnet/classifiers/Classifier.h.func-c.html deleted file mode 100644 index 78d1c26..0000000 --- a/html/bayesnet/classifiers/Classifier.h.func-c.html +++ /dev/null @@ -1,111 +0,0 @@ - - - - - - - LCOV - BayesNet Coverage Report - bayesnet/classifiers/Classifier.h - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - bayesnet/classifiers - Classifier.h (source / functions)CoverageTotalHit
Test:BayesNet Coverage ReportLines:100.0 %44
Test Date:2024-05-06 17:54:04Functions:100.0 %44
Legend: Lines: - hit - not hit -
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Function Name Sort by function nameHit count Sort by function hit count
bayesnet::Classifier::getVersion[abi:cxx11]()32
bayesnet::Classifier::getNotes[abi:cxx11]() const80
bayesnet::Classifier::getStatus() const128
bayesnet::Classifier::~Classifier()1680
-
-
- - - -
Generated by: LCOV version 2.0-1
-
- - - diff --git a/html/bayesnet/classifiers/Classifier.h.func.html b/html/bayesnet/classifiers/Classifier.h.func.html deleted file mode 100644 index bb4a025..0000000 --- a/html/bayesnet/classifiers/Classifier.h.func.html +++ /dev/null @@ -1,111 +0,0 @@ - - - - - - - LCOV - BayesNet Coverage Report - bayesnet/classifiers/Classifier.h - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - bayesnet/classifiers - Classifier.h (source / functions)CoverageTotalHit
Test:BayesNet Coverage ReportLines:100.0 %44
Test Date:2024-05-06 17:54:04Functions:100.0 %44
Legend: Lines: - hit - not hit -
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Function Name Sort by function nameHit count Sort by function hit count
bayesnet::Classifier::getNotes[abi:cxx11]() const80
bayesnet::Classifier::getStatus() const128
bayesnet::Classifier::getVersion[abi:cxx11]()32
bayesnet::Classifier::~Classifier()1680
-
-
- - - -
Generated by: LCOV version 2.0-1
-
- - - diff --git a/html/bayesnet/classifiers/Classifier.h.gcov.frameset.html b/html/bayesnet/classifiers/Classifier.h.gcov.frameset.html deleted file mode 100644 index 5ec80ed..0000000 --- a/html/bayesnet/classifiers/Classifier.h.gcov.frameset.html +++ /dev/null @@ -1,19 +0,0 @@ - - - - - - - LCOV - BayesNet Coverage Report - bayesnet/classifiers/Classifier.h - - - - - - - - <center>Frames not supported by your browser!<br></center> - - - - diff --git a/html/bayesnet/classifiers/Classifier.h.gcov.html b/html/bayesnet/classifiers/Classifier.h.gcov.html deleted file mode 100644 index 6d0578d..0000000 --- a/html/bayesnet/classifiers/Classifier.h.gcov.html +++ /dev/null @@ -1,149 +0,0 @@ - - - - - - - LCOV - BayesNet Coverage Report - bayesnet/classifiers/Classifier.h - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - bayesnet/classifiers - Classifier.h (source / functions)CoverageTotalHit
Test:BayesNet Coverage ReportLines:100.0 %44
Test Date:2024-05-06 17:54:04Functions:100.0 %44
Legend: Lines: - hit - not hit -
-
- - - - - - - - -

-
            Line data    Source code
-
-       1              : // ***************************************************************
-       2              : // SPDX-FileCopyrightText: Copyright 2024 Ricardo Montañana Gómez
-       3              : // SPDX-FileType: SOURCE
-       4              : // SPDX-License-Identifier: MIT
-       5              : // ***************************************************************
-       6              : 
-       7              : #ifndef CLASSIFIER_H
-       8              : #define CLASSIFIER_H
-       9              : #include <torch/torch.h>
-      10              : #include "bayesnet/utils/BayesMetrics.h"
-      11              : #include "bayesnet/network/Network.h"
-      12              : #include "bayesnet/BaseClassifier.h"
-      13              : 
-      14              : namespace bayesnet {
-      15              :     class Classifier : public BaseClassifier {
-      16              :     public:
-      17              :         Classifier(Network model);
-      18         1680 :         virtual ~Classifier() = default;
-      19              :         Classifier& fit(std::vector<std::vector<int>>& X, std::vector<int>& y, const std::vector<std::string>& features, const std::string& className, std::map<std::string, std::vector<int>>& states) override;
-      20              :         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) override;
-      21              :         Classifier& fit(torch::Tensor& dataset, const std::vector<std::string>& features, const std::string& className, std::map<std::string, std::vector<int>>& states) override;
-      22              :         Classifier& fit(torch::Tensor& dataset, const std::vector<std::string>& features, const std::string& className, std::map<std::string, std::vector<int>>& states, const torch::Tensor& weights) override;
-      23              :         void addNodes();
-      24              :         int getNumberOfNodes() const override;
-      25              :         int getNumberOfEdges() const override;
-      26              :         int getNumberOfStates() const override;
-      27              :         int getClassNumStates() const override;
-      28              :         torch::Tensor predict(torch::Tensor& X) override;
-      29              :         std::vector<int> predict(std::vector<std::vector<int>>& X) override;
-      30              :         torch::Tensor predict_proba(torch::Tensor& X) override;
-      31              :         std::vector<std::vector<double>> predict_proba(std::vector<std::vector<int>>& X) override;
-      32          128 :         status_t getStatus() const override { return status; }
-      33           96 :         std::string getVersion() override { return { project_version.begin(), project_version.end() }; };
-      34              :         float score(torch::Tensor& X, torch::Tensor& y) override;
-      35              :         float score(std::vector<std::vector<int>>& X, std::vector<int>& y) override;
-      36              :         std::vector<std::string> show() const override;
-      37              :         std::vector<std::string> topological_order()  override;
-      38           80 :         std::vector<std::string> getNotes() const override { return notes; }
-      39              :         std::string dump_cpt() const override;
-      40              :         void setHyperparameters(const nlohmann::json& hyperparameters) override; //For classifiers that don't have hyperparameters
-      41              :     protected:
-      42              :         bool fitted;
-      43              :         unsigned int m, n; // m: number of samples, n: number of features
-      44              :         Network model;
-      45              :         Metrics metrics;
-      46              :         std::vector<std::string> features;
-      47              :         std::string className;
-      48              :         std::map<std::string, std::vector<int>> states;
-      49              :         torch::Tensor dataset; // (n+1)xm tensor
-      50              :         status_t status = NORMAL;
-      51              :         std::vector<std::string> notes; // Used to store messages occurred during the fit process
-      52              :         void checkFitParameters();
-      53              :         virtual void buildModel(const torch::Tensor& weights) = 0;
-      54              :         void trainModel(const torch::Tensor& weights) override;
-      55              :         void buildDataset(torch::Tensor& y);
-      56              :     private:
-      57              :         Classifier& build(const std::vector<std::string>& features, const std::string& className, std::map<std::string, std::vector<int>>& states, const torch::Tensor& weights);
-      58              :     };
-      59              : }
-      60              : #endif
-      61              : 
-      62              : 
-      63              : 
-      64              : 
-      65              : 
-        
-
-
- - - - -
Generated by: LCOV version 2.0-1
-
- - - diff --git a/html/bayesnet/classifiers/Classifier.h.gcov.overview.html b/html/bayesnet/classifiers/Classifier.h.gcov.overview.html deleted file mode 100644 index 1810955..0000000 --- a/html/bayesnet/classifiers/Classifier.h.gcov.overview.html +++ /dev/null @@ -1,37 +0,0 @@ - - - - - - LCOV - BayesNet Coverage Report - bayesnet/classifiers/Classifier.h - - - - - - - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - - -
- Top

- Overview -
- - diff --git a/html/bayesnet/classifiers/Classifier.h.gcov.png b/html/bayesnet/classifiers/Classifier.h.gcov.png deleted file mode 100644 index aad5b61..0000000 Binary files a/html/bayesnet/classifiers/Classifier.h.gcov.png and /dev/null differ diff --git a/html/bayesnet/classifiers/KDB.cc.func-c.html b/html/bayesnet/classifiers/KDB.cc.func-c.html deleted file mode 100644 index 1f987a6..0000000 --- a/html/bayesnet/classifiers/KDB.cc.func-c.html +++ /dev/null @@ -1,118 +0,0 @@ - - - - - - - LCOV - BayesNet Coverage Report - bayesnet/classifiers/KDB.cc - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - bayesnet/classifiers - KDB.cc (source / functions)CoverageTotalHit
Test:BayesNet Coverage ReportLines:96.3 %5452
Test Date:2024-05-06 17:54:04Functions:100.0 %55
Legend: Lines: - hit - not hit -
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Function Name Sort by function nameHit count Sort by function hit count
bayesnet::KDB::graph(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) const8
bayesnet::KDB::setHyperparameters(nlohmann::json_abi_v3_11_3::basic_json<std::map, std::vector, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, bool, long, unsigned long, double, std::allocator, nlohmann::json_abi_v3_11_3::adl_serializer, std::vector<unsigned char, std::allocator<unsigned char> >, void> const&)12
bayesnet::KDB::buildModel(at::Tensor const&)52
bayesnet::KDB::KDB(int, float)148
bayesnet::KDB::add_m_edges(int, std::vector<int, std::allocator<int> >&, at::Tensor&)344
-
-
- - - -
Generated by: LCOV version 2.0-1
-
- - - diff --git a/html/bayesnet/classifiers/KDB.cc.func.html b/html/bayesnet/classifiers/KDB.cc.func.html deleted file mode 100644 index 2a880ae..0000000 --- a/html/bayesnet/classifiers/KDB.cc.func.html +++ /dev/null @@ -1,118 +0,0 @@ - - - - - - - LCOV - BayesNet Coverage Report - bayesnet/classifiers/KDB.cc - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - bayesnet/classifiers - KDB.cc (source / functions)CoverageTotalHit
Test:BayesNet Coverage ReportLines:96.3 %5452
Test Date:2024-05-06 17:54:04Functions:100.0 %55
Legend: Lines: - hit - not hit -
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Function Name Sort by function nameHit count Sort by function hit count
bayesnet::KDB::KDB(int, float)148
bayesnet::KDB::add_m_edges(int, std::vector<int, std::allocator<int> >&, at::Tensor&)344
bayesnet::KDB::buildModel(at::Tensor const&)52
bayesnet::KDB::graph(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) const8
bayesnet::KDB::setHyperparameters(nlohmann::json_abi_v3_11_3::basic_json<std::map, std::vector, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, bool, long, unsigned long, double, std::allocator, nlohmann::json_abi_v3_11_3::adl_serializer, std::vector<unsigned char, std::allocator<unsigned char> >, void> const&)12
-
-
- - - -
Generated by: LCOV version 2.0-1
-
- - - diff --git a/html/bayesnet/classifiers/KDB.cc.gcov.frameset.html b/html/bayesnet/classifiers/KDB.cc.gcov.frameset.html deleted file mode 100644 index c87890b..0000000 --- a/html/bayesnet/classifiers/KDB.cc.gcov.frameset.html +++ /dev/null @@ -1,19 +0,0 @@ - - - - - - - LCOV - BayesNet Coverage Report - bayesnet/classifiers/KDB.cc - - - - - - - - <center>Frames not supported by your browser!<br></center> - - - - diff --git a/html/bayesnet/classifiers/KDB.cc.gcov.html b/html/bayesnet/classifiers/KDB.cc.gcov.html deleted file mode 100644 index 910f3e9..0000000 --- a/html/bayesnet/classifiers/KDB.cc.gcov.html +++ /dev/null @@ -1,195 +0,0 @@ - - - - - - - LCOV - BayesNet Coverage Report - bayesnet/classifiers/KDB.cc - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - bayesnet/classifiers - KDB.cc (source / functions)CoverageTotalHit
Test:BayesNet Coverage ReportLines:96.3 %5452
Test Date:2024-05-06 17:54:04Functions:100.0 %55
Legend: Lines: - hit - not hit -
-
- - - - - - - - -

-
            Line data    Source code
-
-       1              : // ***************************************************************
-       2              : // SPDX-FileCopyrightText: Copyright 2024 Ricardo Montañana Gómez
-       3              : // SPDX-FileType: SOURCE
-       4              : // SPDX-License-Identifier: MIT
-       5              : // ***************************************************************
-       6              : 
-       7              : #include "KDB.h"
-       8              : 
-       9              : namespace bayesnet {
-      10          148 :     KDB::KDB(int k, float theta) : Classifier(Network()), k(k), theta(theta)
-      11              :     {
-      12          444 :         validHyperparameters = { "k", "theta" };
-      13              : 
-      14          444 :     }
-      15           12 :     void KDB::setHyperparameters(const nlohmann::json& hyperparameters_)
-      16              :     {
-      17           12 :         auto hyperparameters = hyperparameters_;
-      18           12 :         if (hyperparameters.contains("k")) {
-      19            4 :             k = hyperparameters["k"];
-      20            4 :             hyperparameters.erase("k");
-      21              :         }
-      22           12 :         if (hyperparameters.contains("theta")) {
-      23            4 :             theta = hyperparameters["theta"];
-      24            4 :             hyperparameters.erase("theta");
-      25              :         }
-      26           12 :         Classifier::setHyperparameters(hyperparameters);
-      27           12 :     }
-      28           52 :     void KDB::buildModel(const torch::Tensor& weights)
-      29              :     {
-      30              :         /*
-      31              :         1. For each feature Xi, compute mutual information, I(X;C),
-      32              :         where C is the class.
-      33              :         2. Compute class conditional mutual information I(Xi;XjIC), f or each
-      34              :         pair of features Xi and Xj, where i#j.
-      35              :         3. Let the used variable list, S, be empty.
-      36              :         4. Let the DAG network being constructed, BN, begin with a single
-      37              :         class node, C.
-      38              :         5. Repeat until S includes all domain features
-      39              :         5.1. Select feature Xmax which is not in S and has the largest value
-      40              :         I(Xmax;C).
-      41              :         5.2. Add a node to BN representing Xmax.
-      42              :         5.3. Add an arc from C to Xmax in BN.
-      43              :         5.4. Add m = min(lSl,/c) arcs from m distinct features Xj in S with
-      44              :         the highest value for I(Xmax;X,jC).
-      45              :         5.5. Add Xmax to S.
-      46              :         Compute the conditional probabilility infered by the structure of BN by
-      47              :         using counts from DB, and output BN.
-      48              :         */
-      49              :         // 1. For each feature Xi, compute mutual information, I(X;C),
-      50              :         // where C is the class.
-      51           52 :         addNodes();
-      52          156 :         const torch::Tensor& y = dataset.index({ -1, "..." });
-      53           52 :         std::vector<double> mi;
-      54          396 :         for (auto i = 0; i < features.size(); i++) {
-      55         1032 :             torch::Tensor firstFeature = dataset.index({ i, "..." });
-      56          344 :             mi.push_back(metrics.mutualInformation(firstFeature, y, weights));
-      57          344 :         }
-      58              :         // 2. Compute class conditional mutual information I(Xi;XjIC), f or each
-      59           52 :         auto conditionalEdgeWeights = metrics.conditionalEdge(weights);
-      60              :         // 3. Let the used variable list, S, be empty.
-      61           52 :         std::vector<int> S;
-      62              :         // 4. Let the DAG network being constructed, BN, begin with a single
-      63              :         // class node, C.
-      64              :         // 5. Repeat until S includes all domain features
-      65              :         // 5.1. Select feature Xmax which is not in S and has the largest value
-      66              :         // I(Xmax;C).
-      67           52 :         auto order = argsort(mi);
-      68          396 :         for (auto idx : order) {
-      69              :             // 5.2. Add a node to BN representing Xmax.
-      70              :             // 5.3. Add an arc from C to Xmax in BN.
-      71          344 :             model.addEdge(className, features[idx]);
-      72              :             // 5.4. Add m = min(lSl,/c) arcs from m distinct features Xj in S with
-      73              :             // the highest value for I(Xmax;X,jC).
-      74          344 :             add_m_edges(idx, S, conditionalEdgeWeights);
-      75              :             // 5.5. Add Xmax to S.
-      76          344 :             S.push_back(idx);
-      77              :         }
-      78          448 :     }
-      79          344 :     void KDB::add_m_edges(int idx, std::vector<int>& S, torch::Tensor& weights)
-      80              :     {
-      81          344 :         auto n_edges = std::min(k, static_cast<int>(S.size()));
-      82          344 :         auto cond_w = clone(weights);
-      83          344 :         bool exit_cond = k == 0;
-      84          344 :         int num = 0;
-      85         1004 :         while (!exit_cond) {
-      86         2640 :             auto max_minfo = argmax(cond_w.index({ idx, "..." })).item<int>();
-      87          660 :             auto belongs = find(S.begin(), S.end(), max_minfo) != S.end();
-      88         1764 :             if (belongs && cond_w.index({ idx, max_minfo }).item<float>() > theta) {
-      89              :                 try {
-      90          320 :                     model.addEdge(features[max_minfo], features[idx]);
-      91          320 :                     num++;
-      92              :                 }
-      93            0 :                 catch (const std::invalid_argument& e) {
-      94              :                     // Loops are not allowed
-      95            0 :                 }
-      96              :             }
-      97         2640 :             cond_w.index_put_({ idx, max_minfo }, -1);
-      98         1980 :             auto candidates_mask = cond_w.index({ idx, "..." }).gt(theta);
-      99          660 :             auto candidates = candidates_mask.nonzero();
-     100          660 :             exit_cond = num == n_edges || candidates.size(0) == 0;
-     101          660 :         }
-     102         2692 :     }
-     103            8 :     std::vector<std::string> KDB::graph(const std::string& title) const
-     104              :     {
-     105            8 :         std::string header{ title };
-     106            8 :         if (title == "KDB") {
-     107            8 :             header += " (k=" + std::to_string(k) + ", theta=" + std::to_string(theta) + ")";
-     108              :         }
-     109           16 :         return model.graph(header);
-     110            8 :     }
-     111              : }
-        
-
-
- - - - -
Generated by: LCOV version 2.0-1
-
- - - diff --git a/html/bayesnet/classifiers/KDB.cc.gcov.overview.html b/html/bayesnet/classifiers/KDB.cc.gcov.overview.html deleted file mode 100644 index 4ee7aca..0000000 --- a/html/bayesnet/classifiers/KDB.cc.gcov.overview.html +++ /dev/null @@ -1,48 +0,0 @@ - - - - - - LCOV - BayesNet Coverage Report - bayesnet/classifiers/KDB.cc - - - - - - - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - - -
- Top

- Overview -
- - diff --git a/html/bayesnet/classifiers/KDB.cc.gcov.png b/html/bayesnet/classifiers/KDB.cc.gcov.png deleted file mode 100644 index 1e87175..0000000 Binary files a/html/bayesnet/classifiers/KDB.cc.gcov.png and /dev/null differ diff --git a/html/bayesnet/classifiers/KDB.h.func-c.html b/html/bayesnet/classifiers/KDB.h.func-c.html deleted file mode 100644 index 6c28413..0000000 --- a/html/bayesnet/classifiers/KDB.h.func-c.html +++ /dev/null @@ -1,90 +0,0 @@ - - - - - - - LCOV - BayesNet Coverage Report - bayesnet/classifiers/KDB.h - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - bayesnet/classifiers - KDB.h (source / functions)CoverageTotalHit
Test:BayesNet Coverage ReportLines:100.0 %11
Test Date:2024-05-06 17:54:04Functions:100.0 %11
Legend: Lines: - hit - not hit -
-
- -
- - - - - - - - - - - - - - - - -

Function Name Sort by function nameHit count Sort by function hit count
bayesnet::KDB::~KDB()44
-
-
- - - -
Generated by: LCOV version 2.0-1
-
- - - diff --git a/html/bayesnet/classifiers/KDB.h.func.html b/html/bayesnet/classifiers/KDB.h.func.html deleted file mode 100644 index 76df4e6..0000000 --- a/html/bayesnet/classifiers/KDB.h.func.html +++ /dev/null @@ -1,90 +0,0 @@ - - - - - - - LCOV - BayesNet Coverage Report - bayesnet/classifiers/KDB.h - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - bayesnet/classifiers - KDB.h (source / functions)CoverageTotalHit
Test:BayesNet Coverage ReportLines:100.0 %11
Test Date:2024-05-06 17:54:04Functions:100.0 %11
Legend: Lines: - hit - not hit -
-
- -
- - - - - - - - - - - - - - - - -

Function Name Sort by function nameHit count Sort by function hit count
bayesnet::KDB::~KDB()44
-
-
- - - -
Generated by: LCOV version 2.0-1
-
- - - diff --git a/html/bayesnet/classifiers/KDB.h.gcov.frameset.html b/html/bayesnet/classifiers/KDB.h.gcov.frameset.html deleted file mode 100644 index a03d09b..0000000 --- a/html/bayesnet/classifiers/KDB.h.gcov.frameset.html +++ /dev/null @@ -1,19 +0,0 @@ - - - - - - - LCOV - BayesNet Coverage Report - bayesnet/classifiers/KDB.h - - - - - - - - <center>Frames not supported by your browser!<br></center> - - - - diff --git a/html/bayesnet/classifiers/KDB.h.gcov.html b/html/bayesnet/classifiers/KDB.h.gcov.html deleted file mode 100644 index b054798..0000000 --- a/html/bayesnet/classifiers/KDB.h.gcov.html +++ /dev/null @@ -1,111 +0,0 @@ - - - - - - - LCOV - BayesNet Coverage Report - bayesnet/classifiers/KDB.h - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - bayesnet/classifiers - KDB.h (source / functions)CoverageTotalHit
Test:BayesNet Coverage ReportLines:100.0 %11
Test Date:2024-05-06 17:54:04Functions:100.0 %11
Legend: Lines: - hit - not hit -
-
- - - - - - - - -

-
            Line data    Source code
-
-       1              : // ***************************************************************
-       2              : // SPDX-FileCopyrightText: Copyright 2024 Ricardo Montañana Gómez
-       3              : // SPDX-FileType: SOURCE
-       4              : // SPDX-License-Identifier: MIT
-       5              : // ***************************************************************
-       6              : 
-       7              : #ifndef KDB_H
-       8              : #define KDB_H
-       9              : #include <torch/torch.h>
-      10              : #include "bayesnet/utils/bayesnetUtils.h"
-      11              : #include "Classifier.h"
-      12              : namespace bayesnet {
-      13              :     class KDB : public Classifier {
-      14              :     private:
-      15              :         int k;
-      16              :         float theta;
-      17              :         void add_m_edges(int idx, std::vector<int>& S, torch::Tensor& weights);
-      18              :     protected:
-      19              :         void buildModel(const torch::Tensor& weights) override;
-      20              :     public:
-      21              :         explicit KDB(int k, float theta = 0.03);
-      22           44 :         virtual ~KDB() = default;
-      23              :         void setHyperparameters(const nlohmann::json& hyperparameters_) override;
-      24              :         std::vector<std::string> graph(const std::string& name = "KDB") const override;
-      25              :     };
-      26              : }
-      27              : #endif
-        
-
-
- - - - -
Generated by: LCOV version 2.0-1
-
- - - diff --git a/html/bayesnet/classifiers/KDB.h.gcov.overview.html b/html/bayesnet/classifiers/KDB.h.gcov.overview.html deleted file mode 100644 index 346dd56..0000000 --- a/html/bayesnet/classifiers/KDB.h.gcov.overview.html +++ /dev/null @@ -1,27 +0,0 @@ - - - - - - LCOV - BayesNet Coverage Report - bayesnet/classifiers/KDB.h - - - - - - - overview - overview - overview - overview - overview - overview - overview - - -
- Top

- Overview -
- - diff --git a/html/bayesnet/classifiers/KDB.h.gcov.png b/html/bayesnet/classifiers/KDB.h.gcov.png deleted file mode 100644 index 835cfa8..0000000 Binary files a/html/bayesnet/classifiers/KDB.h.gcov.png and /dev/null differ diff --git a/html/bayesnet/classifiers/KDBLd.cc.func-c.html b/html/bayesnet/classifiers/KDBLd.cc.func-c.html deleted file mode 100644 index b1b6ed0..0000000 --- a/html/bayesnet/classifiers/KDBLd.cc.func-c.html +++ /dev/null @@ -1,111 +0,0 @@ - - - - - - - LCOV - BayesNet Coverage Report - bayesnet/classifiers/KDBLd.cc - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - bayesnet/classifiers - KDBLd.cc (source / functions)CoverageTotalHit
Test:BayesNet Coverage ReportLines:100.0 %1717
Test Date:2024-05-06 17:54:04Functions:100.0 %44
Legend: Lines: - hit - not hit -
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Function Name Sort by function nameHit count Sort by function hit count
bayesnet::KDBLd::graph(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) const4
bayesnet::KDBLd::predict(at::Tensor&)16
bayesnet::KDBLd::fit(at::Tensor&, at::Tensor&, std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::map<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::vector<int, std::allocator<int> >, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, std::vector<int, std::allocator<int> > > > >&)20
bayesnet::KDBLd::KDBLd(int)68
-
-
- - - -
Generated by: LCOV version 2.0-1
-
- - - diff --git a/html/bayesnet/classifiers/KDBLd.cc.func.html b/html/bayesnet/classifiers/KDBLd.cc.func.html deleted file mode 100644 index 3a04439..0000000 --- a/html/bayesnet/classifiers/KDBLd.cc.func.html +++ /dev/null @@ -1,111 +0,0 @@ - - - - - - - LCOV - BayesNet Coverage Report - bayesnet/classifiers/KDBLd.cc - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - bayesnet/classifiers - KDBLd.cc (source / functions)CoverageTotalHit
Test:BayesNet Coverage ReportLines:100.0 %1717
Test Date:2024-05-06 17:54:04Functions:100.0 %44
Legend: Lines: - hit - not hit -
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Function Name Sort by function nameHit count Sort by function hit count
bayesnet::KDBLd::KDBLd(int)68
bayesnet::KDBLd::fit(at::Tensor&, at::Tensor&, std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::map<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::vector<int, std::allocator<int> >, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, std::vector<int, std::allocator<int> > > > >&)20
bayesnet::KDBLd::graph(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) const4
bayesnet::KDBLd::predict(at::Tensor&)16
-
-
- - - -
Generated by: LCOV version 2.0-1
-
- - - diff --git a/html/bayesnet/classifiers/KDBLd.cc.gcov.frameset.html b/html/bayesnet/classifiers/KDBLd.cc.gcov.frameset.html deleted file mode 100644 index 8f6d341..0000000 --- a/html/bayesnet/classifiers/KDBLd.cc.gcov.frameset.html +++ /dev/null @@ -1,19 +0,0 @@ - - - - - - - LCOV - BayesNet Coverage Report - bayesnet/classifiers/KDBLd.cc - - - - - - - - <center>Frames not supported by your browser!<br></center> - - - - diff --git a/html/bayesnet/classifiers/KDBLd.cc.gcov.html b/html/bayesnet/classifiers/KDBLd.cc.gcov.html deleted file mode 100644 index 0375be3..0000000 --- a/html/bayesnet/classifiers/KDBLd.cc.gcov.html +++ /dev/null @@ -1,119 +0,0 @@ - - - - - - - LCOV - BayesNet Coverage Report - bayesnet/classifiers/KDBLd.cc - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - bayesnet/classifiers - KDBLd.cc (source / functions)CoverageTotalHit
Test:BayesNet Coverage ReportLines:100.0 %1717
Test Date:2024-05-06 17:54:04Functions:100.0 %44
Legend: Lines: - hit - not hit -
-
- - - - - - - - -

-
            Line data    Source code
-
-       1              : // ***************************************************************
-       2              : // SPDX-FileCopyrightText: Copyright 2024 Ricardo Montañana Gómez
-       3              : // SPDX-FileType: SOURCE
-       4              : // SPDX-License-Identifier: MIT
-       5              : // ***************************************************************
-       6              : 
-       7              : #include "KDBLd.h"
-       8              : 
-       9              : namespace bayesnet {
-      10           68 :     KDBLd::KDBLd(int k) : KDB(k), Proposal(dataset, features, className) {}
-      11           20 :     KDBLd& KDBLd::fit(torch::Tensor& X_, torch::Tensor& y_, const std::vector<std::string>& features_, const std::string& className_, map<std::string, std::vector<int>>& states_)
-      12              :     {
-      13           20 :         checkInput(X_, y_);
-      14           20 :         features = features_;
-      15           20 :         className = className_;
-      16           20 :         Xf = X_;
-      17           20 :         y = y_;
-      18              :         // Fills std::vectors Xv & yv with the data from tensors X_ (discretized) & y
-      19           20 :         states = fit_local_discretization(y);
-      20              :         // We have discretized the input data
-      21              :         // 1st we need to fit the model to build the normal KDB structure, KDB::fit initializes the base Bayesian network
-      22           20 :         KDB::fit(dataset, features, className, states);
-      23           20 :         states = localDiscretizationProposal(states, model);
-      24           20 :         return *this;
-      25              :     }
-      26           16 :     torch::Tensor KDBLd::predict(torch::Tensor& X)
-      27              :     {
-      28           16 :         auto Xt = prepareX(X);
-      29           32 :         return KDB::predict(Xt);
-      30           16 :     }
-      31            4 :     std::vector<std::string> KDBLd::graph(const std::string& name) const
-      32              :     {
-      33            4 :         return KDB::graph(name);
-      34              :     }
-      35              : }
-        
-
-
- - - - -
Generated by: LCOV version 2.0-1
-
- - - diff --git a/html/bayesnet/classifiers/KDBLd.cc.gcov.overview.html b/html/bayesnet/classifiers/KDBLd.cc.gcov.overview.html deleted file mode 100644 index 93ed692..0000000 --- a/html/bayesnet/classifiers/KDBLd.cc.gcov.overview.html +++ /dev/null @@ -1,29 +0,0 @@ - - - - - - LCOV - BayesNet Coverage Report - bayesnet/classifiers/KDBLd.cc - - - - - - - overview - overview - overview - overview - overview - overview - overview - overview - overview - - -
- Top

- Overview -
- - diff --git a/html/bayesnet/classifiers/KDBLd.cc.gcov.png b/html/bayesnet/classifiers/KDBLd.cc.gcov.png deleted file mode 100644 index 286a270..0000000 Binary files a/html/bayesnet/classifiers/KDBLd.cc.gcov.png and /dev/null differ diff --git a/html/bayesnet/classifiers/KDBLd.h.func-c.html b/html/bayesnet/classifiers/KDBLd.h.func-c.html deleted file mode 100644 index ca49f19..0000000 --- a/html/bayesnet/classifiers/KDBLd.h.func-c.html +++ /dev/null @@ -1,90 +0,0 @@ - - - - - - - LCOV - BayesNet Coverage Report - bayesnet/classifiers/KDBLd.h - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - bayesnet/classifiers - KDBLd.h (source / functions)CoverageTotalHit
Test:BayesNet Coverage ReportLines:100.0 %11
Test Date:2024-05-06 17:54:04Functions:100.0 %11
Legend: Lines: - hit - not hit -
-
- -
- - - - - - - - - - - - - - - - -

Function Name Sort by function nameHit count Sort by function hit count
bayesnet::KDBLd::~KDBLd()20
-
-
- - - -
Generated by: LCOV version 2.0-1
-
- - - diff --git a/html/bayesnet/classifiers/KDBLd.h.func.html b/html/bayesnet/classifiers/KDBLd.h.func.html deleted file mode 100644 index ca196e4..0000000 --- a/html/bayesnet/classifiers/KDBLd.h.func.html +++ /dev/null @@ -1,90 +0,0 @@ - - - - - - - LCOV - BayesNet Coverage Report - bayesnet/classifiers/KDBLd.h - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - bayesnet/classifiers - KDBLd.h (source / functions)CoverageTotalHit
Test:BayesNet Coverage ReportLines:100.0 %11
Test Date:2024-05-06 17:54:04Functions:100.0 %11
Legend: Lines: - hit - not hit -
-
- -
- - - - - - - - - - - - - - - - -

Function Name Sort by function nameHit count Sort by function hit count
bayesnet::KDBLd::~KDBLd()20
-
-
- - - -
Generated by: LCOV version 2.0-1
-
- - - diff --git a/html/bayesnet/classifiers/KDBLd.h.gcov.frameset.html b/html/bayesnet/classifiers/KDBLd.h.gcov.frameset.html deleted file mode 100644 index 82ae19e..0000000 --- a/html/bayesnet/classifiers/KDBLd.h.gcov.frameset.html +++ /dev/null @@ -1,19 +0,0 @@ - - - - - - - LCOV - BayesNet Coverage Report - bayesnet/classifiers/KDBLd.h - - - - - - - - <center>Frames not supported by your browser!<br></center> - - - - diff --git a/html/bayesnet/classifiers/KDBLd.h.gcov.html b/html/bayesnet/classifiers/KDBLd.h.gcov.html deleted file mode 100644 index df42bea..0000000 --- a/html/bayesnet/classifiers/KDBLd.h.gcov.html +++ /dev/null @@ -1,108 +0,0 @@ - - - - - - - LCOV - BayesNet Coverage Report - bayesnet/classifiers/KDBLd.h - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - bayesnet/classifiers - KDBLd.h (source / functions)CoverageTotalHit
Test:BayesNet Coverage ReportLines:100.0 %11
Test Date:2024-05-06 17:54:04Functions:100.0 %11
Legend: Lines: - hit - not hit -
-
- - - - - - - - -

-
            Line data    Source code
-
-       1              : // ***************************************************************
-       2              : // SPDX-FileCopyrightText: Copyright 2024 Ricardo Montañana Gómez
-       3              : // SPDX-FileType: SOURCE
-       4              : // SPDX-License-Identifier: MIT
-       5              : // ***************************************************************
-       6              : 
-       7              : #ifndef KDBLD_H
-       8              : #define KDBLD_H
-       9              : #include "Proposal.h"
-      10              : #include "KDB.h"
-      11              : 
-      12              : namespace bayesnet {
-      13              :     class KDBLd : public KDB, public Proposal {
-      14              :     private:
-      15              :     public:
-      16              :         explicit KDBLd(int k);
-      17           20 :         virtual ~KDBLd() = default;
-      18              :         KDBLd& fit(torch::Tensor& X, torch::Tensor& y, const std::vector<std::string>& features, const std::string& className, map<std::string, std::vector<int>>& states) override;
-      19              :         std::vector<std::string> graph(const std::string& name = "KDB") const override;
-      20              :         torch::Tensor predict(torch::Tensor& X) override;
-      21              :         static inline std::string version() { return "0.0.1"; };
-      22              :     };
-      23              : }
-      24              : #endif // !KDBLD_H
-        
-
-
- - - - -
Generated by: LCOV version 2.0-1
-
- - - diff --git a/html/bayesnet/classifiers/KDBLd.h.gcov.overview.html b/html/bayesnet/classifiers/KDBLd.h.gcov.overview.html deleted file mode 100644 index 531b1ee..0000000 --- a/html/bayesnet/classifiers/KDBLd.h.gcov.overview.html +++ /dev/null @@ -1,26 +0,0 @@ - - - - - - LCOV - BayesNet Coverage Report - bayesnet/classifiers/KDBLd.h - - - - - - - overview - overview - overview - overview - overview - overview - - -
- Top

- Overview -
- - diff --git a/html/bayesnet/classifiers/KDBLd.h.gcov.png b/html/bayesnet/classifiers/KDBLd.h.gcov.png deleted file mode 100644 index d640507..0000000 Binary files a/html/bayesnet/classifiers/KDBLd.h.gcov.png and /dev/null differ diff --git a/html/bayesnet/classifiers/Proposal.cc.func-c.html b/html/bayesnet/classifiers/Proposal.cc.func-c.html deleted file mode 100644 index b6fcac4..0000000 --- a/html/bayesnet/classifiers/Proposal.cc.func-c.html +++ /dev/null @@ -1,139 +0,0 @@ - - - - - - - LCOV - BayesNet Coverage Report - bayesnet/classifiers/Proposal.cc - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - bayesnet/classifiers - Proposal.cc (source / functions)CoverageTotalHit
Test:BayesNet Coverage ReportLines:97.7 %8684
Test Date:2024-05-06 17:54:04Functions:100.0 %88
Legend: Lines: - hit - not hit -
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Function Name Sort by function nameHit count Sort by function hit count
bayesnet::Proposal::prepareX(at::Tensor&)168
bayesnet::Proposal::~Proposal()200
bayesnet::Proposal::localDiscretizationProposal(std::map<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::vector<int, std::allocator<int> >, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, std::vector<int, std::allocator<int> > > > > const&, bayesnet::Network&)212
bayesnet::Proposal::checkInput(at::Tensor const&, at::Tensor const&)228
bayesnet::Proposal::fit_local_discretization[abi:cxx11](at::Tensor const&)232
bayesnet::Proposal::Proposal(at::Tensor&, std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > >&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&)424
auto bayesnet::Proposal::localDiscretizationProposal(std::map<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::vector<int, std::allocator<int> >, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, std::vector<int, std::allocator<int> > > > > const&, bayesnet::Network&)::{lambda(auto:1 const&)#2}::operator()<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) const1372
auto bayesnet::Proposal::localDiscretizationProposal(std::map<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::vector<int, std::allocator<int> >, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, std::vector<int, std::allocator<int> > > > > const&, bayesnet::Network&)::{lambda(auto:1 const&)#1}::operator()<bayesnet::Node*>(bayesnet::Node* const&) const2696
-
-
- - - -
Generated by: LCOV version 2.0-1
-
- - - diff --git a/html/bayesnet/classifiers/Proposal.cc.func.html b/html/bayesnet/classifiers/Proposal.cc.func.html deleted file mode 100644 index 01294d6..0000000 --- a/html/bayesnet/classifiers/Proposal.cc.func.html +++ /dev/null @@ -1,139 +0,0 @@ - - - - - - - LCOV - BayesNet Coverage Report - bayesnet/classifiers/Proposal.cc - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - bayesnet/classifiers - Proposal.cc (source / functions)CoverageTotalHit
Test:BayesNet Coverage ReportLines:97.7 %8684
Test Date:2024-05-06 17:54:04Functions:100.0 %88
Legend: Lines: - hit - not hit -
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Function Name Sort by function nameHit count Sort by function hit count
auto bayesnet::Proposal::localDiscretizationProposal(std::map<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::vector<int, std::allocator<int> >, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, std::vector<int, std::allocator<int> > > > > const&, bayesnet::Network&)::{lambda(auto:1 const&)#1}::operator()<bayesnet::Node*>(bayesnet::Node* const&) const2696
auto bayesnet::Proposal::localDiscretizationProposal(std::map<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::vector<int, std::allocator<int> >, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, std::vector<int, std::allocator<int> > > > > const&, bayesnet::Network&)::{lambda(auto:1 const&)#2}::operator()<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) const1372
bayesnet::Proposal::Proposal(at::Tensor&, std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > >&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&)424
bayesnet::Proposal::checkInput(at::Tensor const&, at::Tensor const&)228
bayesnet::Proposal::fit_local_discretization[abi:cxx11](at::Tensor const&)232
bayesnet::Proposal::localDiscretizationProposal(std::map<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::vector<int, std::allocator<int> >, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, std::vector<int, std::allocator<int> > > > > const&, bayesnet::Network&)212
bayesnet::Proposal::prepareX(at::Tensor&)168
bayesnet::Proposal::~Proposal()200
-
-
- - - -
Generated by: LCOV version 2.0-1
-
- - - diff --git a/html/bayesnet/classifiers/Proposal.cc.gcov.frameset.html b/html/bayesnet/classifiers/Proposal.cc.gcov.frameset.html deleted file mode 100644 index 5eb6be5..0000000 --- a/html/bayesnet/classifiers/Proposal.cc.gcov.frameset.html +++ /dev/null @@ -1,19 +0,0 @@ - - - - - - - LCOV - BayesNet Coverage Report - bayesnet/classifiers/Proposal.cc - - - - - - - - <center>Frames not supported by your browser!<br></center> - - - - diff --git a/html/bayesnet/classifiers/Proposal.cc.gcov.html b/html/bayesnet/classifiers/Proposal.cc.gcov.html deleted file mode 100644 index fa0ef3f..0000000 --- a/html/bayesnet/classifiers/Proposal.cc.gcov.html +++ /dev/null @@ -1,200 +0,0 @@ - - - - - - - LCOV - BayesNet Coverage Report - bayesnet/classifiers/Proposal.cc - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - bayesnet/classifiers - Proposal.cc (source / functions)CoverageTotalHit
Test:BayesNet Coverage ReportLines:97.7 %8684
Test Date:2024-05-06 17:54:04Functions:100.0 %88
Legend: Lines: - hit - not hit -
-
- - - - - - - - -

-
            Line data    Source code
-
-       1              : // ***************************************************************
-       2              : // SPDX-FileCopyrightText: Copyright 2024 Ricardo Montañana Gómez
-       3              : // SPDX-FileType: SOURCE
-       4              : // SPDX-License-Identifier: MIT
-       5              : // ***************************************************************
-       6              : 
-       7              : #include <ArffFiles.h>
-       8              : #include "Proposal.h"
-       9              : 
-      10              : namespace bayesnet {
-      11          424 :     Proposal::Proposal(torch::Tensor& dataset_, std::vector<std::string>& features_, std::string& className_) : pDataset(dataset_), pFeatures(features_), pClassName(className_) {}
-      12          200 :     Proposal::~Proposal()
-      13              :     {
-      14         1896 :         for (auto& [key, value] : discretizers) {
-      15         1696 :             delete value;
-      16              :         }
-      17          200 :     }
-      18          228 :     void Proposal::checkInput(const torch::Tensor& X, const torch::Tensor& y)
-      19              :     {
-      20          228 :         if (!torch::is_floating_point(X)) {
-      21            0 :             throw std::invalid_argument("X must be a floating point tensor");
-      22              :         }
-      23          228 :         if (torch::is_floating_point(y)) {
-      24            0 :             throw std::invalid_argument("y must be an integer tensor");
-      25              :         }
-      26          228 :     }
-      27          212 :     map<std::string, std::vector<int>> Proposal::localDiscretizationProposal(const map<std::string, std::vector<int>>& oldStates, Network& model)
-      28              :     {
-      29              :         // order of local discretization is important. no good 0, 1, 2...
-      30              :         // although we rediscretize features after the local discretization of every feature
-      31          212 :         auto order = model.topological_sort();
-      32          212 :         auto& nodes = model.getNodes();
-      33          212 :         map<std::string, std::vector<int>> states = oldStates;
-      34          212 :         std::vector<int> indicesToReDiscretize;
-      35          212 :         bool upgrade = false; // Flag to check if we need to upgrade the model
-      36         1776 :         for (auto feature : order) {
-      37         1564 :             auto nodeParents = nodes[feature]->getParents();
-      38         1564 :             if (nodeParents.size() < 2) continue; // Only has class as parent
-      39         1324 :             upgrade = true;
-      40         1324 :             int index = find(pFeatures.begin(), pFeatures.end(), feature) - pFeatures.begin();
-      41         1324 :             indicesToReDiscretize.push_back(index); // We need to re-discretize this feature
-      42         1324 :             std::vector<std::string> parents;
-      43         4020 :             transform(nodeParents.begin(), nodeParents.end(), back_inserter(parents), [](const auto& p) { return p->getName(); });
-      44              :             // Remove class as parent as it will be added later
-      45         1324 :             parents.erase(remove(parents.begin(), parents.end(), pClassName), parents.end());
-      46              :             // Get the indices of the parents
-      47         1324 :             std::vector<int> indices;
-      48         1324 :             indices.push_back(-1); // Add class index
-      49         2696 :             transform(parents.begin(), parents.end(), back_inserter(indices), [&](const auto& p) {return find(pFeatures.begin(), pFeatures.end(), p) - pFeatures.begin(); });
-      50              :             // Now we fit the discretizer of the feature, conditioned on its parents and the class i.e. discretizer.fit(X[index], X[indices] + y)
-      51         1324 :             std::vector<std::string> yJoinParents(Xf.size(1));
-      52         4020 :             for (auto idx : indices) {
-      53       958640 :                 for (int i = 0; i < Xf.size(1); ++i) {
-      54      2867832 :                     yJoinParents[i] += to_string(pDataset.index({ idx, i }).item<int>());
-      55              :                 }
-      56              :             }
-      57         1324 :             auto arff = ArffFiles();
-      58         1324 :             auto yxv = arff.factorize(yJoinParents);
-      59         2648 :             auto xvf_ptr = Xf.index({ index }).data_ptr<float>();
-      60         1324 :             auto xvf = std::vector<mdlp::precision_t>(xvf_ptr, xvf_ptr + Xf.size(1));
-      61         1324 :             discretizers[feature]->fit(xvf, yxv);
-      62         1804 :         }
-      63          212 :         if (upgrade) {
-      64              :             // Discretize again X (only the affected indices) with the new fitted discretizers
-      65         1536 :             for (auto index : indicesToReDiscretize) {
-      66         2648 :                 auto Xt_ptr = Xf.index({ index }).data_ptr<float>();
-      67         1324 :                 auto Xt = std::vector<float>(Xt_ptr, Xt_ptr + Xf.size(1));
-      68         5296 :                 pDataset.index_put_({ index, "..." }, torch::tensor(discretizers[pFeatures[index]]->transform(Xt)));
-      69         1324 :                 auto xStates = std::vector<int>(discretizers[pFeatures[index]]->getCutPoints().size() + 1);
-      70         1324 :                 iota(xStates.begin(), xStates.end(), 0);
-      71              :                 //Update new states of the feature/node
-      72         1324 :                 states[pFeatures[index]] = xStates;
-      73         1324 :             }
-      74          212 :             const torch::Tensor weights = torch::full({ pDataset.size(1) }, 1.0 / pDataset.size(1), torch::kDouble);
-      75          212 :             model.fit(pDataset, weights, pFeatures, pClassName, states);
-      76          212 :         }
-      77          424 :         return states;
-      78       960128 :     }
-      79          232 :     map<std::string, std::vector<int>> Proposal::fit_local_discretization(const torch::Tensor& y)
-      80              :     {
-      81              :         // Discretize the continuous input data and build pDataset (Classifier::dataset)
-      82          232 :         int m = Xf.size(1);
-      83          232 :         int n = Xf.size(0);
-      84          232 :         map<std::string, std::vector<int>> states;
-      85          232 :         pDataset = torch::zeros({ n + 1, m }, torch::kInt32);
-      86          232 :         auto yv = std::vector<int>(y.data_ptr<int>(), y.data_ptr<int>() + y.size(0));
-      87              :         // discretize input data by feature(row)
-      88         1944 :         for (auto i = 0; i < pFeatures.size(); ++i) {
-      89         1712 :             auto* discretizer = new mdlp::CPPFImdlp();
-      90         3424 :             auto Xt_ptr = Xf.index({ i }).data_ptr<float>();
-      91         1712 :             auto Xt = std::vector<float>(Xt_ptr, Xt_ptr + Xf.size(1));
-      92         1712 :             discretizer->fit(Xt, yv);
-      93         6848 :             pDataset.index_put_({ i, "..." }, torch::tensor(discretizer->transform(Xt)));
-      94         1712 :             auto xStates = std::vector<int>(discretizer->getCutPoints().size() + 1);
-      95         1712 :             iota(xStates.begin(), xStates.end(), 0);
-      96         1712 :             states[pFeatures[i]] = xStates;
-      97         1712 :             discretizers[pFeatures[i]] = discretizer;
-      98         1712 :         }
-      99          232 :         int n_classes = torch::max(y).item<int>() + 1;
-     100          232 :         auto yStates = std::vector<int>(n_classes);
-     101          232 :         iota(yStates.begin(), yStates.end(), 0);
-     102          232 :         states[pClassName] = yStates;
-     103          696 :         pDataset.index_put_({ n, "..." }, y);
-     104          464 :         return states;
-     105         3888 :     }
-     106          168 :     torch::Tensor Proposal::prepareX(torch::Tensor& X)
-     107              :     {
-     108          168 :         auto Xtd = torch::zeros_like(X, torch::kInt32);
-     109         1376 :         for (int i = 0; i < X.size(0); ++i) {
-     110         1208 :             auto Xt = std::vector<float>(X[i].data_ptr<float>(), X[i].data_ptr<float>() + X.size(1));
-     111         1208 :             auto Xd = discretizers[pFeatures[i]]->transform(Xt);
-     112         3624 :             Xtd.index_put_({ i }, torch::tensor(Xd, torch::kInt32));
-     113         1208 :         }
-     114          336 :         return Xtd;
-     115         1376 :     }
-     116              : }
-        
-
-
- - - - -
Generated by: LCOV version 2.0-1
-
- - - diff --git a/html/bayesnet/classifiers/Proposal.cc.gcov.overview.html b/html/bayesnet/classifiers/Proposal.cc.gcov.overview.html deleted file mode 100644 index 143a658..0000000 --- a/html/bayesnet/classifiers/Proposal.cc.gcov.overview.html +++ /dev/null @@ -1,49 +0,0 @@ - - - - - - LCOV - BayesNet Coverage Report - bayesnet/classifiers/Proposal.cc - - - - - - - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - - -
- Top

- Overview -
- - diff --git a/html/bayesnet/classifiers/Proposal.cc.gcov.png b/html/bayesnet/classifiers/Proposal.cc.gcov.png deleted file mode 100644 index fdaf4ea..0000000 Binary files a/html/bayesnet/classifiers/Proposal.cc.gcov.png and /dev/null differ diff --git a/html/bayesnet/classifiers/SPODE.cc.func-c.html b/html/bayesnet/classifiers/SPODE.cc.func-c.html deleted file mode 100644 index acc8273..0000000 --- a/html/bayesnet/classifiers/SPODE.cc.func-c.html +++ /dev/null @@ -1,104 +0,0 @@ - - - - - - - LCOV - BayesNet Coverage Report - bayesnet/classifiers/SPODE.cc - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - bayesnet/classifiers - SPODE.cc (source / functions)CoverageTotalHit
Test:BayesNet Coverage ReportLines:100.0 %1010
Test Date:2024-05-06 17:54:04Functions:100.0 %33
Legend: Lines: - hit - not hit -
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Function Name Sort by function nameHit count Sort by function hit count
bayesnet::SPODE::graph(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) const68
bayesnet::SPODE::buildModel(at::Tensor const&)1016
bayesnet::SPODE::SPODE(int)1124
-
-
- - - -
Generated by: LCOV version 2.0-1
-
- - - diff --git a/html/bayesnet/classifiers/SPODE.cc.func.html b/html/bayesnet/classifiers/SPODE.cc.func.html deleted file mode 100644 index 87e8648..0000000 --- a/html/bayesnet/classifiers/SPODE.cc.func.html +++ /dev/null @@ -1,104 +0,0 @@ - - - - - - - LCOV - BayesNet Coverage Report - bayesnet/classifiers/SPODE.cc - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - bayesnet/classifiers - SPODE.cc (source / functions)CoverageTotalHit
Test:BayesNet Coverage ReportLines:100.0 %1010
Test Date:2024-05-06 17:54:04Functions:100.0 %33
Legend: Lines: - hit - not hit -
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Function Name Sort by function nameHit count Sort by function hit count
bayesnet::SPODE::SPODE(int)1124
bayesnet::SPODE::buildModel(at::Tensor const&)1016
bayesnet::SPODE::graph(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) const68
-
-
- - - -
Generated by: LCOV version 2.0-1
-
- - - diff --git a/html/bayesnet/classifiers/SPODE.cc.gcov.frameset.html b/html/bayesnet/classifiers/SPODE.cc.gcov.frameset.html deleted file mode 100644 index 76bbdb6..0000000 --- a/html/bayesnet/classifiers/SPODE.cc.gcov.frameset.html +++ /dev/null @@ -1,19 +0,0 @@ - - - - - - - LCOV - BayesNet Coverage Report - bayesnet/classifiers/SPODE.cc - - - - - - - - <center>Frames not supported by your browser!<br></center> - - - - diff --git a/html/bayesnet/classifiers/SPODE.cc.gcov.html b/html/bayesnet/classifiers/SPODE.cc.gcov.html deleted file mode 100644 index c596c09..0000000 --- a/html/bayesnet/classifiers/SPODE.cc.gcov.html +++ /dev/null @@ -1,115 +0,0 @@ - - - - - - - LCOV - BayesNet Coverage Report - bayesnet/classifiers/SPODE.cc - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - bayesnet/classifiers - SPODE.cc (source / functions)CoverageTotalHit
Test:BayesNet Coverage ReportLines:100.0 %1010
Test Date:2024-05-06 17:54:04Functions:100.0 %33
Legend: Lines: - hit - not hit -
-
- - - - - - - - -

-
            Line data    Source code
-
-       1              : // ***************************************************************
-       2              : // SPDX-FileCopyrightText: Copyright 2024 Ricardo Montañana Gómez
-       3              : // SPDX-FileType: SOURCE
-       4              : // SPDX-License-Identifier: MIT
-       5              : // ***************************************************************
-       6              : 
-       7              : #include "SPODE.h"
-       8              : 
-       9              : namespace bayesnet {
-      10              : 
-      11         1124 :     SPODE::SPODE(int root) : Classifier(Network()), root(root) {}
-      12              : 
-      13         1016 :     void SPODE::buildModel(const torch::Tensor& weights)
-      14              :     {
-      15              :         // 0. Add all nodes to the model
-      16         1016 :         addNodes();
-      17              :         // 1. Add edges from the class node to all other nodes
-      18              :         // 2. Add edges from the root node to all other nodes
-      19        25680 :         for (int i = 0; i < static_cast<int>(features.size()); ++i) {
-      20        24664 :             model.addEdge(className, features[i]);
-      21        24664 :             if (i != root) {
-      22        23648 :                 model.addEdge(features[root], features[i]);
-      23              :             }
-      24              :         }
-      25         1016 :     }
-      26           68 :     std::vector<std::string> SPODE::graph(const std::string& name) const
-      27              :     {
-      28           68 :         return model.graph(name);
-      29              :     }
-      30              : 
-      31              : }
-        
-
-
- - - - -
Generated by: LCOV version 2.0-1
-
- - - diff --git a/html/bayesnet/classifiers/SPODE.cc.gcov.overview.html b/html/bayesnet/classifiers/SPODE.cc.gcov.overview.html deleted file mode 100644 index b38cc57..0000000 --- a/html/bayesnet/classifiers/SPODE.cc.gcov.overview.html +++ /dev/null @@ -1,28 +0,0 @@ - - - - - - LCOV - BayesNet Coverage Report - bayesnet/classifiers/SPODE.cc - - - - - - - overview - overview - overview - overview - overview - overview - overview - overview - - -
- Top

- Overview -
- - diff --git a/html/bayesnet/classifiers/SPODE.cc.gcov.png b/html/bayesnet/classifiers/SPODE.cc.gcov.png deleted file mode 100644 index b891cfe..0000000 Binary files a/html/bayesnet/classifiers/SPODE.cc.gcov.png and /dev/null differ diff --git a/html/bayesnet/classifiers/SPODE.h.func-c.html b/html/bayesnet/classifiers/SPODE.h.func-c.html deleted file mode 100644 index 872ebca..0000000 --- a/html/bayesnet/classifiers/SPODE.h.func-c.html +++ /dev/null @@ -1,90 +0,0 @@ - - - - - - - LCOV - BayesNet Coverage Report - bayesnet/classifiers/SPODE.h - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - bayesnet/classifiers - SPODE.h (source / functions)CoverageTotalHit
Test:BayesNet Coverage ReportLines:100.0 %11
Test Date:2024-05-06 17:54:04Functions:100.0 %11
Legend: Lines: - hit - not hit -
-
- -
- - - - - - - - - - - - - - - - -

Function Name Sort by function nameHit count Sort by function hit count
bayesnet::SPODE::~SPODE()1836
-
-
- - - -
Generated by: LCOV version 2.0-1
-
- - - diff --git a/html/bayesnet/classifiers/SPODE.h.func.html b/html/bayesnet/classifiers/SPODE.h.func.html deleted file mode 100644 index 2a850e6..0000000 --- a/html/bayesnet/classifiers/SPODE.h.func.html +++ /dev/null @@ -1,90 +0,0 @@ - - - - - - - LCOV - BayesNet Coverage Report - bayesnet/classifiers/SPODE.h - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - bayesnet/classifiers - SPODE.h (source / functions)CoverageTotalHit
Test:BayesNet Coverage ReportLines:100.0 %11
Test Date:2024-05-06 17:54:04Functions:100.0 %11
Legend: Lines: - hit - not hit -
-
- -
- - - - - - - - - - - - - - - - -

Function Name Sort by function nameHit count Sort by function hit count
bayesnet::SPODE::~SPODE()1836
-
-
- - - -
Generated by: LCOV version 2.0-1
-
- - - diff --git a/html/bayesnet/classifiers/SPODE.h.gcov.frameset.html b/html/bayesnet/classifiers/SPODE.h.gcov.frameset.html deleted file mode 100644 index 5bab82c..0000000 --- a/html/bayesnet/classifiers/SPODE.h.gcov.frameset.html +++ /dev/null @@ -1,19 +0,0 @@ - - - - - - - LCOV - BayesNet Coverage Report - bayesnet/classifiers/SPODE.h - - - - - - - - <center>Frames not supported by your browser!<br></center> - - - - diff --git a/html/bayesnet/classifiers/SPODE.h.gcov.html b/html/bayesnet/classifiers/SPODE.h.gcov.html deleted file mode 100644 index 7cf5fc8..0000000 --- a/html/bayesnet/classifiers/SPODE.h.gcov.html +++ /dev/null @@ -1,107 +0,0 @@ - - - - - - - LCOV - BayesNet Coverage Report - bayesnet/classifiers/SPODE.h - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - bayesnet/classifiers - SPODE.h (source / functions)CoverageTotalHit
Test:BayesNet Coverage ReportLines:100.0 %11
Test Date:2024-05-06 17:54:04Functions:100.0 %11
Legend: Lines: - hit - not hit -
-
- - - - - - - - -

-
            Line data    Source code
-
-       1              : // ***************************************************************
-       2              : // SPDX-FileCopyrightText: Copyright 2024 Ricardo Montañana Gómez
-       3              : // SPDX-FileType: SOURCE
-       4              : // SPDX-License-Identifier: MIT
-       5              : // ***************************************************************
-       6              : 
-       7              : #ifndef SPODE_H
-       8              : #define SPODE_H
-       9              : #include "Classifier.h"
-      10              : 
-      11              : namespace bayesnet {
-      12              :     class SPODE : public Classifier {
-      13              :     private:
-      14              :         int root;
-      15              :     protected:
-      16              :         void buildModel(const torch::Tensor& weights) override;
-      17              :     public:
-      18              :         explicit SPODE(int root);
-      19         1836 :         virtual ~SPODE() = default;
-      20              :         std::vector<std::string> graph(const std::string& name = "SPODE") const override;
-      21              :     };
-      22              : }
-      23              : #endif
-        
-
-
- - - - -
Generated by: LCOV version 2.0-1
-
- - - diff --git a/html/bayesnet/classifiers/SPODE.h.gcov.overview.html b/html/bayesnet/classifiers/SPODE.h.gcov.overview.html deleted file mode 100644 index 1142d9b..0000000 --- a/html/bayesnet/classifiers/SPODE.h.gcov.overview.html +++ /dev/null @@ -1,26 +0,0 @@ - - - - - - LCOV - BayesNet Coverage Report - bayesnet/classifiers/SPODE.h - - - - - - - overview - overview - overview - overview - overview - overview - - -
- Top

- Overview -
- - diff --git a/html/bayesnet/classifiers/SPODE.h.gcov.png b/html/bayesnet/classifiers/SPODE.h.gcov.png deleted file mode 100644 index 79e3825..0000000 Binary files a/html/bayesnet/classifiers/SPODE.h.gcov.png and /dev/null differ diff --git a/html/bayesnet/classifiers/SPODELd.cc.func-c.html b/html/bayesnet/classifiers/SPODELd.cc.func-c.html deleted file mode 100644 index 5d677f6..0000000 --- a/html/bayesnet/classifiers/SPODELd.cc.func-c.html +++ /dev/null @@ -1,125 +0,0 @@ - - - - - - - LCOV - BayesNet Coverage Report - bayesnet/classifiers/SPODELd.cc - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - bayesnet/classifiers - SPODELd.cc (source / functions)CoverageTotalHit
Test:BayesNet Coverage ReportLines:100.0 %2626
Test Date:2024-05-06 17:54:04Functions:100.0 %66
Legend: Lines: - hit - not hit -
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Function Name Sort by function nameHit count Sort by function hit count
bayesnet::SPODELd::fit(at::Tensor&, std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::map<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::vector<int, std::allocator<int> >, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, std::vector<int, std::allocator<int> > > > >&)8
bayesnet::SPODELd::graph(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) const36
bayesnet::SPODELd::predict(at::Tensor&)136
bayesnet::SPODELd::fit(at::Tensor&, at::Tensor&, std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::map<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::vector<int, std::allocator<int> >, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, std::vector<int, std::allocator<int> > > > >&)168
bayesnet::SPODELd::commonFit(std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::map<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::vector<int, std::allocator<int> >, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, std::vector<int, std::allocator<int> > > > >&)172
bayesnet::SPODELd::SPODELd(int)220
-
-
- - - -
Generated by: LCOV version 2.0-1
-
- - - diff --git a/html/bayesnet/classifiers/SPODELd.cc.func.html b/html/bayesnet/classifiers/SPODELd.cc.func.html deleted file mode 100644 index 217c3a2..0000000 --- a/html/bayesnet/classifiers/SPODELd.cc.func.html +++ /dev/null @@ -1,125 +0,0 @@ - - - - - - - LCOV - BayesNet Coverage Report - bayesnet/classifiers/SPODELd.cc - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - bayesnet/classifiers - SPODELd.cc (source / functions)CoverageTotalHit
Test:BayesNet Coverage ReportLines:100.0 %2626
Test Date:2024-05-06 17:54:04Functions:100.0 %66
Legend: Lines: - hit - not hit -
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Function Name Sort by function nameHit count Sort by function hit count
bayesnet::SPODELd::SPODELd(int)220
bayesnet::SPODELd::commonFit(std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::map<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::vector<int, std::allocator<int> >, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, std::vector<int, std::allocator<int> > > > >&)172
bayesnet::SPODELd::fit(at::Tensor&, at::Tensor&, std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::map<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::vector<int, std::allocator<int> >, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, std::vector<int, std::allocator<int> > > > >&)168
bayesnet::SPODELd::fit(at::Tensor&, std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::map<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::vector<int, std::allocator<int> >, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, std::vector<int, std::allocator<int> > > > >&)8
bayesnet::SPODELd::graph(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) const36
bayesnet::SPODELd::predict(at::Tensor&)136
-
-
- - - -
Generated by: LCOV version 2.0-1
-
- - - diff --git a/html/bayesnet/classifiers/SPODELd.cc.gcov.frameset.html b/html/bayesnet/classifiers/SPODELd.cc.gcov.frameset.html deleted file mode 100644 index 04b5f98..0000000 --- a/html/bayesnet/classifiers/SPODELd.cc.gcov.frameset.html +++ /dev/null @@ -1,19 +0,0 @@ - - - - - - - LCOV - BayesNet Coverage Report - bayesnet/classifiers/SPODELd.cc - - - - - - - - <center>Frames not supported by your browser!<br></center> - - - - diff --git a/html/bayesnet/classifiers/SPODELd.cc.gcov.html b/html/bayesnet/classifiers/SPODELd.cc.gcov.html deleted file mode 100644 index 29421e0..0000000 --- a/html/bayesnet/classifiers/SPODELd.cc.gcov.html +++ /dev/null @@ -1,134 +0,0 @@ - - - - - - - LCOV - BayesNet Coverage Report - bayesnet/classifiers/SPODELd.cc - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - bayesnet/classifiers - SPODELd.cc (source / functions)CoverageTotalHit
Test:BayesNet Coverage ReportLines:100.0 %2626
Test Date:2024-05-06 17:54:04Functions:100.0 %66
Legend: Lines: - hit - not hit -
-
- - - - - - - - -

-
            Line data    Source code
-
-       1              : // ***************************************************************
-       2              : // SPDX-FileCopyrightText: Copyright 2024 Ricardo Montañana Gómez
-       3              : // SPDX-FileType: SOURCE
-       4              : // SPDX-License-Identifier: MIT
-       5              : // ***************************************************************
-       6              : 
-       7              : #include "SPODELd.h"
-       8              : 
-       9              : namespace bayesnet {
-      10          220 :     SPODELd::SPODELd(int root) : SPODE(root), Proposal(dataset, features, className) {}
-      11          168 :     SPODELd& SPODELd::fit(torch::Tensor& X_, torch::Tensor& y_, const std::vector<std::string>& features_, const std::string& className_, map<std::string, std::vector<int>>& states_)
-      12              :     {
-      13          168 :         checkInput(X_, y_);
-      14          168 :         Xf = X_;
-      15          168 :         y = y_;
-      16          168 :         return commonFit(features_, className_, states_);
-      17              :     }
-      18              : 
-      19            8 :     SPODELd& SPODELd::fit(torch::Tensor& dataset, const std::vector<std::string>& features_, const std::string& className_, map<std::string, std::vector<int>>& states_)
-      20              :     {
-      21            8 :         if (!torch::is_floating_point(dataset)) {
-      22            4 :             throw std::runtime_error("Dataset must be a floating point tensor");
-      23              :         }
-      24           16 :         Xf = dataset.index({ torch::indexing::Slice(0, dataset.size(0) - 1), "..." }).clone();
-      25           12 :         y = dataset.index({ -1, "..." }).clone().to(torch::kInt32);
-      26            4 :         return commonFit(features_, className_, states_);
-      27           12 :     }
-      28              : 
-      29          172 :     SPODELd& SPODELd::commonFit(const std::vector<std::string>& features_, const std::string& className_, map<std::string, std::vector<int>>& states_)
-      30              :     {
-      31          172 :         features = features_;
-      32          172 :         className = className_;
-      33              :         // Fills std::vectors Xv & yv with the data from tensors X_ (discretized) & y
-      34          172 :         states = fit_local_discretization(y);
-      35              :         // We have discretized the input data
-      36              :         // 1st we need to fit the model to build the normal SPODE structure, SPODE::fit initializes the base Bayesian network
-      37          172 :         SPODE::fit(dataset, features, className, states);
-      38          172 :         states = localDiscretizationProposal(states, model);
-      39          172 :         return *this;
-      40              :     }
-      41          136 :     torch::Tensor SPODELd::predict(torch::Tensor& X)
-      42              :     {
-      43          136 :         auto Xt = prepareX(X);
-      44          272 :         return SPODE::predict(Xt);
-      45          136 :     }
-      46           36 :     std::vector<std::string> SPODELd::graph(const std::string& name) const
-      47              :     {
-      48           36 :         return SPODE::graph(name);
-      49              :     }
-      50              : }
-        
-
-
- - - - -
Generated by: LCOV version 2.0-1
-
- - - diff --git a/html/bayesnet/classifiers/SPODELd.cc.gcov.overview.html b/html/bayesnet/classifiers/SPODELd.cc.gcov.overview.html deleted file mode 100644 index 431ffcf..0000000 --- a/html/bayesnet/classifiers/SPODELd.cc.gcov.overview.html +++ /dev/null @@ -1,33 +0,0 @@ - - - - - - LCOV - BayesNet Coverage Report - bayesnet/classifiers/SPODELd.cc - - - - - - - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - - -
- Top

- Overview -
- - diff --git a/html/bayesnet/classifiers/SPODELd.cc.gcov.png b/html/bayesnet/classifiers/SPODELd.cc.gcov.png deleted file mode 100644 index a623770..0000000 Binary files a/html/bayesnet/classifiers/SPODELd.cc.gcov.png and /dev/null differ diff --git a/html/bayesnet/classifiers/SPODELd.h.func-c.html b/html/bayesnet/classifiers/SPODELd.h.func-c.html deleted file mode 100644 index c0d230c..0000000 --- a/html/bayesnet/classifiers/SPODELd.h.func-c.html +++ /dev/null @@ -1,90 +0,0 @@ - - - - - - - LCOV - BayesNet Coverage Report - bayesnet/classifiers/SPODELd.h - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - bayesnet/classifiers - SPODELd.h (source / functions)CoverageTotalHit
Test:BayesNet Coverage ReportLines:100.0 %11
Test Date:2024-05-06 17:54:04Functions:100.0 %11
Legend: Lines: - hit - not hit -
-
- -
- - - - - - - - - - - - - - - - -

Function Name Sort by function nameHit count Sort by function hit count
bayesnet::SPODELd::~SPODELd()320
-
-
- - - -
Generated by: LCOV version 2.0-1
-
- - - diff --git a/html/bayesnet/classifiers/SPODELd.h.func.html b/html/bayesnet/classifiers/SPODELd.h.func.html deleted file mode 100644 index ae57f22..0000000 --- a/html/bayesnet/classifiers/SPODELd.h.func.html +++ /dev/null @@ -1,90 +0,0 @@ - - - - - - - LCOV - BayesNet Coverage Report - bayesnet/classifiers/SPODELd.h - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - bayesnet/classifiers - SPODELd.h (source / functions)CoverageTotalHit
Test:BayesNet Coverage ReportLines:100.0 %11
Test Date:2024-05-06 17:54:04Functions:100.0 %11
Legend: Lines: - hit - not hit -
-
- -
- - - - - - - - - - - - - - - - -

Function Name Sort by function nameHit count Sort by function hit count
bayesnet::SPODELd::~SPODELd()320
-
-
- - - -
Generated by: LCOV version 2.0-1
-
- - - diff --git a/html/bayesnet/classifiers/SPODELd.h.gcov.frameset.html b/html/bayesnet/classifiers/SPODELd.h.gcov.frameset.html deleted file mode 100644 index 2dfdfd0..0000000 --- a/html/bayesnet/classifiers/SPODELd.h.gcov.frameset.html +++ /dev/null @@ -1,19 +0,0 @@ - - - - - - - LCOV - BayesNet Coverage Report - bayesnet/classifiers/SPODELd.h - - - - - - - - <center>Frames not supported by your browser!<br></center> - - - - diff --git a/html/bayesnet/classifiers/SPODELd.h.gcov.html b/html/bayesnet/classifiers/SPODELd.h.gcov.html deleted file mode 100644 index fd1f83a..0000000 --- a/html/bayesnet/classifiers/SPODELd.h.gcov.html +++ /dev/null @@ -1,109 +0,0 @@ - - - - - - - LCOV - BayesNet Coverage Report - bayesnet/classifiers/SPODELd.h - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - bayesnet/classifiers - SPODELd.h (source / functions)CoverageTotalHit
Test:BayesNet Coverage ReportLines:100.0 %11
Test Date:2024-05-06 17:54:04Functions:100.0 %11
Legend: Lines: - hit - not hit -
-
- - - - - - - - -

-
            Line data    Source code
-
-       1              : // ***************************************************************
-       2              : // SPDX-FileCopyrightText: Copyright 2024 Ricardo Montañana Gómez
-       3              : // SPDX-FileType: SOURCE
-       4              : // SPDX-License-Identifier: MIT
-       5              : // ***************************************************************
-       6              : 
-       7              : #ifndef SPODELD_H
-       8              : #define SPODELD_H
-       9              : #include "SPODE.h"
-      10              : #include "Proposal.h"
-      11              : 
-      12              : namespace bayesnet {
-      13              :     class SPODELd : public SPODE, public Proposal {
-      14              :     public:
-      15              :         explicit SPODELd(int root);
-      16          320 :         virtual ~SPODELd() = default;
-      17              :         SPODELd& fit(torch::Tensor& X, torch::Tensor& y, const std::vector<std::string>& features, const std::string& className, map<std::string, std::vector<int>>& states) override;
-      18              :         SPODELd& fit(torch::Tensor& dataset, const std::vector<std::string>& features, const std::string& className, map<std::string, std::vector<int>>& states) override;
-      19              :         SPODELd& commonFit(const std::vector<std::string>& features, const std::string& className, map<std::string, std::vector<int>>& states);
-      20              :         std::vector<std::string> graph(const std::string& name = "SPODE") const override;
-      21              :         torch::Tensor predict(torch::Tensor& X) override;
-      22              :         static inline std::string version() { return "0.0.1"; };
-      23              :     };
-      24              : }
-      25              : #endif // !SPODELD_H
-        
-
-
- - - - -
Generated by: LCOV version 2.0-1
-
- - - diff --git a/html/bayesnet/classifiers/SPODELd.h.gcov.overview.html b/html/bayesnet/classifiers/SPODELd.h.gcov.overview.html deleted file mode 100644 index b271338..0000000 --- a/html/bayesnet/classifiers/SPODELd.h.gcov.overview.html +++ /dev/null @@ -1,27 +0,0 @@ - - - - - - LCOV - BayesNet Coverage Report - bayesnet/classifiers/SPODELd.h - - - - - - - overview - overview - overview - overview - overview - overview - overview - - -
- Top

- Overview -
- - diff --git a/html/bayesnet/classifiers/SPODELd.h.gcov.png b/html/bayesnet/classifiers/SPODELd.h.gcov.png deleted file mode 100644 index 569995f..0000000 Binary files a/html/bayesnet/classifiers/SPODELd.h.gcov.png and /dev/null differ diff --git a/html/bayesnet/classifiers/SPnDE.cc.func-c.html b/html/bayesnet/classifiers/SPnDE.cc.func-c.html deleted file mode 100644 index 79a9fb1..0000000 --- a/html/bayesnet/classifiers/SPnDE.cc.func-c.html +++ /dev/null @@ -1,104 +0,0 @@ - - - - - - - LCOV - BayesNet Coverage Report - bayesnet/classifiers/SPnDE.cc - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - bayesnet/classifiers - SPnDE.cc (source / functions)CoverageTotalHit
Test:BayesNet Coverage ReportLines:100.0 %1414
Test Date:2024-05-06 17:54:04Functions:100.0 %33
Legend: Lines: - hit - not hit -
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Function Name Sort by function nameHit count Sort by function hit count
bayesnet::SPnDE::graph(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) const24
bayesnet::SPnDE::SPnDE(std::vector<int, std::allocator<int> >)456
bayesnet::SPnDE::buildModel(at::Tensor const&)456
-
-
- - - -
Generated by: LCOV version 2.0-1
-
- - - diff --git a/html/bayesnet/classifiers/SPnDE.cc.func.html b/html/bayesnet/classifiers/SPnDE.cc.func.html deleted file mode 100644 index 3e2fd7a..0000000 --- a/html/bayesnet/classifiers/SPnDE.cc.func.html +++ /dev/null @@ -1,104 +0,0 @@ - - - - - - - LCOV - BayesNet Coverage Report - bayesnet/classifiers/SPnDE.cc - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - bayesnet/classifiers - SPnDE.cc (source / functions)CoverageTotalHit
Test:BayesNet Coverage ReportLines:100.0 %1414
Test Date:2024-05-06 17:54:04Functions:100.0 %33
Legend: Lines: - hit - not hit -
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Function Name Sort by function nameHit count Sort by function hit count
bayesnet::SPnDE::SPnDE(std::vector<int, std::allocator<int> >)456
bayesnet::SPnDE::buildModel(at::Tensor const&)456
bayesnet::SPnDE::graph(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) const24
-
-
- - - -
Generated by: LCOV version 2.0-1
-
- - - diff --git a/html/bayesnet/classifiers/SPnDE.cc.gcov.frameset.html b/html/bayesnet/classifiers/SPnDE.cc.gcov.frameset.html deleted file mode 100644 index f62ea4c..0000000 --- a/html/bayesnet/classifiers/SPnDE.cc.gcov.frameset.html +++ /dev/null @@ -1,19 +0,0 @@ - - - - - - - LCOV - BayesNet Coverage Report - bayesnet/classifiers/SPnDE.cc - - - - - - - - <center>Frames not supported by your browser!<br></center> - - - - diff --git a/html/bayesnet/classifiers/SPnDE.cc.gcov.html b/html/bayesnet/classifiers/SPnDE.cc.gcov.html deleted file mode 100644 index 958f687..0000000 --- a/html/bayesnet/classifiers/SPnDE.cc.gcov.html +++ /dev/null @@ -1,122 +0,0 @@ - - - - - - - LCOV - BayesNet Coverage Report - bayesnet/classifiers/SPnDE.cc - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - bayesnet/classifiers - SPnDE.cc (source / functions)CoverageTotalHit
Test:BayesNet Coverage ReportLines:100.0 %1414
Test Date:2024-05-06 17:54:04Functions:100.0 %33
Legend: Lines: - hit - not hit -
-
- - - - - - - - -

-
            Line data    Source code
-
-       1              : // ***************************************************************
-       2              : // SPDX-FileCopyrightText: Copyright 2024 Ricardo Montañana Gómez
-       3              : // SPDX-FileType: SOURCE
-       4              : // SPDX-License-Identifier: MIT
-       5              : // ***************************************************************
-       6              : 
-       7              : #include "SPnDE.h"
-       8              : 
-       9              : namespace bayesnet {
-      10              : 
-      11          456 :     SPnDE::SPnDE(std::vector<int> parents) : Classifier(Network()), parents(parents) {}
-      12              : 
-      13          456 :     void SPnDE::buildModel(const torch::Tensor& weights)
-      14              :     {
-      15              :         // 0. Add all nodes to the model
-      16          456 :         addNodes();
-      17          456 :         std::vector<int> attributes;
-      18         4440 :         for (int i = 0; i < static_cast<int>(features.size()); ++i) {
-      19         3984 :             if (std::find(parents.begin(), parents.end(), i) == parents.end()) {
-      20         3072 :                 attributes.push_back(i);
-      21              :             }
-      22              :         }
-      23              :         // 1. Add edges from the class node to all other nodes
-      24              :         // 2. Add edges from the parents nodes to all other nodes
-      25         3528 :         for (const auto& attribute : attributes) {
-      26         3072 :             model.addEdge(className, features[attribute]);
-      27         9216 :             for (const auto& root : parents) {
-      28              : 
-      29         6144 :                 model.addEdge(features[root], features[attribute]);
-      30              :             }
-      31              :         }
-      32          456 :     }
-      33           24 :     std::vector<std::string> SPnDE::graph(const std::string& name) const
-      34              :     {
-      35           24 :         return model.graph(name);
-      36              :     }
-      37              : 
-      38              : }
-        
-
-
- - - - -
Generated by: LCOV version 2.0-1
-
- - - diff --git a/html/bayesnet/classifiers/SPnDE.cc.gcov.overview.html b/html/bayesnet/classifiers/SPnDE.cc.gcov.overview.html deleted file mode 100644 index 9aebe7f..0000000 --- a/html/bayesnet/classifiers/SPnDE.cc.gcov.overview.html +++ /dev/null @@ -1,30 +0,0 @@ - - - - - - LCOV - BayesNet Coverage Report - bayesnet/classifiers/SPnDE.cc - - - - - - - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - - -
- Top

- Overview -
- - diff --git a/html/bayesnet/classifiers/SPnDE.cc.gcov.png b/html/bayesnet/classifiers/SPnDE.cc.gcov.png deleted file mode 100644 index de6281b..0000000 Binary files a/html/bayesnet/classifiers/SPnDE.cc.gcov.png and /dev/null differ diff --git a/html/bayesnet/classifiers/SPnDE.h.func-c.html b/html/bayesnet/classifiers/SPnDE.h.func-c.html deleted file mode 100644 index ee90574..0000000 --- a/html/bayesnet/classifiers/SPnDE.h.func-c.html +++ /dev/null @@ -1,90 +0,0 @@ - - - - - - - LCOV - BayesNet Coverage Report - bayesnet/classifiers/SPnDE.h - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - bayesnet/classifiers - SPnDE.h (source / functions)CoverageTotalHit
Test:BayesNet Coverage ReportLines:100.0 %11
Test Date:2024-05-06 17:54:04Functions:100.0 %11
Legend: Lines: - hit - not hit -
-
- -
- - - - - - - - - - - - - - - - -

Function Name Sort by function nameHit count Sort by function hit count
bayesnet::SPnDE::~SPnDE()912
-
-
- - - -
Generated by: LCOV version 2.0-1
-
- - - diff --git a/html/bayesnet/classifiers/SPnDE.h.func.html b/html/bayesnet/classifiers/SPnDE.h.func.html deleted file mode 100644 index d504556..0000000 --- a/html/bayesnet/classifiers/SPnDE.h.func.html +++ /dev/null @@ -1,90 +0,0 @@ - - - - - - - LCOV - BayesNet Coverage Report - bayesnet/classifiers/SPnDE.h - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - bayesnet/classifiers - SPnDE.h (source / functions)CoverageTotalHit
Test:BayesNet Coverage ReportLines:100.0 %11
Test Date:2024-05-06 17:54:04Functions:100.0 %11
Legend: Lines: - hit - not hit -
-
- -
- - - - - - - - - - - - - - - - -

Function Name Sort by function nameHit count Sort by function hit count
bayesnet::SPnDE::~SPnDE()912
-
-
- - - -
Generated by: LCOV version 2.0-1
-
- - - diff --git a/html/bayesnet/classifiers/SPnDE.h.gcov.frameset.html b/html/bayesnet/classifiers/SPnDE.h.gcov.frameset.html deleted file mode 100644 index 9d7e330..0000000 --- a/html/bayesnet/classifiers/SPnDE.h.gcov.frameset.html +++ /dev/null @@ -1,19 +0,0 @@ - - - - - - - LCOV - BayesNet Coverage Report - bayesnet/classifiers/SPnDE.h - - - - - - - - <center>Frames not supported by your browser!<br></center> - - - - diff --git a/html/bayesnet/classifiers/SPnDE.h.gcov.html b/html/bayesnet/classifiers/SPnDE.h.gcov.html deleted file mode 100644 index 1574cb0..0000000 --- a/html/bayesnet/classifiers/SPnDE.h.gcov.html +++ /dev/null @@ -1,110 +0,0 @@ - - - - - - - LCOV - BayesNet Coverage Report - bayesnet/classifiers/SPnDE.h - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - bayesnet/classifiers - SPnDE.h (source / functions)CoverageTotalHit
Test:BayesNet Coverage ReportLines:100.0 %11
Test Date:2024-05-06 17:54:04Functions:100.0 %11
Legend: Lines: - hit - not hit -
-
- - - - - - - - -

-
            Line data    Source code
-
-       1              : // ***************************************************************
-       2              : // SPDX-FileCopyrightText: Copyright 2024 Ricardo Montañana Gómez
-       3              : // SPDX-FileType: SOURCE
-       4              : // SPDX-License-Identifier: MIT
-       5              : // ***************************************************************
-       6              : 
-       7              : #ifndef SPnDE_H
-       8              : #define SPnDE_H
-       9              : #include <vector>
-      10              : #include "Classifier.h"
-      11              : 
-      12              : namespace bayesnet {
-      13              :     class SPnDE : public Classifier {
-      14              :     public:
-      15              :         explicit SPnDE(std::vector<int> parents);
-      16          912 :         virtual ~SPnDE() = default;
-      17              :         std::vector<std::string> graph(const std::string& name = "SPnDE") const override;
-      18              :     protected:
-      19              :         void buildModel(const torch::Tensor& weights) override;
-      20              :     private:
-      21              :         std::vector<int> parents;
-      22              : 
-      23              : 
-      24              :     };
-      25              : }
-      26              : #endif
-        
-
-
- - - - -
Generated by: LCOV version 2.0-1
-
- - - diff --git a/html/bayesnet/classifiers/SPnDE.h.gcov.overview.html b/html/bayesnet/classifiers/SPnDE.h.gcov.overview.html deleted file mode 100644 index 6940831..0000000 --- a/html/bayesnet/classifiers/SPnDE.h.gcov.overview.html +++ /dev/null @@ -1,27 +0,0 @@ - - - - - - LCOV - BayesNet Coverage Report - bayesnet/classifiers/SPnDE.h - - - - - - - overview - overview - overview - overview - overview - overview - overview - - -
- Top

- Overview -
- - diff --git a/html/bayesnet/classifiers/SPnDE.h.gcov.png b/html/bayesnet/classifiers/SPnDE.h.gcov.png deleted file mode 100644 index 36d64f4..0000000 Binary files a/html/bayesnet/classifiers/SPnDE.h.gcov.png and /dev/null differ diff --git a/html/bayesnet/classifiers/TAN.cc.func-c.html b/html/bayesnet/classifiers/TAN.cc.func-c.html deleted file mode 100644 index 582bd48..0000000 --- a/html/bayesnet/classifiers/TAN.cc.func-c.html +++ /dev/null @@ -1,111 +0,0 @@ - - - - - - - LCOV - BayesNet Coverage Report - bayesnet/classifiers/TAN.cc - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - bayesnet/classifiers - TAN.cc (source / functions)CoverageTotalHit
Test:BayesNet Coverage ReportLines:100.0 %2323
Test Date:2024-05-06 17:54:04Functions:100.0 %44
Legend: Lines: - hit - not hit -
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Function Name Sort by function nameHit count Sort by function hit count
bayesnet::TAN::graph(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) const8
bayesnet::TAN::buildModel(at::Tensor const&)52
bayesnet::TAN::TAN()188
auto bayesnet::TAN::buildModel(at::Tensor const&)::{lambda(auto:1 const&, auto:2 const&)#1}::operator()<std::pair<int, float>, std::pair<int, float> >(std::pair<int, float> const&, std::pair<int, float> const&) const648
-
-
- - - -
Generated by: LCOV version 2.0-1
-
- - - diff --git a/html/bayesnet/classifiers/TAN.cc.func.html b/html/bayesnet/classifiers/TAN.cc.func.html deleted file mode 100644 index 487522b..0000000 --- a/html/bayesnet/classifiers/TAN.cc.func.html +++ /dev/null @@ -1,111 +0,0 @@ - - - - - - - LCOV - BayesNet Coverage Report - bayesnet/classifiers/TAN.cc - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - bayesnet/classifiers - TAN.cc (source / functions)CoverageTotalHit
Test:BayesNet Coverage ReportLines:100.0 %2323
Test Date:2024-05-06 17:54:04Functions:100.0 %44
Legend: Lines: - hit - not hit -
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Function Name Sort by function nameHit count Sort by function hit count
auto bayesnet::TAN::buildModel(at::Tensor const&)::{lambda(auto:1 const&, auto:2 const&)#1}::operator()<std::pair<int, float>, std::pair<int, float> >(std::pair<int, float> const&, std::pair<int, float> const&) const648
bayesnet::TAN::TAN()188
bayesnet::TAN::buildModel(at::Tensor const&)52
bayesnet::TAN::graph(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) const8
-
-
- - - -
Generated by: LCOV version 2.0-1
-
- - - diff --git a/html/bayesnet/classifiers/TAN.cc.gcov.frameset.html b/html/bayesnet/classifiers/TAN.cc.gcov.frameset.html deleted file mode 100644 index 1c81b16..0000000 --- a/html/bayesnet/classifiers/TAN.cc.gcov.frameset.html +++ /dev/null @@ -1,19 +0,0 @@ - - - - - - - LCOV - BayesNet Coverage Report - bayesnet/classifiers/TAN.cc - - - - - - - - <center>Frames not supported by your browser!<br></center> - - - - diff --git a/html/bayesnet/classifiers/TAN.cc.gcov.html b/html/bayesnet/classifiers/TAN.cc.gcov.html deleted file mode 100644 index 12c5c28..0000000 --- a/html/bayesnet/classifiers/TAN.cc.gcov.html +++ /dev/null @@ -1,129 +0,0 @@ - - - - - - - LCOV - BayesNet Coverage Report - bayesnet/classifiers/TAN.cc - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - bayesnet/classifiers - TAN.cc (source / functions)CoverageTotalHit
Test:BayesNet Coverage ReportLines:100.0 %2323
Test Date:2024-05-06 17:54:04Functions:100.0 %44
Legend: Lines: - hit - not hit -
-
- - - - - - - - -

-
            Line data    Source code
-
-       1              : // ***************************************************************
-       2              : // SPDX-FileCopyrightText: Copyright 2024 Ricardo Montañana Gómez
-       3              : // SPDX-FileType: SOURCE
-       4              : // SPDX-License-Identifier: MIT
-       5              : // ***************************************************************
-       6              : 
-       7              : #include "TAN.h"
-       8              : 
-       9              : namespace bayesnet {
-      10          188 :     TAN::TAN() : Classifier(Network()) {}
-      11              : 
-      12           52 :     void TAN::buildModel(const torch::Tensor& weights)
-      13              :     {
-      14              :         // 0. Add all nodes to the model
-      15           52 :         addNodes();
-      16              :         // 1. Compute mutual information between each feature and the class and set the root node
-      17              :         // as the highest mutual information with the class
-      18           52 :         auto mi = std::vector <std::pair<int, float >>();
-      19          156 :         torch::Tensor class_dataset = dataset.index({ -1, "..." });
-      20          356 :         for (int i = 0; i < static_cast<int>(features.size()); ++i) {
-      21          912 :             torch::Tensor feature_dataset = dataset.index({ i, "..." });
-      22          304 :             auto mi_value = metrics.mutualInformation(class_dataset, feature_dataset, weights);
-      23          304 :             mi.push_back({ i, mi_value });
-      24          304 :         }
-      25          700 :         sort(mi.begin(), mi.end(), [](const auto& left, const auto& right) {return left.second < right.second;});
-      26           52 :         auto root = mi[mi.size() - 1].first;
-      27              :         // 2. Compute mutual information between each feature and the class
-      28           52 :         auto weights_matrix = metrics.conditionalEdge(weights);
-      29              :         // 3. Compute the maximum spanning tree
-      30           52 :         auto mst = metrics.maximumSpanningTree(features, weights_matrix, root);
-      31              :         // 4. Add edges from the maximum spanning tree to the model
-      32          304 :         for (auto i = 0; i < mst.size(); ++i) {
-      33          252 :             auto [from, to] = mst[i];
-      34          252 :             model.addEdge(features[from], features[to]);
-      35              :         }
-      36              :         // 5. Add edges from the class to all features
-      37          356 :         for (auto feature : features) {
-      38          304 :             model.addEdge(className, feature);
-      39          304 :         }
-      40          408 :     }
-      41            8 :     std::vector<std::string> TAN::graph(const std::string& title) const
-      42              :     {
-      43            8 :         return model.graph(title);
-      44              :     }
-      45              : }
-        
-
-
- - - - -
Generated by: LCOV version 2.0-1
-
- - - diff --git a/html/bayesnet/classifiers/TAN.cc.gcov.overview.html b/html/bayesnet/classifiers/TAN.cc.gcov.overview.html deleted file mode 100644 index eb915d6..0000000 --- a/html/bayesnet/classifiers/TAN.cc.gcov.overview.html +++ /dev/null @@ -1,32 +0,0 @@ - - - - - - LCOV - BayesNet Coverage Report - bayesnet/classifiers/TAN.cc - - - - - - - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - - -
- Top

- Overview -
- - diff --git a/html/bayesnet/classifiers/TAN.cc.gcov.png b/html/bayesnet/classifiers/TAN.cc.gcov.png deleted file mode 100644 index e18de49..0000000 Binary files a/html/bayesnet/classifiers/TAN.cc.gcov.png and /dev/null differ diff --git a/html/bayesnet/classifiers/TAN.h.func-c.html b/html/bayesnet/classifiers/TAN.h.func-c.html deleted file mode 100644 index 5e95716..0000000 --- a/html/bayesnet/classifiers/TAN.h.func-c.html +++ /dev/null @@ -1,90 +0,0 @@ - - - - - - - LCOV - BayesNet Coverage Report - bayesnet/classifiers/TAN.h - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - bayesnet/classifiers - TAN.h (source / functions)CoverageTotalHit
Test:BayesNet Coverage ReportLines:100.0 %11
Test Date:2024-05-06 17:54:04Functions:100.0 %11
Legend: Lines: - hit - not hit -
-
- -
- - - - - - - - - - - - - - - - -

Function Name Sort by function nameHit count Sort by function hit count
bayesnet::TAN::~TAN()76
-
-
- - - -
Generated by: LCOV version 2.0-1
-
- - - diff --git a/html/bayesnet/classifiers/TAN.h.func.html b/html/bayesnet/classifiers/TAN.h.func.html deleted file mode 100644 index 002e588..0000000 --- a/html/bayesnet/classifiers/TAN.h.func.html +++ /dev/null @@ -1,90 +0,0 @@ - - - - - - - LCOV - BayesNet Coverage Report - bayesnet/classifiers/TAN.h - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - bayesnet/classifiers - TAN.h (source / functions)CoverageTotalHit
Test:BayesNet Coverage ReportLines:100.0 %11
Test Date:2024-05-06 17:54:04Functions:100.0 %11
Legend: Lines: - hit - not hit -
-
- -
- - - - - - - - - - - - - - - - -

Function Name Sort by function nameHit count Sort by function hit count
bayesnet::TAN::~TAN()76
-
-
- - - -
Generated by: LCOV version 2.0-1
-
- - - diff --git a/html/bayesnet/classifiers/TAN.h.gcov.frameset.html b/html/bayesnet/classifiers/TAN.h.gcov.frameset.html deleted file mode 100644 index 0974d93..0000000 --- a/html/bayesnet/classifiers/TAN.h.gcov.frameset.html +++ /dev/null @@ -1,19 +0,0 @@ - - - - - - - LCOV - BayesNet Coverage Report - bayesnet/classifiers/TAN.h - - - - - - - - <center>Frames not supported by your browser!<br></center> - - - - diff --git a/html/bayesnet/classifiers/TAN.h.gcov.html b/html/bayesnet/classifiers/TAN.h.gcov.html deleted file mode 100644 index 10dc513..0000000 --- a/html/bayesnet/classifiers/TAN.h.gcov.html +++ /dev/null @@ -1,105 +0,0 @@ - - - - - - - LCOV - BayesNet Coverage Report - bayesnet/classifiers/TAN.h - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - bayesnet/classifiers - TAN.h (source / functions)CoverageTotalHit
Test:BayesNet Coverage ReportLines:100.0 %11
Test Date:2024-05-06 17:54:04Functions:100.0 %11
Legend: Lines: - hit - not hit -
-
- - - - - - - - -

-
            Line data    Source code
-
-       1              : // ***************************************************************
-       2              : // SPDX-FileCopyrightText: Copyright 2024 Ricardo Montañana Gómez
-       3              : // SPDX-FileType: SOURCE
-       4              : // SPDX-License-Identifier: MIT
-       5              : // ***************************************************************
-       6              : 
-       7              : #ifndef TAN_H
-       8              : #define TAN_H
-       9              : #include "Classifier.h"
-      10              : namespace bayesnet {
-      11              :     class TAN : public Classifier {
-      12              :     private:
-      13              :     protected:
-      14              :         void buildModel(const torch::Tensor& weights) override;
-      15              :     public:
-      16              :         TAN();
-      17           76 :         virtual ~TAN() = default;
-      18              :         std::vector<std::string> graph(const std::string& name = "TAN") const override;
-      19              :     };
-      20              : }
-      21              : #endif
-        
-
-
- - - - -
Generated by: LCOV version 2.0-1
-
- - - diff --git a/html/bayesnet/classifiers/TAN.h.gcov.overview.html b/html/bayesnet/classifiers/TAN.h.gcov.overview.html deleted file mode 100644 index 0060cc0..0000000 --- a/html/bayesnet/classifiers/TAN.h.gcov.overview.html +++ /dev/null @@ -1,26 +0,0 @@ - - - - - - LCOV - BayesNet Coverage Report - bayesnet/classifiers/TAN.h - - - - - - - overview - overview - overview - overview - overview - overview - - -
- Top

- Overview -
- - diff --git a/html/bayesnet/classifiers/TAN.h.gcov.png b/html/bayesnet/classifiers/TAN.h.gcov.png deleted file mode 100644 index 5165005..0000000 Binary files a/html/bayesnet/classifiers/TAN.h.gcov.png and /dev/null differ diff --git a/html/bayesnet/classifiers/TANLd.cc.func-c.html b/html/bayesnet/classifiers/TANLd.cc.func-c.html deleted file mode 100644 index a635d16..0000000 --- a/html/bayesnet/classifiers/TANLd.cc.func-c.html +++ /dev/null @@ -1,111 +0,0 @@ - - - - - - - LCOV - BayesNet Coverage Report - bayesnet/classifiers/TANLd.cc - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - bayesnet/classifiers - TANLd.cc (source / functions)CoverageTotalHit
Test:BayesNet Coverage ReportLines:100.0 %1717
Test Date:2024-05-06 17:54:04Functions:100.0 %44
Legend: Lines: - hit - not hit -
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Function Name Sort by function nameHit count Sort by function hit count
bayesnet::TANLd::graph(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) const4
bayesnet::TANLd::predict(at::Tensor&)16
bayesnet::TANLd::fit(at::Tensor&, at::Tensor&, std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::map<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::vector<int, std::allocator<int> >, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, std::vector<int, std::allocator<int> > > > >&)20
bayesnet::TANLd::TANLd()68
-
-
- - - -
Generated by: LCOV version 2.0-1
-
- - - diff --git a/html/bayesnet/classifiers/TANLd.cc.func.html b/html/bayesnet/classifiers/TANLd.cc.func.html deleted file mode 100644 index d202a54..0000000 --- a/html/bayesnet/classifiers/TANLd.cc.func.html +++ /dev/null @@ -1,111 +0,0 @@ - - - - - - - LCOV - BayesNet Coverage Report - bayesnet/classifiers/TANLd.cc - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - bayesnet/classifiers - TANLd.cc (source / functions)CoverageTotalHit
Test:BayesNet Coverage ReportLines:100.0 %1717
Test Date:2024-05-06 17:54:04Functions:100.0 %44
Legend: Lines: - hit - not hit -
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Function Name Sort by function nameHit count Sort by function hit count
bayesnet::TANLd::TANLd()68
bayesnet::TANLd::fit(at::Tensor&, at::Tensor&, std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::map<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::vector<int, std::allocator<int> >, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, std::vector<int, std::allocator<int> > > > >&)20
bayesnet::TANLd::graph(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) const4
bayesnet::TANLd::predict(at::Tensor&)16
-
-
- - - -
Generated by: LCOV version 2.0-1
-
- - - diff --git a/html/bayesnet/classifiers/TANLd.cc.gcov.frameset.html b/html/bayesnet/classifiers/TANLd.cc.gcov.frameset.html deleted file mode 100644 index f5abeeb..0000000 --- a/html/bayesnet/classifiers/TANLd.cc.gcov.frameset.html +++ /dev/null @@ -1,19 +0,0 @@ - - - - - - - LCOV - BayesNet Coverage Report - bayesnet/classifiers/TANLd.cc - - - - - - - - <center>Frames not supported by your browser!<br></center> - - - - diff --git a/html/bayesnet/classifiers/TANLd.cc.gcov.html b/html/bayesnet/classifiers/TANLd.cc.gcov.html deleted file mode 100644 index d4a6403..0000000 --- a/html/bayesnet/classifiers/TANLd.cc.gcov.html +++ /dev/null @@ -1,120 +0,0 @@ - - - - - - - LCOV - BayesNet Coverage Report - bayesnet/classifiers/TANLd.cc - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - bayesnet/classifiers - TANLd.cc (source / functions)CoverageTotalHit
Test:BayesNet Coverage ReportLines:100.0 %1717
Test Date:2024-05-06 17:54:04Functions:100.0 %44
Legend: Lines: - hit - not hit -
-
- - - - - - - - -

-
            Line data    Source code
-
-       1              : // ***************************************************************
-       2              : // SPDX-FileCopyrightText: Copyright 2024 Ricardo Montañana Gómez
-       3              : // SPDX-FileType: SOURCE
-       4              : // SPDX-License-Identifier: MIT
-       5              : // ***************************************************************
-       6              : 
-       7              : #include "TANLd.h"
-       8              : 
-       9              : namespace bayesnet {
-      10           68 :     TANLd::TANLd() : TAN(), Proposal(dataset, features, className) {}
-      11           20 :     TANLd& TANLd::fit(torch::Tensor& X_, torch::Tensor& y_, const std::vector<std::string>& features_, const std::string& className_, map<std::string, std::vector<int>>& states_)
-      12              :     {
-      13           20 :         checkInput(X_, y_);
-      14           20 :         features = features_;
-      15           20 :         className = className_;
-      16           20 :         Xf = X_;
-      17           20 :         y = y_;
-      18              :         // Fills std::vectors Xv & yv with the data from tensors X_ (discretized) & y
-      19           20 :         states = fit_local_discretization(y);
-      20              :         // We have discretized the input data
-      21              :         // 1st we need to fit the model to build the normal TAN structure, TAN::fit initializes the base Bayesian network
-      22           20 :         TAN::fit(dataset, features, className, states);
-      23           20 :         states = localDiscretizationProposal(states, model);
-      24           20 :         return *this;
-      25              : 
-      26              :     }
-      27           16 :     torch::Tensor TANLd::predict(torch::Tensor& X)
-      28              :     {
-      29           16 :         auto Xt = prepareX(X);
-      30           32 :         return TAN::predict(Xt);
-      31           16 :     }
-      32            4 :     std::vector<std::string> TANLd::graph(const std::string& name) const
-      33              :     {
-      34            4 :         return TAN::graph(name);
-      35              :     }
-      36              : }
-        
-
-
- - - - -
Generated by: LCOV version 2.0-1
-
- - - diff --git a/html/bayesnet/classifiers/TANLd.cc.gcov.overview.html b/html/bayesnet/classifiers/TANLd.cc.gcov.overview.html deleted file mode 100644 index 3904a1e..0000000 --- a/html/bayesnet/classifiers/TANLd.cc.gcov.overview.html +++ /dev/null @@ -1,29 +0,0 @@ - - - - - - LCOV - BayesNet Coverage Report - bayesnet/classifiers/TANLd.cc - - - - - - - overview - overview - overview - overview - overview - overview - overview - overview - overview - - -
- Top

- Overview -
- - diff --git a/html/bayesnet/classifiers/TANLd.cc.gcov.png b/html/bayesnet/classifiers/TANLd.cc.gcov.png deleted file mode 100644 index 72788e6..0000000 Binary files a/html/bayesnet/classifiers/TANLd.cc.gcov.png and /dev/null differ diff --git a/html/bayesnet/classifiers/TANLd.h.func-c.html b/html/bayesnet/classifiers/TANLd.h.func-c.html deleted file mode 100644 index e388977..0000000 --- a/html/bayesnet/classifiers/TANLd.h.func-c.html +++ /dev/null @@ -1,90 +0,0 @@ - - - - - - - LCOV - BayesNet Coverage Report - bayesnet/classifiers/TANLd.h - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - bayesnet/classifiers - TANLd.h (source / functions)CoverageTotalHit
Test:BayesNet Coverage ReportLines:100.0 %11
Test Date:2024-05-06 17:54:04Functions:100.0 %11
Legend: Lines: - hit - not hit -
-
- -
- - - - - - - - - - - - - - - - -

Function Name Sort by function nameHit count Sort by function hit count
bayesnet::TANLd::~TANLd()20
-
-
- - - -
Generated by: LCOV version 2.0-1
-
- - - diff --git a/html/bayesnet/classifiers/TANLd.h.func.html b/html/bayesnet/classifiers/TANLd.h.func.html deleted file mode 100644 index cd88f69..0000000 --- a/html/bayesnet/classifiers/TANLd.h.func.html +++ /dev/null @@ -1,90 +0,0 @@ - - - - - - - LCOV - BayesNet Coverage Report - bayesnet/classifiers/TANLd.h - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - bayesnet/classifiers - TANLd.h (source / functions)CoverageTotalHit
Test:BayesNet Coverage ReportLines:100.0 %11
Test Date:2024-05-06 17:54:04Functions:100.0 %11
Legend: Lines: - hit - not hit -
-
- -
- - - - - - - - - - - - - - - - -

Function Name Sort by function nameHit count Sort by function hit count
bayesnet::TANLd::~TANLd()20
-
-
- - - -
Generated by: LCOV version 2.0-1
-
- - - diff --git a/html/bayesnet/classifiers/TANLd.h.gcov.frameset.html b/html/bayesnet/classifiers/TANLd.h.gcov.frameset.html deleted file mode 100644 index e27ea9f..0000000 --- a/html/bayesnet/classifiers/TANLd.h.gcov.frameset.html +++ /dev/null @@ -1,19 +0,0 @@ - - - - - - - LCOV - BayesNet Coverage Report - bayesnet/classifiers/TANLd.h - - - - - - - - <center>Frames not supported by your browser!<br></center> - - - - diff --git a/html/bayesnet/classifiers/TANLd.h.gcov.html b/html/bayesnet/classifiers/TANLd.h.gcov.html deleted file mode 100644 index 06ed158..0000000 --- a/html/bayesnet/classifiers/TANLd.h.gcov.html +++ /dev/null @@ -1,108 +0,0 @@ - - - - - - - LCOV - BayesNet Coverage Report - bayesnet/classifiers/TANLd.h - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - bayesnet/classifiers - TANLd.h (source / functions)CoverageTotalHit
Test:BayesNet Coverage ReportLines:100.0 %11
Test Date:2024-05-06 17:54:04Functions:100.0 %11
Legend: Lines: - hit - not hit -
-
- - - - - - - - -

-
            Line data    Source code
-
-       1              : // ***************************************************************
-       2              : // SPDX-FileCopyrightText: Copyright 2024 Ricardo Montañana Gómez
-       3              : // SPDX-FileType: SOURCE
-       4              : // SPDX-License-Identifier: MIT
-       5              : // ***************************************************************
-       6              : 
-       7              : #ifndef TANLD_H
-       8              : #define TANLD_H
-       9              : #include "TAN.h"
-      10              : #include "Proposal.h"
-      11              : 
-      12              : namespace bayesnet {
-      13              :     class TANLd : public TAN, public Proposal {
-      14              :     private:
-      15              :     public:
-      16              :         TANLd();
-      17           20 :         virtual ~TANLd() = default;
-      18              :         TANLd& fit(torch::Tensor& X, torch::Tensor& y, const std::vector<std::string>& features, const std::string& className, map<std::string, std::vector<int>>& states) override;
-      19              :         std::vector<std::string> graph(const std::string& name = "TAN") const override;
-      20              :         torch::Tensor predict(torch::Tensor& X) override;
-      21              :         static inline std::string version() { return "0.0.1"; };
-      22              :     };
-      23              : }
-      24              : #endif // !TANLD_H
-        
-
-
- - - - -
Generated by: LCOV version 2.0-1
-
- - - diff --git a/html/bayesnet/classifiers/TANLd.h.gcov.overview.html b/html/bayesnet/classifiers/TANLd.h.gcov.overview.html deleted file mode 100644 index dfc5d32..0000000 --- a/html/bayesnet/classifiers/TANLd.h.gcov.overview.html +++ /dev/null @@ -1,26 +0,0 @@ - - - - - - LCOV - BayesNet Coverage Report - bayesnet/classifiers/TANLd.h - - - - - - - overview - overview - overview - overview - overview - overview - - -
- Top

- Overview -
- - diff --git a/html/bayesnet/classifiers/TANLd.h.gcov.png b/html/bayesnet/classifiers/TANLd.h.gcov.png deleted file mode 100644 index dd5b3fe..0000000 Binary files a/html/bayesnet/classifiers/TANLd.h.gcov.png and /dev/null differ diff --git a/html/bayesnet/classifiers/index-detail-sort-f.html b/html/bayesnet/classifiers/index-detail-sort-f.html deleted file mode 100644 index 3bd48a5..0000000 --- a/html/bayesnet/classifiers/index-detail-sort-f.html +++ /dev/null @@ -1,306 +0,0 @@ - - - - - - - LCOV - BayesNet Coverage Report - bayesnet/classifiers - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - bayesnet/classifiersCoverageTotalHit
Test:BayesNet Coverage ReportLines:99.0 %384380
Test Date:2024-05-06 17:54:04Functions:100.0 %7272
Legend: Rating: - low: < 75 % - medium: >= 75 % - high: >= 90 % -
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Filename Sort by file nameLine Coverage ( show details ) Sort by line coverageFunction Coverage Sort by function coverage
Rate Total Hit Rate Total Hit
KDB.h -
100.0%
-
100.0 %11100.0 %11
KDBLd.h -
100.0%
-
100.0 %11100.0 %11
SPODE.h -
100.0%
-
100.0 %11100.0 %11
SPODELd.h -
100.0%
-
100.0 %11100.0 %11
SPnDE.h -
100.0%
-
100.0 %11100.0 %11
TAN.h -
100.0%
-
100.0 %11100.0 %11
TANLd.h -
100.0%
-
100.0 %11100.0 %11
SPODE.cc -
100.0%
-
100.0 %1010100.0 %33
SPnDE.cc -
100.0%
-
100.0 %1414100.0 %33
Classifier.h -
100.0%
-
100.0 %44100.0 %44
KDBLd.cc -
100.0%
-
100.0 %1717100.0 %44
TAN.cc -
100.0%
-
100.0 %2323100.0 %44
TANLd.cc -
100.0%
-
100.0 %1717100.0 %44
KDB.cc -
96.3%96.3%
-
96.3 %5452100.0 %55
SPODELd.cc -
100.0%
-
100.0 %2626100.0 %66
Proposal.cc -
97.7%97.7%
-
97.7 %8684100.0 %88
Classifier.cc -
100.0%
-
100.0 %126126100.0 %2424
-
-
- - - - -
Generated by: LCOV version 2.0-1
-
- - - diff --git a/html/bayesnet/classifiers/index-detail-sort-l.html b/html/bayesnet/classifiers/index-detail-sort-l.html deleted file mode 100644 index e3933a6..0000000 --- a/html/bayesnet/classifiers/index-detail-sort-l.html +++ /dev/null @@ -1,306 +0,0 @@ - - - - - - - LCOV - BayesNet Coverage Report - bayesnet/classifiers - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - bayesnet/classifiersCoverageTotalHit
Test:BayesNet Coverage ReportLines:99.0 %384380
Test Date:2024-05-06 17:54:04Functions:100.0 %7272
Legend: Rating: - low: < 75 % - medium: >= 75 % - high: >= 90 % -
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Filename Sort by file nameLine Coverage ( show details ) Sort by line coverageFunction Coverage Sort by function coverage
Rate Total Hit Rate Total Hit
KDB.cc -
96.3%96.3%
-
96.3 %5452100.0 %55
Proposal.cc -
97.7%97.7%
-
97.7 %8684100.0 %88
KDB.h -
100.0%
-
100.0 %11100.0 %11
KDBLd.h -
100.0%
-
100.0 %11100.0 %11
SPODE.h -
100.0%
-
100.0 %11100.0 %11
SPODELd.h -
100.0%
-
100.0 %11100.0 %11
SPnDE.h -
100.0%
-
100.0 %11100.0 %11
TAN.h -
100.0%
-
100.0 %11100.0 %11
TANLd.h -
100.0%
-
100.0 %11100.0 %11
Classifier.h -
100.0%
-
100.0 %44100.0 %44
SPODE.cc -
100.0%
-
100.0 %1010100.0 %33
SPnDE.cc -
100.0%
-
100.0 %1414100.0 %33
KDBLd.cc -
100.0%
-
100.0 %1717100.0 %44
TANLd.cc -
100.0%
-
100.0 %1717100.0 %44
TAN.cc -
100.0%
-
100.0 %2323100.0 %44
SPODELd.cc -
100.0%
-
100.0 %2626100.0 %66
Classifier.cc -
100.0%
-
100.0 %126126100.0 %2424
-
-
- - - - -
Generated by: LCOV version 2.0-1
-
- - - diff --git a/html/bayesnet/classifiers/index-detail.html b/html/bayesnet/classifiers/index-detail.html deleted file mode 100644 index e516b23..0000000 --- a/html/bayesnet/classifiers/index-detail.html +++ /dev/null @@ -1,306 +0,0 @@ - - - - - - - LCOV - BayesNet Coverage Report - bayesnet/classifiers - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - bayesnet/classifiersCoverageTotalHit
Test:BayesNet Coverage ReportLines:99.0 %384380
Test Date:2024-05-06 17:54:04Functions:100.0 %7272
Legend: Rating: - low: < 75 % - medium: >= 75 % - high: >= 90 % -
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Filename Sort by file nameLine Coverage ( show details ) Sort by line coverageFunction Coverage Sort by function coverage
Rate Total Hit Rate Total Hit
Classifier.cc -
100.0%
-
100.0 %126126100.0 %2424
Classifier.h -
100.0%
-
100.0 %44100.0 %44
KDB.cc -
96.3%96.3%
-
96.3 %5452100.0 %55
KDB.h -
100.0%
-
100.0 %11100.0 %11
KDBLd.cc -
100.0%
-
100.0 %1717100.0 %44
KDBLd.h -
100.0%
-
100.0 %11100.0 %11
Proposal.cc -
97.7%97.7%
-
97.7 %8684100.0 %88
SPODE.cc -
100.0%
-
100.0 %1010100.0 %33
SPODE.h -
100.0%
-
100.0 %11100.0 %11
SPODELd.cc -
100.0%
-
100.0 %2626100.0 %66
SPODELd.h -
100.0%
-
100.0 %11100.0 %11
SPnDE.cc -
100.0%
-
100.0 %1414100.0 %33
SPnDE.h -
100.0%
-
100.0 %11100.0 %11
TAN.cc -
100.0%
-
100.0 %2323100.0 %44
TAN.h -
100.0%
-
100.0 %11100.0 %11
TANLd.cc -
100.0%
-
100.0 %1717100.0 %44
TANLd.h -
100.0%
-
100.0 %11100.0 %11
-
-
- - - - -
Generated by: LCOV version 2.0-1
-
- - - diff --git a/html/bayesnet/classifiers/index-sort-f.html b/html/bayesnet/classifiers/index-sort-f.html deleted file mode 100644 index 3bd48a5..0000000 --- a/html/bayesnet/classifiers/index-sort-f.html +++ /dev/null @@ -1,306 +0,0 @@ - - - - - - - LCOV - BayesNet Coverage Report - bayesnet/classifiers - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - bayesnet/classifiersCoverageTotalHit
Test:BayesNet Coverage ReportLines:99.0 %384380
Test Date:2024-05-06 17:54:04Functions:100.0 %7272
Legend: Rating: - low: < 75 % - medium: >= 75 % - high: >= 90 % -
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Filename Sort by file nameLine Coverage ( show details ) Sort by line coverageFunction Coverage Sort by function coverage
Rate Total Hit Rate Total Hit
KDB.h -
100.0%
-
100.0 %11100.0 %11
KDBLd.h -
100.0%
-
100.0 %11100.0 %11
SPODE.h -
100.0%
-
100.0 %11100.0 %11
SPODELd.h -
100.0%
-
100.0 %11100.0 %11
SPnDE.h -
100.0%
-
100.0 %11100.0 %11
TAN.h -
100.0%
-
100.0 %11100.0 %11
TANLd.h -
100.0%
-
100.0 %11100.0 %11
SPODE.cc -
100.0%
-
100.0 %1010100.0 %33
SPnDE.cc -
100.0%
-
100.0 %1414100.0 %33
Classifier.h -
100.0%
-
100.0 %44100.0 %44
KDBLd.cc -
100.0%
-
100.0 %1717100.0 %44
TAN.cc -
100.0%
-
100.0 %2323100.0 %44
TANLd.cc -
100.0%
-
100.0 %1717100.0 %44
KDB.cc -
96.3%96.3%
-
96.3 %5452100.0 %55
SPODELd.cc -
100.0%
-
100.0 %2626100.0 %66
Proposal.cc -
97.7%97.7%
-
97.7 %8684100.0 %88
Classifier.cc -
100.0%
-
100.0 %126126100.0 %2424
-
-
- - - - -
Generated by: LCOV version 2.0-1
-
- - - diff --git a/html/bayesnet/classifiers/index-sort-l.html b/html/bayesnet/classifiers/index-sort-l.html deleted file mode 100644 index e3933a6..0000000 --- a/html/bayesnet/classifiers/index-sort-l.html +++ /dev/null @@ -1,306 +0,0 @@ - - - - - - - LCOV - BayesNet Coverage Report - bayesnet/classifiers - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - bayesnet/classifiersCoverageTotalHit
Test:BayesNet Coverage ReportLines:99.0 %384380
Test Date:2024-05-06 17:54:04Functions:100.0 %7272
Legend: Rating: - low: < 75 % - medium: >= 75 % - high: >= 90 % -
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Filename Sort by file nameLine Coverage ( show details ) Sort by line coverageFunction Coverage Sort by function coverage
Rate Total Hit Rate Total Hit
KDB.cc -
96.3%96.3%
-
96.3 %5452100.0 %55
Proposal.cc -
97.7%97.7%
-
97.7 %8684100.0 %88
KDB.h -
100.0%
-
100.0 %11100.0 %11
KDBLd.h -
100.0%
-
100.0 %11100.0 %11
SPODE.h -
100.0%
-
100.0 %11100.0 %11
SPODELd.h -
100.0%
-
100.0 %11100.0 %11
SPnDE.h -
100.0%
-
100.0 %11100.0 %11
TAN.h -
100.0%
-
100.0 %11100.0 %11
TANLd.h -
100.0%
-
100.0 %11100.0 %11
Classifier.h -
100.0%
-
100.0 %44100.0 %44
SPODE.cc -
100.0%
-
100.0 %1010100.0 %33
SPnDE.cc -
100.0%
-
100.0 %1414100.0 %33
KDBLd.cc -
100.0%
-
100.0 %1717100.0 %44
TANLd.cc -
100.0%
-
100.0 %1717100.0 %44
TAN.cc -
100.0%
-
100.0 %2323100.0 %44
SPODELd.cc -
100.0%
-
100.0 %2626100.0 %66
Classifier.cc -
100.0%
-
100.0 %126126100.0 %2424
-
-
- - - - -
Generated by: LCOV version 2.0-1
-
- - - diff --git a/html/bayesnet/classifiers/index.html b/html/bayesnet/classifiers/index.html deleted file mode 100644 index e516b23..0000000 --- a/html/bayesnet/classifiers/index.html +++ /dev/null @@ -1,306 +0,0 @@ - - - - - - - LCOV - BayesNet Coverage Report - bayesnet/classifiers - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - bayesnet/classifiersCoverageTotalHit
Test:BayesNet Coverage ReportLines:99.0 %384380
Test Date:2024-05-06 17:54:04Functions:100.0 %7272
Legend: Rating: - low: < 75 % - medium: >= 75 % - high: >= 90 % -
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Filename Sort by file nameLine Coverage ( show details ) Sort by line coverageFunction Coverage Sort by function coverage
Rate Total Hit Rate Total Hit
Classifier.cc -
100.0%
-
100.0 %126126100.0 %2424
Classifier.h -
100.0%
-
100.0 %44100.0 %44
KDB.cc -
96.3%96.3%
-
96.3 %5452100.0 %55
KDB.h -
100.0%
-
100.0 %11100.0 %11
KDBLd.cc -
100.0%
-
100.0 %1717100.0 %44
KDBLd.h -
100.0%
-
100.0 %11100.0 %11
Proposal.cc -
97.7%97.7%
-
97.7 %8684100.0 %88
SPODE.cc -
100.0%
-
100.0 %1010100.0 %33
SPODE.h -
100.0%
-
100.0 %11100.0 %11
SPODELd.cc -
100.0%
-
100.0 %2626100.0 %66
SPODELd.h -
100.0%
-
100.0 %11100.0 %11
SPnDE.cc -
100.0%
-
100.0 %1414100.0 %33
SPnDE.h -
100.0%
-
100.0 %11100.0 %11
TAN.cc -
100.0%
-
100.0 %2323100.0 %44
TAN.h -
100.0%
-
100.0 %11100.0 %11
TANLd.cc -
100.0%
-
100.0 %1717100.0 %44
TANLd.h -
100.0%
-
100.0 %11100.0 %11
-
-
- - - - -
Generated by: LCOV version 2.0-1
-
- - - diff --git a/html/bayesnet/ensembles/A2DE.cc.func-c.html b/html/bayesnet/ensembles/A2DE.cc.func-c.html deleted file mode 100644 index 306cddd..0000000 --- a/html/bayesnet/ensembles/A2DE.cc.func-c.html +++ /dev/null @@ -1,111 +0,0 @@ - - - - - - - LCOV - BayesNet Coverage Report - bayesnet/ensembles/A2DE.cc - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - bayesnet/ensembles - A2DE.cc (source / functions)CoverageTotalHit
Test:BayesNet Coverage ReportLines:100.0 %2323
Test Date:2024-05-06 17:54:04Functions:100.0 %44
Legend: Lines: - hit - not hit -
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Function Name Sort by function nameHit count Sort by function hit count
bayesnet::A2DE::graph(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) const4
bayesnet::A2DE::setHyperparameters(nlohmann::json_abi_v3_11_3::basic_json<std::map, std::vector, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, bool, long, unsigned long, double, std::allocator, nlohmann::json_abi_v3_11_3::adl_serializer, std::vector<unsigned char, std::allocator<unsigned char> >, void> const&)8
bayesnet::A2DE::A2DE(bool)12
bayesnet::A2DE::buildModel(at::Tensor const&)16
-
-
- - - -
Generated by: LCOV version 2.0-1
-
- - - diff --git a/html/bayesnet/ensembles/A2DE.cc.func.html b/html/bayesnet/ensembles/A2DE.cc.func.html deleted file mode 100644 index 50e0946..0000000 --- a/html/bayesnet/ensembles/A2DE.cc.func.html +++ /dev/null @@ -1,111 +0,0 @@ - - - - - - - LCOV - BayesNet Coverage Report - bayesnet/ensembles/A2DE.cc - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - bayesnet/ensembles - A2DE.cc (source / functions)CoverageTotalHit
Test:BayesNet Coverage ReportLines:100.0 %2323
Test Date:2024-05-06 17:54:04Functions:100.0 %44
Legend: Lines: - hit - not hit -
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Function Name Sort by function nameHit count Sort by function hit count
bayesnet::A2DE::A2DE(bool)12
bayesnet::A2DE::buildModel(at::Tensor const&)16
bayesnet::A2DE::graph(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) const4
bayesnet::A2DE::setHyperparameters(nlohmann::json_abi_v3_11_3::basic_json<std::map, std::vector, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, bool, long, unsigned long, double, std::allocator, nlohmann::json_abi_v3_11_3::adl_serializer, std::vector<unsigned char, std::allocator<unsigned char> >, void> const&)8
-
-
- - - -
Generated by: LCOV version 2.0-1
-
- - - diff --git a/html/bayesnet/ensembles/A2DE.cc.gcov.frameset.html b/html/bayesnet/ensembles/A2DE.cc.gcov.frameset.html deleted file mode 100644 index a5f7f37..0000000 --- a/html/bayesnet/ensembles/A2DE.cc.gcov.frameset.html +++ /dev/null @@ -1,19 +0,0 @@ - - - - - - - LCOV - BayesNet Coverage Report - bayesnet/ensembles/A2DE.cc - - - - - - - - <center>Frames not supported by your browser!<br></center> - - - - diff --git a/html/bayesnet/ensembles/A2DE.cc.gcov.html b/html/bayesnet/ensembles/A2DE.cc.gcov.html deleted file mode 100644 index 197b670..0000000 --- a/html/bayesnet/ensembles/A2DE.cc.gcov.html +++ /dev/null @@ -1,124 +0,0 @@ - - - - - - - LCOV - BayesNet Coverage Report - bayesnet/ensembles/A2DE.cc - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - bayesnet/ensembles - A2DE.cc (source / functions)CoverageTotalHit
Test:BayesNet Coverage ReportLines:100.0 %2323
Test Date:2024-05-06 17:54:04Functions:100.0 %44
Legend: Lines: - hit - not hit -
-
- - - - - - - - -

-
            Line data    Source code
-
-       1              : // ***************************************************************
-       2              : // SPDX-FileCopyrightText: Copyright 2024 Ricardo Montañana Gómez
-       3              : // SPDX-FileType: SOURCE
-       4              : // SPDX-License-Identifier: MIT
-       5              : // ***************************************************************
-       6              : 
-       7              : #include "A2DE.h"
-       8              : 
-       9              : namespace bayesnet {
-      10           12 :     A2DE::A2DE(bool predict_voting) : Ensemble(predict_voting)
-      11              :     {
-      12           24 :         validHyperparameters = { "predict_voting" };
-      13           36 :     }
-      14            8 :     void A2DE::setHyperparameters(const nlohmann::json& hyperparameters_)
-      15              :     {
-      16            8 :         auto hyperparameters = hyperparameters_;
-      17            8 :         if (hyperparameters.contains("predict_voting")) {
-      18            8 :             predict_voting = hyperparameters["predict_voting"];
-      19            8 :             hyperparameters.erase("predict_voting");
-      20              :         }
-      21            8 :         Classifier::setHyperparameters(hyperparameters);
-      22            8 :     }
-      23           16 :     void A2DE::buildModel(const torch::Tensor& weights)
-      24              :     {
-      25           16 :         models.clear();
-      26           16 :         significanceModels.clear();
-      27          124 :         for (int i = 0; i < features.size() - 1; ++i) {
-      28          564 :             for (int j = i + 1; j < features.size(); ++j) {
-      29          456 :                 auto model = std::make_unique<SPnDE>(std::vector<int>({ i, j }));
-      30          456 :                 models.push_back(std::move(model));
-      31          456 :             }
-      32              :         }
-      33           16 :         n_models = static_cast<unsigned>(models.size());
-      34           16 :         significanceModels = std::vector<double>(n_models, 1.0);
-      35           16 :     }
-      36            4 :     std::vector<std::string> A2DE::graph(const std::string& title) const
-      37              :     {
-      38            4 :         return Ensemble::graph(title);
-      39              :     }
-      40              : }
-        
-
-
- - - - -
Generated by: LCOV version 2.0-1
-
- - - diff --git a/html/bayesnet/ensembles/A2DE.cc.gcov.overview.html b/html/bayesnet/ensembles/A2DE.cc.gcov.overview.html deleted file mode 100644 index 0606f56..0000000 --- a/html/bayesnet/ensembles/A2DE.cc.gcov.overview.html +++ /dev/null @@ -1,30 +0,0 @@ - - - - - - LCOV - BayesNet Coverage Report - bayesnet/ensembles/A2DE.cc - - - - - - - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - - -
- Top

- Overview -
- - diff --git a/html/bayesnet/ensembles/A2DE.cc.gcov.png b/html/bayesnet/ensembles/A2DE.cc.gcov.png deleted file mode 100644 index e1917a4..0000000 Binary files a/html/bayesnet/ensembles/A2DE.cc.gcov.png and /dev/null differ diff --git a/html/bayesnet/ensembles/A2DE.h.func-c.html b/html/bayesnet/ensembles/A2DE.h.func-c.html deleted file mode 100644 index eeddf23..0000000 --- a/html/bayesnet/ensembles/A2DE.h.func-c.html +++ /dev/null @@ -1,90 +0,0 @@ - - - - - - - LCOV - BayesNet Coverage Report - bayesnet/ensembles/A2DE.h - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - bayesnet/ensembles - A2DE.h (source / functions)CoverageTotalHit
Test:BayesNet Coverage ReportLines:100.0 %11
Test Date:2024-05-06 17:54:04Functions:100.0 %11
Legend: Lines: - hit - not hit -
-
- -
- - - - - - - - - - - - - - - - -

Function Name Sort by function nameHit count Sort by function hit count
bayesnet::A2DE::~A2DE()12
-
-
- - - -
Generated by: LCOV version 2.0-1
-
- - - diff --git a/html/bayesnet/ensembles/A2DE.h.func.html b/html/bayesnet/ensembles/A2DE.h.func.html deleted file mode 100644 index 471300f..0000000 --- a/html/bayesnet/ensembles/A2DE.h.func.html +++ /dev/null @@ -1,90 +0,0 @@ - - - - - - - LCOV - BayesNet Coverage Report - bayesnet/ensembles/A2DE.h - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - bayesnet/ensembles - A2DE.h (source / functions)CoverageTotalHit
Test:BayesNet Coverage ReportLines:100.0 %11
Test Date:2024-05-06 17:54:04Functions:100.0 %11
Legend: Lines: - hit - not hit -
-
- -
- - - - - - - - - - - - - - - - -

Function Name Sort by function nameHit count Sort by function hit count
bayesnet::A2DE::~A2DE()12
-
-
- - - -
Generated by: LCOV version 2.0-1
-
- - - diff --git a/html/bayesnet/ensembles/A2DE.h.gcov.frameset.html b/html/bayesnet/ensembles/A2DE.h.gcov.frameset.html deleted file mode 100644 index 7054d6e..0000000 --- a/html/bayesnet/ensembles/A2DE.h.gcov.frameset.html +++ /dev/null @@ -1,19 +0,0 @@ - - - - - - - LCOV - BayesNet Coverage Report - bayesnet/ensembles/A2DE.h - - - - - - - - <center>Frames not supported by your browser!<br></center> - - - - diff --git a/html/bayesnet/ensembles/A2DE.h.gcov.html b/html/bayesnet/ensembles/A2DE.h.gcov.html deleted file mode 100644 index f87081b..0000000 --- a/html/bayesnet/ensembles/A2DE.h.gcov.html +++ /dev/null @@ -1,106 +0,0 @@ - - - - - - - LCOV - BayesNet Coverage Report - bayesnet/ensembles/A2DE.h - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - bayesnet/ensembles - A2DE.h (source / functions)CoverageTotalHit
Test:BayesNet Coverage ReportLines:100.0 %11
Test Date:2024-05-06 17:54:04Functions:100.0 %11
Legend: Lines: - hit - not hit -
-
- - - - - - - - -

-
            Line data    Source code
-
-       1              : // ***************************************************************
-       2              : // SPDX-FileCopyrightText: Copyright 2024 Ricardo Montañana Gómez
-       3              : // SPDX-FileType: SOURCE
-       4              : // SPDX-License-Identifier: MIT
-       5              : // ***************************************************************
-       6              : 
-       7              : #ifndef A2DE_H
-       8              : #define A2DE_H
-       9              : #include "bayesnet/classifiers/SPnDE.h"
-      10              : #include "Ensemble.h"
-      11              : namespace bayesnet {
-      12              :     class A2DE : public Ensemble {
-      13              :     public:
-      14              :         A2DE(bool predict_voting = false);
-      15           12 :         virtual ~A2DE() {};
-      16              :         void setHyperparameters(const nlohmann::json& hyperparameters) override;
-      17              :         std::vector<std::string> graph(const std::string& title = "A2DE") const override;
-      18              :     protected:
-      19              :         void buildModel(const torch::Tensor& weights) override;
-      20              :     };
-      21              : }
-      22              : #endif
-        
-
-
- - - - -
Generated by: LCOV version 2.0-1
-
- - - diff --git a/html/bayesnet/ensembles/A2DE.h.gcov.overview.html b/html/bayesnet/ensembles/A2DE.h.gcov.overview.html deleted file mode 100644 index 4ebfd35..0000000 --- a/html/bayesnet/ensembles/A2DE.h.gcov.overview.html +++ /dev/null @@ -1,26 +0,0 @@ - - - - - - LCOV - BayesNet Coverage Report - bayesnet/ensembles/A2DE.h - - - - - - - overview - overview - overview - overview - overview - overview - - -
- Top

- Overview -
- - diff --git a/html/bayesnet/ensembles/A2DE.h.gcov.png b/html/bayesnet/ensembles/A2DE.h.gcov.png deleted file mode 100644 index 335f3bc..0000000 Binary files a/html/bayesnet/ensembles/A2DE.h.gcov.png and /dev/null differ diff --git a/html/bayesnet/ensembles/AODE.cc.func-c.html b/html/bayesnet/ensembles/AODE.cc.func-c.html deleted file mode 100644 index ed8871d..0000000 --- a/html/bayesnet/ensembles/AODE.cc.func-c.html +++ /dev/null @@ -1,111 +0,0 @@ - - - - - - - LCOV - BayesNet Coverage Report - bayesnet/ensembles/AODE.cc - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - bayesnet/ensembles - AODE.cc (source / functions)CoverageTotalHit
Test:BayesNet Coverage ReportLines:100.0 %2020
Test Date:2024-05-06 17:54:04Functions:100.0 %44
Legend: Lines: - hit - not hit -
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Function Name Sort by function nameHit count Sort by function hit count
bayesnet::AODE::graph(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) const4
bayesnet::AODE::setHyperparameters(nlohmann::json_abi_v3_11_3::basic_json<std::map, std::vector, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, bool, long, unsigned long, double, std::allocator, nlohmann::json_abi_v3_11_3::adl_serializer, std::vector<unsigned char, std::allocator<unsigned char> >, void> const&)4
bayesnet::AODE::buildModel(at::Tensor const&)24
bayesnet::AODE::AODE(bool)76
-
-
- - - -
Generated by: LCOV version 2.0-1
-
- - - diff --git a/html/bayesnet/ensembles/AODE.cc.func.html b/html/bayesnet/ensembles/AODE.cc.func.html deleted file mode 100644 index 073fd53..0000000 --- a/html/bayesnet/ensembles/AODE.cc.func.html +++ /dev/null @@ -1,111 +0,0 @@ - - - - - - - LCOV - BayesNet Coverage Report - bayesnet/ensembles/AODE.cc - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - bayesnet/ensembles - AODE.cc (source / functions)CoverageTotalHit
Test:BayesNet Coverage ReportLines:100.0 %2020
Test Date:2024-05-06 17:54:04Functions:100.0 %44
Legend: Lines: - hit - not hit -
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Function Name Sort by function nameHit count Sort by function hit count
bayesnet::AODE::AODE(bool)76
bayesnet::AODE::buildModel(at::Tensor const&)24
bayesnet::AODE::graph(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) const4
bayesnet::AODE::setHyperparameters(nlohmann::json_abi_v3_11_3::basic_json<std::map, std::vector, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, bool, long, unsigned long, double, std::allocator, nlohmann::json_abi_v3_11_3::adl_serializer, std::vector<unsigned char, std::allocator<unsigned char> >, void> const&)4
-
-
- - - -
Generated by: LCOV version 2.0-1
-
- - - diff --git a/html/bayesnet/ensembles/AODE.cc.gcov.frameset.html b/html/bayesnet/ensembles/AODE.cc.gcov.frameset.html deleted file mode 100644 index 3c1d4a3..0000000 --- a/html/bayesnet/ensembles/AODE.cc.gcov.frameset.html +++ /dev/null @@ -1,19 +0,0 @@ - - - - - - - LCOV - BayesNet Coverage Report - bayesnet/ensembles/AODE.cc - - - - - - - - <center>Frames not supported by your browser!<br></center> - - - - diff --git a/html/bayesnet/ensembles/AODE.cc.gcov.html b/html/bayesnet/ensembles/AODE.cc.gcov.html deleted file mode 100644 index a07c4e0..0000000 --- a/html/bayesnet/ensembles/AODE.cc.gcov.html +++ /dev/null @@ -1,122 +0,0 @@ - - - - - - - LCOV - BayesNet Coverage Report - bayesnet/ensembles/AODE.cc - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - bayesnet/ensembles - AODE.cc (source / functions)CoverageTotalHit
Test:BayesNet Coverage ReportLines:100.0 %2020
Test Date:2024-05-06 17:54:04Functions:100.0 %44
Legend: Lines: - hit - not hit -
-
- - - - - - - - -

-
            Line data    Source code
-
-       1              : // ***************************************************************
-       2              : // SPDX-FileCopyrightText: Copyright 2024 Ricardo Montañana Gómez
-       3              : // SPDX-FileType: SOURCE
-       4              : // SPDX-License-Identifier: MIT
-       5              : // ***************************************************************
-       6              : 
-       7              : #include "AODE.h"
-       8              : 
-       9              : namespace bayesnet {
-      10           76 :     AODE::AODE(bool predict_voting) : Ensemble(predict_voting)
-      11              :     {
-      12          152 :         validHyperparameters = { "predict_voting" };
-      13              : 
-      14          228 :     }
-      15            4 :     void AODE::setHyperparameters(const nlohmann::json& hyperparameters_)
-      16              :     {
-      17            4 :         auto hyperparameters = hyperparameters_;
-      18            4 :         if (hyperparameters.contains("predict_voting")) {
-      19            4 :             predict_voting = hyperparameters["predict_voting"];
-      20            4 :             hyperparameters.erase("predict_voting");
-      21              :         }
-      22            4 :         Classifier::setHyperparameters(hyperparameters);
-      23            4 :     }
-      24           24 :     void AODE::buildModel(const torch::Tensor& weights)
-      25              :     {
-      26           24 :         models.clear();
-      27           24 :         significanceModels.clear();
-      28          188 :         for (int i = 0; i < features.size(); ++i) {
-      29          164 :             models.push_back(std::make_unique<SPODE>(i));
-      30              :         }
-      31           24 :         n_models = models.size();
-      32           24 :         significanceModels = std::vector<double>(n_models, 1.0);
-      33           24 :     }
-      34            4 :     std::vector<std::string> AODE::graph(const std::string& title) const
-      35              :     {
-      36            4 :         return Ensemble::graph(title);
-      37              :     }
-      38              : }
-        
-
-
- - - - -
Generated by: LCOV version 2.0-1
-
- - - diff --git a/html/bayesnet/ensembles/AODE.cc.gcov.overview.html b/html/bayesnet/ensembles/AODE.cc.gcov.overview.html deleted file mode 100644 index d7e43cc..0000000 --- a/html/bayesnet/ensembles/AODE.cc.gcov.overview.html +++ /dev/null @@ -1,30 +0,0 @@ - - - - - - LCOV - BayesNet Coverage Report - bayesnet/ensembles/AODE.cc - - - - - - - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - - -
- Top

- Overview -
- - diff --git a/html/bayesnet/ensembles/AODE.cc.gcov.png b/html/bayesnet/ensembles/AODE.cc.gcov.png deleted file mode 100644 index 682ccab..0000000 Binary files a/html/bayesnet/ensembles/AODE.cc.gcov.png and /dev/null differ diff --git a/html/bayesnet/ensembles/AODE.h.func-c.html b/html/bayesnet/ensembles/AODE.h.func-c.html deleted file mode 100644 index 4781506..0000000 --- a/html/bayesnet/ensembles/AODE.h.func-c.html +++ /dev/null @@ -1,90 +0,0 @@ - - - - - - - LCOV - BayesNet Coverage Report - bayesnet/ensembles/AODE.h - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - bayesnet/ensembles - AODE.h (source / functions)CoverageTotalHit
Test:BayesNet Coverage ReportLines:100.0 %11
Test Date:2024-05-06 17:54:04Functions:100.0 %11
Legend: Lines: - hit - not hit -
-
- -
- - - - - - - - - - - - - - - - -

Function Name Sort by function nameHit count Sort by function hit count
bayesnet::AODE::~AODE()28
-
-
- - - -
Generated by: LCOV version 2.0-1
-
- - - diff --git a/html/bayesnet/ensembles/AODE.h.func.html b/html/bayesnet/ensembles/AODE.h.func.html deleted file mode 100644 index f9dcc65..0000000 --- a/html/bayesnet/ensembles/AODE.h.func.html +++ /dev/null @@ -1,90 +0,0 @@ - - - - - - - LCOV - BayesNet Coverage Report - bayesnet/ensembles/AODE.h - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - bayesnet/ensembles - AODE.h (source / functions)CoverageTotalHit
Test:BayesNet Coverage ReportLines:100.0 %11
Test Date:2024-05-06 17:54:04Functions:100.0 %11
Legend: Lines: - hit - not hit -
-
- -
- - - - - - - - - - - - - - - - -

Function Name Sort by function nameHit count Sort by function hit count
bayesnet::AODE::~AODE()28
-
-
- - - -
Generated by: LCOV version 2.0-1
-
- - - diff --git a/html/bayesnet/ensembles/AODE.h.gcov.frameset.html b/html/bayesnet/ensembles/AODE.h.gcov.frameset.html deleted file mode 100644 index b3184e8..0000000 --- a/html/bayesnet/ensembles/AODE.h.gcov.frameset.html +++ /dev/null @@ -1,19 +0,0 @@ - - - - - - - LCOV - BayesNet Coverage Report - bayesnet/ensembles/AODE.h - - - - - - - - <center>Frames not supported by your browser!<br></center> - - - - diff --git a/html/bayesnet/ensembles/AODE.h.gcov.html b/html/bayesnet/ensembles/AODE.h.gcov.html deleted file mode 100644 index 505e06d..0000000 --- a/html/bayesnet/ensembles/AODE.h.gcov.html +++ /dev/null @@ -1,106 +0,0 @@ - - - - - - - LCOV - BayesNet Coverage Report - bayesnet/ensembles/AODE.h - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - bayesnet/ensembles - AODE.h (source / functions)CoverageTotalHit
Test:BayesNet Coverage ReportLines:100.0 %11
Test Date:2024-05-06 17:54:04Functions:100.0 %11
Legend: Lines: - hit - not hit -
-
- - - - - - - - -

-
            Line data    Source code
-
-       1              : // ***************************************************************
-       2              : // SPDX-FileCopyrightText: Copyright 2024 Ricardo Montañana Gómez
-       3              : // SPDX-FileType: SOURCE
-       4              : // SPDX-License-Identifier: MIT
-       5              : // ***************************************************************
-       6              : 
-       7              : #ifndef AODE_H
-       8              : #define AODE_H
-       9              : #include "bayesnet/classifiers/SPODE.h"
-      10              : #include "Ensemble.h"
-      11              : namespace bayesnet {
-      12              :     class AODE : public Ensemble {
-      13              :     public:
-      14              :         AODE(bool predict_voting = false);
-      15           28 :         virtual ~AODE() {};
-      16              :         void setHyperparameters(const nlohmann::json& hyperparameters) override;
-      17              :         std::vector<std::string> graph(const std::string& title = "AODE") const override;
-      18              :     protected:
-      19              :         void buildModel(const torch::Tensor& weights) override;
-      20              :     };
-      21              : }
-      22              : #endif
-        
-
-
- - - - -
Generated by: LCOV version 2.0-1
-
- - - diff --git a/html/bayesnet/ensembles/AODE.h.gcov.overview.html b/html/bayesnet/ensembles/AODE.h.gcov.overview.html deleted file mode 100644 index 44ca0dd..0000000 --- a/html/bayesnet/ensembles/AODE.h.gcov.overview.html +++ /dev/null @@ -1,26 +0,0 @@ - - - - - - LCOV - BayesNet Coverage Report - bayesnet/ensembles/AODE.h - - - - - - - overview - overview - overview - overview - overview - overview - - -
- Top

- Overview -
- - diff --git a/html/bayesnet/ensembles/AODE.h.gcov.png b/html/bayesnet/ensembles/AODE.h.gcov.png deleted file mode 100644 index 335f3bc..0000000 Binary files a/html/bayesnet/ensembles/AODE.h.gcov.png and /dev/null differ diff --git a/html/bayesnet/ensembles/AODELd.cc.func-c.html b/html/bayesnet/ensembles/AODELd.cc.func-c.html deleted file mode 100644 index 9649bd0..0000000 --- a/html/bayesnet/ensembles/AODELd.cc.func-c.html +++ /dev/null @@ -1,118 +0,0 @@ - - - - - - - LCOV - BayesNet Coverage Report - bayesnet/ensembles/AODELd.cc - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - bayesnet/ensembles - AODELd.cc (source / functions)CoverageTotalHit
Test:BayesNet Coverage ReportLines:100.0 %2424
Test Date:2024-05-06 17:54:04Functions:100.0 %55
Legend: Lines: - hit - not hit -
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Function Name Sort by function nameHit count Sort by function hit count
bayesnet::AODELd::graph(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) const4
bayesnet::AODELd::buildModel(at::Tensor const&)20
bayesnet::AODELd::fit(at::Tensor&, at::Tensor&, std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::map<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::vector<int, std::allocator<int> >, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, std::vector<int, std::allocator<int> > > > >&)20
bayesnet::AODELd::trainModel(at::Tensor const&)20
bayesnet::AODELd::AODELd(bool)68
-
-
- - - -
Generated by: LCOV version 2.0-1
-
- - - diff --git a/html/bayesnet/ensembles/AODELd.cc.func.html b/html/bayesnet/ensembles/AODELd.cc.func.html deleted file mode 100644 index 1480bb3..0000000 --- a/html/bayesnet/ensembles/AODELd.cc.func.html +++ /dev/null @@ -1,118 +0,0 @@ - - - - - - - LCOV - BayesNet Coverage Report - bayesnet/ensembles/AODELd.cc - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - bayesnet/ensembles - AODELd.cc (source / functions)CoverageTotalHit
Test:BayesNet Coverage ReportLines:100.0 %2424
Test Date:2024-05-06 17:54:04Functions:100.0 %55
Legend: Lines: - hit - not hit -
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Function Name Sort by function nameHit count Sort by function hit count
bayesnet::AODELd::AODELd(bool)68
bayesnet::AODELd::buildModel(at::Tensor const&)20
bayesnet::AODELd::fit(at::Tensor&, at::Tensor&, std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::map<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::vector<int, std::allocator<int> >, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, std::vector<int, std::allocator<int> > > > >&)20
bayesnet::AODELd::graph(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) const4
bayesnet::AODELd::trainModel(at::Tensor const&)20
-
-
- - - -
Generated by: LCOV version 2.0-1
-
- - - diff --git a/html/bayesnet/ensembles/AODELd.cc.gcov.frameset.html b/html/bayesnet/ensembles/AODELd.cc.gcov.frameset.html deleted file mode 100644 index 6ad9c56..0000000 --- a/html/bayesnet/ensembles/AODELd.cc.gcov.frameset.html +++ /dev/null @@ -1,19 +0,0 @@ - - - - - - - LCOV - BayesNet Coverage Report - bayesnet/ensembles/AODELd.cc - - - - - - - - <center>Frames not supported by your browser!<br></center> - - - - diff --git a/html/bayesnet/ensembles/AODELd.cc.gcov.html b/html/bayesnet/ensembles/AODELd.cc.gcov.html deleted file mode 100644 index ec90eb3..0000000 --- a/html/bayesnet/ensembles/AODELd.cc.gcov.html +++ /dev/null @@ -1,131 +0,0 @@ - - - - - - - LCOV - BayesNet Coverage Report - bayesnet/ensembles/AODELd.cc - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - bayesnet/ensembles - AODELd.cc (source / functions)CoverageTotalHit
Test:BayesNet Coverage ReportLines:100.0 %2424
Test Date:2024-05-06 17:54:04Functions:100.0 %55
Legend: Lines: - hit - not hit -
-
- - - - - - - - -

-
            Line data    Source code
-
-       1              : // ***************************************************************
-       2              : // SPDX-FileCopyrightText: Copyright 2024 Ricardo Montañana Gómez
-       3              : // SPDX-FileType: SOURCE
-       4              : // SPDX-License-Identifier: MIT
-       5              : // ***************************************************************
-       6              : 
-       7              : #include "AODELd.h"
-       8              : 
-       9              : namespace bayesnet {
-      10           68 :     AODELd::AODELd(bool predict_voting) : Ensemble(predict_voting), Proposal(dataset, features, className)
-      11              :     {
-      12           68 :     }
-      13           20 :     AODELd& AODELd::fit(torch::Tensor& X_, torch::Tensor& y_, const std::vector<std::string>& features_, const std::string& className_, map<std::string, std::vector<int>>& states_)
-      14              :     {
-      15           20 :         checkInput(X_, y_);
-      16           20 :         features = features_;
-      17           20 :         className = className_;
-      18           20 :         Xf = X_;
-      19           20 :         y = y_;
-      20              :         // Fills std::vectors Xv & yv with the data from tensors X_ (discretized) & y
-      21           20 :         states = fit_local_discretization(y);
-      22              :         // We have discretized the input data
-      23              :         // 1st we need to fit the model to build the normal TAN structure, TAN::fit initializes the base Bayesian network
-      24           20 :         Ensemble::fit(dataset, features, className, states);
-      25           20 :         return *this;
-      26              : 
-      27              :     }
-      28           20 :     void AODELd::buildModel(const torch::Tensor& weights)
-      29              :     {
-      30           20 :         models.clear();
-      31          168 :         for (int i = 0; i < features.size(); ++i) {
-      32          148 :             models.push_back(std::make_unique<SPODELd>(i));
-      33              :         }
-      34           20 :         n_models = models.size();
-      35           20 :         significanceModels = std::vector<double>(n_models, 1.0);
-      36           20 :     }
-      37           20 :     void AODELd::trainModel(const torch::Tensor& weights)
-      38              :     {
-      39          168 :         for (const auto& model : models) {
-      40          148 :             model->fit(Xf, y, features, className, states);
-      41              :         }
-      42           20 :     }
-      43            4 :     std::vector<std::string> AODELd::graph(const std::string& name) const
-      44              :     {
-      45            4 :         return Ensemble::graph(name);
-      46              :     }
-      47              : }
-        
-
-
- - - - -
Generated by: LCOV version 2.0-1
-
- - - diff --git a/html/bayesnet/ensembles/AODELd.cc.gcov.overview.html b/html/bayesnet/ensembles/AODELd.cc.gcov.overview.html deleted file mode 100644 index 4a5392b..0000000 --- a/html/bayesnet/ensembles/AODELd.cc.gcov.overview.html +++ /dev/null @@ -1,32 +0,0 @@ - - - - - - LCOV - BayesNet Coverage Report - bayesnet/ensembles/AODELd.cc - - - - - - - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - - -
- Top

- Overview -
- - diff --git a/html/bayesnet/ensembles/AODELd.cc.gcov.png b/html/bayesnet/ensembles/AODELd.cc.gcov.png deleted file mode 100644 index 820461b..0000000 Binary files a/html/bayesnet/ensembles/AODELd.cc.gcov.png and /dev/null differ diff --git a/html/bayesnet/ensembles/AODELd.h.func-c.html b/html/bayesnet/ensembles/AODELd.h.func-c.html deleted file mode 100644 index 1efbbbd..0000000 --- a/html/bayesnet/ensembles/AODELd.h.func-c.html +++ /dev/null @@ -1,90 +0,0 @@ - - - - - - - LCOV - BayesNet Coverage Report - bayesnet/ensembles/AODELd.h - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - bayesnet/ensembles - AODELd.h (source / functions)CoverageTotalHit
Test:BayesNet Coverage ReportLines:100.0 %11
Test Date:2024-05-06 17:54:04Functions:100.0 %11
Legend: Lines: - hit - not hit -
-
- -
- - - - - - - - - - - - - - - - -

Function Name Sort by function nameHit count Sort by function hit count
bayesnet::AODELd::~AODELd()20
-
-
- - - -
Generated by: LCOV version 2.0-1
-
- - - diff --git a/html/bayesnet/ensembles/AODELd.h.func.html b/html/bayesnet/ensembles/AODELd.h.func.html deleted file mode 100644 index ac31416..0000000 --- a/html/bayesnet/ensembles/AODELd.h.func.html +++ /dev/null @@ -1,90 +0,0 @@ - - - - - - - LCOV - BayesNet Coverage Report - bayesnet/ensembles/AODELd.h - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - bayesnet/ensembles - AODELd.h (source / functions)CoverageTotalHit
Test:BayesNet Coverage ReportLines:100.0 %11
Test Date:2024-05-06 17:54:04Functions:100.0 %11
Legend: Lines: - hit - not hit -
-
- -
- - - - - - - - - - - - - - - - -

Function Name Sort by function nameHit count Sort by function hit count
bayesnet::AODELd::~AODELd()20
-
-
- - - -
Generated by: LCOV version 2.0-1
-
- - - diff --git a/html/bayesnet/ensembles/AODELd.h.gcov.frameset.html b/html/bayesnet/ensembles/AODELd.h.gcov.frameset.html deleted file mode 100644 index 05a17d3..0000000 --- a/html/bayesnet/ensembles/AODELd.h.gcov.frameset.html +++ /dev/null @@ -1,19 +0,0 @@ - - - - - - - LCOV - BayesNet Coverage Report - bayesnet/ensembles/AODELd.h - - - - - - - - <center>Frames not supported by your browser!<br></center> - - - - diff --git a/html/bayesnet/ensembles/AODELd.h.gcov.html b/html/bayesnet/ensembles/AODELd.h.gcov.html deleted file mode 100644 index eddb474..0000000 --- a/html/bayesnet/ensembles/AODELd.h.gcov.html +++ /dev/null @@ -1,109 +0,0 @@ - - - - - - - LCOV - BayesNet Coverage Report - bayesnet/ensembles/AODELd.h - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - bayesnet/ensembles - AODELd.h (source / functions)CoverageTotalHit
Test:BayesNet Coverage ReportLines:100.0 %11
Test Date:2024-05-06 17:54:04Functions:100.0 %11
Legend: Lines: - hit - not hit -
-
- - - - - - - - -

-
            Line data    Source code
-
-       1              : // ***************************************************************
-       2              : // SPDX-FileCopyrightText: Copyright 2024 Ricardo Montañana Gómez
-       3              : // SPDX-FileType: SOURCE
-       4              : // SPDX-License-Identifier: MIT
-       5              : // ***************************************************************
-       6              : 
-       7              : #ifndef AODELD_H
-       8              : #define AODELD_H
-       9              : #include "bayesnet/classifiers/Proposal.h"
-      10              : #include "bayesnet/classifiers/SPODELd.h"
-      11              : #include "Ensemble.h"
-      12              : 
-      13              : namespace bayesnet {
-      14              :     class AODELd : public Ensemble, public Proposal {
-      15              :     public:
-      16              :         AODELd(bool predict_voting = true);
-      17           20 :         virtual ~AODELd() = default;
-      18              :         AODELd& fit(torch::Tensor& X_, torch::Tensor& y_, const std::vector<std::string>& features_, const std::string& className_, map<std::string, std::vector<int>>& states_) override;
-      19              :         std::vector<std::string> graph(const std::string& name = "AODELd") const override;
-      20              :     protected:
-      21              :         void trainModel(const torch::Tensor& weights) override;
-      22              :         void buildModel(const torch::Tensor& weights) override;
-      23              :     };
-      24              : }
-      25              : #endif // !AODELD_H
-        
-
-
- - - - -
Generated by: LCOV version 2.0-1
-
- - - diff --git a/html/bayesnet/ensembles/AODELd.h.gcov.overview.html b/html/bayesnet/ensembles/AODELd.h.gcov.overview.html deleted file mode 100644 index 2494af7..0000000 --- a/html/bayesnet/ensembles/AODELd.h.gcov.overview.html +++ /dev/null @@ -1,27 +0,0 @@ - - - - - - LCOV - BayesNet Coverage Report - bayesnet/ensembles/AODELd.h - - - - - - - overview - overview - overview - overview - overview - overview - overview - - -
- Top

- Overview -
- - diff --git a/html/bayesnet/ensembles/AODELd.h.gcov.png b/html/bayesnet/ensembles/AODELd.h.gcov.png deleted file mode 100644 index afba66b..0000000 Binary files a/html/bayesnet/ensembles/AODELd.h.gcov.png and /dev/null differ diff --git a/html/bayesnet/ensembles/BoostAODE.cc.func-c.html b/html/bayesnet/ensembles/BoostAODE.cc.func-c.html deleted file mode 100644 index b1c0a6e..0000000 --- a/html/bayesnet/ensembles/BoostAODE.cc.func-c.html +++ /dev/null @@ -1,146 +0,0 @@ - - - - - - - LCOV - BayesNet Coverage Report - bayesnet/ensembles/BoostAODE.cc - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - bayesnet/ensembles - BoostAODE.cc (source / functions)CoverageTotalHit
Test:BayesNet Coverage ReportLines:98.3 %237233
Test Date:2024-05-06 17:54:04Functions:100.0 %99
Legend: Lines: - hit - not hit -
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Function Name Sort by function nameHit count Sort by function hit count
bayesnet::BoostAODE::graph(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) const4
bayesnet::BoostAODE::update_weights_block(int, at::Tensor&, at::Tensor&)28
bayesnet::BoostAODE::initializeModels()32
bayesnet::BoostAODE::setHyperparameters(nlohmann::json_abi_v3_11_3::basic_json<std::map, std::vector, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, bool, long, unsigned long, double, std::allocator, nlohmann::json_abi_v3_11_3::adl_serializer, std::vector<unsigned char, std::allocator<unsigned char> >, void> const&)88
bayesnet::BoostAODE::buildModel(at::Tensor const&)92
bayesnet::BoostAODE::trainModel(at::Tensor const&)92
bayesnet::BoostAODE::BoostAODE(bool)168
bayesnet::update_weights(at::Tensor&, at::Tensor&, at::Tensor&)544
auto bayesnet::BoostAODE::trainModel(at::Tensor const&)::{lambda(auto:1)#1}::operator()<int>(int) const9700
-
-
- - - -
Generated by: LCOV version 2.0-1
-
- - - diff --git a/html/bayesnet/ensembles/BoostAODE.cc.func.html b/html/bayesnet/ensembles/BoostAODE.cc.func.html deleted file mode 100644 index 3684782..0000000 --- a/html/bayesnet/ensembles/BoostAODE.cc.func.html +++ /dev/null @@ -1,146 +0,0 @@ - - - - - - - LCOV - BayesNet Coverage Report - bayesnet/ensembles/BoostAODE.cc - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - bayesnet/ensembles - BoostAODE.cc (source / functions)CoverageTotalHit
Test:BayesNet Coverage ReportLines:98.3 %237233
Test Date:2024-05-06 17:54:04Functions:100.0 %99
Legend: Lines: - hit - not hit -
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Function Name Sort by function nameHit count Sort by function hit count
auto bayesnet::BoostAODE::trainModel(at::Tensor const&)::{lambda(auto:1)#1}::operator()<int>(int) const9700
bayesnet::BoostAODE::BoostAODE(bool)168
bayesnet::BoostAODE::buildModel(at::Tensor const&)92
bayesnet::BoostAODE::graph(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) const4
bayesnet::BoostAODE::initializeModels()32
bayesnet::BoostAODE::setHyperparameters(nlohmann::json_abi_v3_11_3::basic_json<std::map, std::vector, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, bool, long, unsigned long, double, std::allocator, nlohmann::json_abi_v3_11_3::adl_serializer, std::vector<unsigned char, std::allocator<unsigned char> >, void> const&)88
bayesnet::BoostAODE::trainModel(at::Tensor const&)92
bayesnet::BoostAODE::update_weights_block(int, at::Tensor&, at::Tensor&)28
bayesnet::update_weights(at::Tensor&, at::Tensor&, at::Tensor&)544
-
-
- - - -
Generated by: LCOV version 2.0-1
-
- - - diff --git a/html/bayesnet/ensembles/BoostAODE.cc.gcov.frameset.html b/html/bayesnet/ensembles/BoostAODE.cc.gcov.frameset.html deleted file mode 100644 index e7b9ea6..0000000 --- a/html/bayesnet/ensembles/BoostAODE.cc.gcov.frameset.html +++ /dev/null @@ -1,19 +0,0 @@ - - - - - - - LCOV - BayesNet Coverage Report - bayesnet/ensembles/BoostAODE.cc - - - - - - - - <center>Frames not supported by your browser!<br></center> - - - - diff --git a/html/bayesnet/ensembles/BoostAODE.cc.gcov.html b/html/bayesnet/ensembles/BoostAODE.cc.gcov.html deleted file mode 100644 index bfbb152..0000000 --- a/html/bayesnet/ensembles/BoostAODE.cc.gcov.html +++ /dev/null @@ -1,480 +0,0 @@ - - - - - - - LCOV - BayesNet Coverage Report - bayesnet/ensembles/BoostAODE.cc - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - bayesnet/ensembles - BoostAODE.cc (source / functions)CoverageTotalHit
Test:BayesNet Coverage ReportLines:98.3 %237233
Test Date:2024-05-06 17:54:04Functions:100.0 %99
Legend: Lines: - hit - not hit -
-
- - - - - - - - -

-
            Line data    Source code
-
-       1              : // ***************************************************************
-       2              : // SPDX-FileCopyrightText: Copyright 2024 Ricardo Montañana Gómez
-       3              : // SPDX-FileType: SOURCE
-       4              : // SPDX-License-Identifier: MIT
-       5              : // ***************************************************************
-       6              : 
-       7              : #include <set>
-       8              : #include <functional>
-       9              : #include <limits.h>
-      10              : #include <tuple>
-      11              : #include <folding.hpp>
-      12              : #include "bayesnet/feature_selection/CFS.h"
-      13              : #include "bayesnet/feature_selection/FCBF.h"
-      14              : #include "bayesnet/feature_selection/IWSS.h"
-      15              : #include "BoostAODE.h"
-      16              : #include "lib/log/loguru.cpp"
-      17              : 
-      18              : namespace bayesnet {
-      19              : 
-      20          168 :     BoostAODE::BoostAODE(bool predict_voting) : Ensemble(predict_voting)
-      21              :     {
-      22         1848 :         validHyperparameters = {
-      23              :             "maxModels", "bisection", "order", "convergence", "convergence_best", "threshold",
-      24              :             "select_features", "maxTolerance", "predict_voting", "block_update"
-      25         1848 :         };
-      26              : 
-      27          504 :     }
-      28           92 :     void BoostAODE::buildModel(const torch::Tensor& weights)
-      29              :     {
-      30              :         // Models shall be built in trainModel
-      31           92 :         models.clear();
-      32           92 :         significanceModels.clear();
-      33           92 :         n_models = 0;
-      34              :         // Prepare the validation dataset
-      35          276 :         auto y_ = dataset.index({ -1, "..." });
-      36           92 :         if (convergence) {
-      37              :             // Prepare train & validation sets from train data
-      38           76 :             auto fold = folding::StratifiedKFold(5, y_, 271);
-      39           76 :             auto [train, test] = fold.getFold(0);
-      40           76 :             auto train_t = torch::tensor(train);
-      41           76 :             auto test_t = torch::tensor(test);
-      42              :             // Get train and validation sets
-      43          380 :             X_train = dataset.index({ torch::indexing::Slice(0, dataset.size(0) - 1), train_t });
-      44          228 :             y_train = dataset.index({ -1, train_t });
-      45          380 :             X_test = dataset.index({ torch::indexing::Slice(0, dataset.size(0) - 1), test_t });
-      46          228 :             y_test = dataset.index({ -1, test_t });
-      47           76 :             dataset = X_train;
-      48           76 :             m = X_train.size(1);
-      49           76 :             auto n_classes = states.at(className).size();
-      50              :             // Build dataset with train data
-      51           76 :             buildDataset(y_train);
-      52           76 :             metrics = Metrics(dataset, features, className, n_classes);
-      53           76 :         } else {
-      54              :             // Use all data to train
-      55           64 :             X_train = dataset.index({ torch::indexing::Slice(0, dataset.size(0) - 1), "..." });
-      56           16 :             y_train = y_;
-      57              :         }
-      58          900 :     }
-      59           88 :     void BoostAODE::setHyperparameters(const nlohmann::json& hyperparameters_)
-      60              :     {
-      61           88 :         auto hyperparameters = hyperparameters_;
-      62           88 :         if (hyperparameters.contains("order")) {
-      63          100 :             std::vector<std::string> algos = { Orders.ASC, Orders.DESC, Orders.RAND };
-      64           20 :             order_algorithm = hyperparameters["order"];
-      65           20 :             if (std::find(algos.begin(), algos.end(), order_algorithm) == algos.end()) {
-      66            4 :                 throw std::invalid_argument("Invalid order algorithm, valid values [" + Orders.ASC + ", " + Orders.DESC + ", " + Orders.RAND + "]");
-      67              :             }
-      68           16 :             hyperparameters.erase("order");
-      69           20 :         }
-      70           84 :         if (hyperparameters.contains("convergence")) {
-      71           36 :             convergence = hyperparameters["convergence"];
-      72           36 :             hyperparameters.erase("convergence");
-      73              :         }
-      74           84 :         if (hyperparameters.contains("convergence_best")) {
-      75           12 :             convergence_best = hyperparameters["convergence_best"];
-      76           12 :             hyperparameters.erase("convergence_best");
-      77              :         }
-      78           84 :         if (hyperparameters.contains("bisection")) {
-      79           32 :             bisection = hyperparameters["bisection"];
-      80           32 :             hyperparameters.erase("bisection");
-      81              :         }
-      82           84 :         if (hyperparameters.contains("threshold")) {
-      83           24 :             threshold = hyperparameters["threshold"];
-      84           24 :             hyperparameters.erase("threshold");
-      85              :         }
-      86           84 :         if (hyperparameters.contains("maxTolerance")) {
-      87           44 :             maxTolerance = hyperparameters["maxTolerance"];
-      88           44 :             if (maxTolerance < 1 || maxTolerance > 4)
-      89           12 :                 throw std::invalid_argument("Invalid maxTolerance value, must be greater in [1, 4]");
-      90           32 :             hyperparameters.erase("maxTolerance");
-      91              :         }
-      92           72 :         if (hyperparameters.contains("predict_voting")) {
-      93            4 :             predict_voting = hyperparameters["predict_voting"];
-      94            4 :             hyperparameters.erase("predict_voting");
-      95              :         }
-      96           72 :         if (hyperparameters.contains("select_features")) {
-      97           36 :             auto selectedAlgorithm = hyperparameters["select_features"];
-      98          180 :             std::vector<std::string> algos = { SelectFeatures.IWSS, SelectFeatures.CFS, SelectFeatures.FCBF };
-      99           36 :             selectFeatures = true;
-     100           36 :             select_features_algorithm = selectedAlgorithm;
-     101           36 :             if (std::find(algos.begin(), algos.end(), selectedAlgorithm) == algos.end()) {
-     102            4 :                 throw std::invalid_argument("Invalid selectFeatures value, valid values [" + SelectFeatures.IWSS + ", " + SelectFeatures.CFS + ", " + SelectFeatures.FCBF + "]");
-     103              :             }
-     104           32 :             hyperparameters.erase("select_features");
-     105           40 :         }
-     106           68 :         if (hyperparameters.contains("block_update")) {
-     107            8 :             block_update = hyperparameters["block_update"];
-     108            8 :             hyperparameters.erase("block_update");
-     109              :         }
-     110           68 :         Classifier::setHyperparameters(hyperparameters);
-     111          144 :     }
-     112          544 :     std::tuple<torch::Tensor&, double, bool> update_weights(torch::Tensor& ytrain, torch::Tensor& ypred, torch::Tensor& weights)
-     113              :     {
-     114          544 :         bool terminate = false;
-     115          544 :         double alpha_t = 0;
-     116          544 :         auto mask_wrong = ypred != ytrain;
-     117          544 :         auto mask_right = ypred == ytrain;
-     118          544 :         auto masked_weights = weights * mask_wrong.to(weights.dtype());
-     119          544 :         double epsilon_t = masked_weights.sum().item<double>();
-     120          544 :         if (epsilon_t > 0.5) {
-     121              :             // Inverse the weights policy (plot ln(wt))
-     122              :             // "In each round of AdaBoost, there is a sanity check to ensure that the current base 
-     123              :             // learner is better than random guess" (Zhi-Hua Zhou, 2012)
-     124           16 :             terminate = true;
-     125              :         } else {
-     126          528 :             double wt = (1 - epsilon_t) / epsilon_t;
-     127          528 :             alpha_t = epsilon_t == 0 ? 1 : 0.5 * log(wt);
-     128              :             // Step 3.2: Update weights for next classifier
-     129              :             // Step 3.2.1: Update weights of wrong samples
-     130          528 :             weights += mask_wrong.to(weights.dtype()) * exp(alpha_t) * weights;
-     131              :             // Step 3.2.2: Update weights of right samples
-     132          528 :             weights += mask_right.to(weights.dtype()) * exp(-alpha_t) * weights;
-     133              :             // Step 3.3: Normalise the weights
-     134          528 :             double totalWeights = torch::sum(weights).item<double>();
-     135          528 :             weights = weights / totalWeights;
-     136              :         }
-     137         1088 :         return { weights, alpha_t, terminate };
-     138          544 :     }
-     139           28 :     std::tuple<torch::Tensor&, double, bool> BoostAODE::update_weights_block(int k, torch::Tensor& ytrain, torch::Tensor& weights)
-     140              :     {
-     141              :         /* Update Block algorithm
-     142              :             k = # of models in block
-     143              :             n_models = # of models in ensemble to make predictions
-     144              :             n_models_bak = # models saved
-     145              :             models = vector of models to make predictions
-     146              :             models_bak = models not used to make predictions
-     147              :             significances_bak = backup of significances vector
-     148              : 
-     149              :             Case list
-     150              :             A) k = 1, n_models = 1              => n = 0 , n_models = n + k
-     151              :             B) k = 1, n_models = n + 1  => n_models = n + k
-     152              :             C) k > 1, n_models = k + 1       => n= 1, n_models = n + k
-     153              :             D) k > 1, n_models = k           => n = 0, n_models = n + k
-     154              :             E) k > 1, n_models = k + n       => n_models = n + k
-     155              : 
-     156              :             A, D) n=0, k > 0, n_models == k
-     157              :             1. n_models_bak <- n_models
-     158              :             2. significances_bak <- significances
-     159              :             3. significances = vector(k, 1)
-     160              :             4. Don’t move any classifiers out of models
-     161              :             5. n_models <- k
-     162              :             6. Make prediction, compute alpha, update weights
-     163              :             7. Don’t restore any classifiers to models
-     164              :             8. significances <- significances_bak
-     165              :             9. Update last k significances
-     166              :             10. n_models <- n_models_bak
-     167              : 
-     168              :             B, C, E) n > 0, k > 0, n_models == n + k
-     169              :             1. n_models_bak <- n_models
-     170              :             2. significances_bak <- significances
-     171              :             3. significances = vector(k, 1)
-     172              :             4. Move first n classifiers to models_bak
-     173              :             5. n_models <- k
-     174              :             6. Make prediction, compute alpha, update weights
-     175              :             7. Insert classifiers in models_bak to be the first n models
-     176              :             8. significances <- significances_bak
-     177              :             9. Update last k significances
-     178              :             10. n_models <- n_models_bak
-     179              :         */
-     180              :         //
-     181              :         // Make predict with only the last k models
-     182              :         //
-     183           28 :         std::unique_ptr<Classifier> model;
-     184           28 :         std::vector<std::unique_ptr<Classifier>> models_bak;
-     185              :         // 1. n_models_bak <- n_models 2. significances_bak <- significances
-     186           28 :         auto significance_bak = significanceModels;
-     187           28 :         auto n_models_bak = n_models;
-     188              :         // 3. significances = vector(k, 1)
-     189           28 :         significanceModels = std::vector<double>(k, 1.0);
-     190              :         // 4. Move first n classifiers to models_bak
-     191              :         // backup the first n_models - k models (if n_models == k, don't backup any)
-     192          148 :         for (int i = 0; i < n_models - k; ++i) {
-     193          120 :             model = std::move(models[0]);
-     194          120 :             models.erase(models.begin());
-     195          120 :             models_bak.push_back(std::move(model));
-     196              :         }
-     197           28 :         assert(models.size() == k);
-     198              :         // 5. n_models <- k
-     199           28 :         n_models = k;
-     200              :         // 6. Make prediction, compute alpha, update weights
-     201           28 :         auto ypred = predict(X_train);
-     202              :         //
-     203              :         // Update weights
-     204              :         //
-     205              :         double alpha_t;
-     206              :         bool terminate;
-     207           28 :         std::tie(weights, alpha_t, terminate) = update_weights(y_train, ypred, weights);
-     208              :         //
-     209              :         // Restore the models if needed
-     210              :         //
-     211              :         // 7. Insert classifiers in models_bak to be the first n models
-     212              :         // if n_models_bak == k, don't restore any, because none of them were moved
-     213           28 :         if (k != n_models_bak) {
-     214              :             // Insert in the same order as they were extracted
-     215           24 :             int bak_size = models_bak.size();
-     216          144 :             for (int i = 0; i < bak_size; ++i) {
-     217          120 :                 model = std::move(models_bak[bak_size - 1 - i]);
-     218          120 :                 models_bak.erase(models_bak.end() - 1);
-     219          120 :                 models.insert(models.begin(), std::move(model));
-     220              :             }
-     221              :         }
-     222              :         // 8. significances <- significances_bak
-     223           28 :         significanceModels = significance_bak;
-     224              :         //
-     225              :         // Update the significance of the last k models
-     226              :         //
-     227              :         // 9. Update last k significances
-     228          104 :         for (int i = 0; i < k; ++i) {
-     229           76 :             significanceModels[n_models_bak - k + i] = alpha_t;
-     230              :         }
-     231              :         // 10. n_models <- n_models_bak
-     232           28 :         n_models = n_models_bak;
-     233           56 :         return { weights, alpha_t, terminate };
-     234           28 :     }
-     235           32 :     std::vector<int> BoostAODE::initializeModels()
-     236              :     {
-     237           32 :         std::vector<int> featuresUsed;
-     238           32 :         torch::Tensor weights_ = torch::full({ m }, 1.0 / m, torch::kFloat64);
-     239           32 :         int maxFeatures = 0;
-     240           32 :         if (select_features_algorithm == SelectFeatures.CFS) {
-     241            8 :             featureSelector = new CFS(dataset, features, className, maxFeatures, states.at(className).size(), weights_);
-     242           24 :         } else if (select_features_algorithm == SelectFeatures.IWSS) {
-     243           12 :             if (threshold < 0 || threshold >0.5) {
-     244            8 :                 throw std::invalid_argument("Invalid threshold value for " + SelectFeatures.IWSS + " [0, 0.5]");
-     245              :             }
-     246            4 :             featureSelector = new IWSS(dataset, features, className, maxFeatures, states.at(className).size(), weights_, threshold);
-     247           12 :         } else if (select_features_algorithm == SelectFeatures.FCBF) {
-     248           12 :             if (threshold < 1e-7 || threshold > 1) {
-     249            8 :                 throw std::invalid_argument("Invalid threshold value for " + SelectFeatures.FCBF + " [1e-7, 1]");
-     250              :             }
-     251            4 :             featureSelector = new FCBF(dataset, features, className, maxFeatures, states.at(className).size(), weights_, threshold);
-     252              :         }
-     253           16 :         featureSelector->fit();
-     254           16 :         auto cfsFeatures = featureSelector->getFeatures();
-     255           16 :         auto scores = featureSelector->getScores();
-     256          100 :         for (const int& feature : cfsFeatures) {
-     257           84 :             featuresUsed.push_back(feature);
-     258           84 :             std::unique_ptr<Classifier> model = std::make_unique<SPODE>(feature);
-     259           84 :             model->fit(dataset, features, className, states, weights_);
-     260           84 :             models.push_back(std::move(model));
-     261           84 :             significanceModels.push_back(1.0); // They will be updated later in trainModel
-     262           84 :             n_models++;
-     263           84 :         }
-     264           16 :         notes.push_back("Used features in initialization: " + std::to_string(featuresUsed.size()) + " of " + std::to_string(features.size()) + " with " + select_features_algorithm);
-     265           16 :         delete featureSelector;
-     266           32 :         return featuresUsed;
-     267           48 :     }
-     268           92 :     void BoostAODE::trainModel(const torch::Tensor& weights)
-     269              :     {
-     270              :         //
-     271              :         // Logging setup
-     272              :         //
-     273           92 :         loguru::set_thread_name("BoostAODE");
-     274           92 :         loguru::g_stderr_verbosity = loguru::Verbosity_OFF;
-     275           92 :         loguru::add_file("boostAODE.log", loguru::Truncate, loguru::Verbosity_MAX);
-     276              : 
-     277              :         // Algorithm based on the adaboost algorithm for classification
-     278              :         // as explained in Ensemble methods (Zhi-Hua Zhou, 2012)
-     279           92 :         fitted = true;
-     280           92 :         double alpha_t = 0;
-     281           92 :         torch::Tensor weights_ = torch::full({ m }, 1.0 / m, torch::kFloat64);
-     282           92 :         bool finished = false;
-     283           92 :         std::vector<int> featuresUsed;
-     284           92 :         if (selectFeatures) {
-     285           32 :             featuresUsed = initializeModels();
-     286           16 :             auto ypred = predict(X_train);
-     287           16 :             std::tie(weights_, alpha_t, finished) = update_weights(y_train, ypred, weights_);
-     288              :             // Update significance of the models
-     289          100 :             for (int i = 0; i < n_models; ++i) {
-     290           84 :                 significanceModels[i] = alpha_t;
-     291              :             }
-     292           16 :             if (finished) {
-     293            0 :                 return;
-     294              :             }
-     295           16 :         }
-     296           76 :         int numItemsPack = 0; // The counter of the models inserted in the current pack
-     297              :         // Variables to control the accuracy finish condition
-     298           76 :         double priorAccuracy = 0.0;
-     299           76 :         double improvement = 1.0;
-     300           76 :         double convergence_threshold = 1e-4;
-     301           76 :         int tolerance = 0; // number of times the accuracy is lower than the convergence_threshold
-     302              :         // Step 0: Set the finish condition
-     303              :         // epsilon sub t > 0.5 => inverse the weights policy
-     304              :         // validation error is not decreasing
-     305              :         // run out of features
-     306           76 :         bool ascending = order_algorithm == Orders.ASC;
-     307           76 :         std::mt19937 g{ 173 };
-     308          504 :         while (!finished) {
-     309              :             // Step 1: Build ranking with mutual information
-     310          428 :             auto featureSelection = metrics.SelectKBestWeighted(weights_, ascending, n); // Get all the features sorted
-     311          428 :             if (order_algorithm == Orders.RAND) {
-     312           36 :                 std::shuffle(featureSelection.begin(), featureSelection.end(), g);
-     313              :             }
-     314              :             // Remove used features
-     315          856 :             featureSelection.erase(remove_if(begin(featureSelection), end(featureSelection), [&](auto x)
-     316        38800 :                 { return std::find(begin(featuresUsed), end(featuresUsed), x) != end(featuresUsed);}),
-     317          428 :                 end(featureSelection)
-     318              :             );
-     319          428 :             int k = bisection ? pow(2, tolerance) : 1;
-     320          428 :             int counter = 0; // The model counter of the current pack
-     321          428 :             VLOG_SCOPE_F(1, "counter=%d k=%d featureSelection.size: %zu", counter, k, featureSelection.size());
-     322         1004 :             while (counter++ < k && featureSelection.size() > 0) {
-     323          576 :                 auto feature = featureSelection[0];
-     324          576 :                 featureSelection.erase(featureSelection.begin());
-     325          576 :                 std::unique_ptr<Classifier> model;
-     326          576 :                 model = std::make_unique<SPODE>(feature);
-     327          576 :                 model->fit(dataset, features, className, states, weights_);
-     328          576 :                 alpha_t = 0.0;
-     329          576 :                 if (!block_update) {
-     330          500 :                     auto ypred = model->predict(X_train);
-     331              :                     // Step 3.1: Compute the classifier amout of say
-     332          500 :                     std::tie(weights_, alpha_t, finished) = update_weights(y_train, ypred, weights_);
-     333          500 :                 }
-     334              :                 // Step 3.4: Store classifier and its accuracy to weigh its future vote
-     335          576 :                 numItemsPack++;
-     336          576 :                 featuresUsed.push_back(feature);
-     337          576 :                 models.push_back(std::move(model));
-     338          576 :                 significanceModels.push_back(alpha_t);
-     339          576 :                 n_models++;
-     340          576 :                 VLOG_SCOPE_F(2, "numItemsPack: %d n_models: %d featuresUsed: %zu", numItemsPack, n_models, featuresUsed.size());
-     341          576 :             }
-     342          428 :             if (block_update) {
-     343           28 :                 std::tie(weights_, alpha_t, finished) = update_weights_block(k, y_train, weights_);
-     344              :             }
-     345          428 :             if (convergence && !finished) {
-     346          296 :                 auto y_val_predict = predict(X_test);
-     347          296 :                 double accuracy = (y_val_predict == y_test).sum().item<double>() / (double)y_test.size(0);
-     348          296 :                 if (priorAccuracy == 0) {
-     349           60 :                     priorAccuracy = accuracy;
-     350              :                 } else {
-     351          236 :                     improvement = accuracy - priorAccuracy;
-     352              :                 }
-     353          296 :                 if (improvement < convergence_threshold) {
-     354          176 :                     VLOG_SCOPE_F(3, "  (improvement<threshold) tolerance: %d numItemsPack: %d improvement: %f prior: %f current: %f", tolerance, numItemsPack, improvement, priorAccuracy, accuracy);
-     355          176 :                     tolerance++;
-     356          176 :                 } else {
-     357          120 :                     VLOG_SCOPE_F(3, "* (improvement>=threshold) Reset. tolerance: %d numItemsPack: %d improvement: %f prior: %f current: %f", tolerance, numItemsPack, improvement, priorAccuracy, accuracy);
-     358          120 :                     tolerance = 0; // Reset the counter if the model performs better
-     359          120 :                     numItemsPack = 0;
-     360          120 :                 }
-     361          296 :                 if (convergence_best) {
-     362              :                     // Keep the best accuracy until now as the prior accuracy
-     363           32 :                     priorAccuracy = std::max(accuracy, priorAccuracy);
-     364              :                 } else {
-     365              :                     // Keep the last accuray obtained as the prior accuracy
-     366          264 :                     priorAccuracy = accuracy;
-     367              :                 }
-     368          296 :             }
-     369          428 :             VLOG_SCOPE_F(1, "tolerance: %d featuresUsed.size: %zu features.size: %zu", tolerance, featuresUsed.size(), features.size());
-     370          428 :             finished = finished || tolerance > maxTolerance || featuresUsed.size() == features.size();
-     371          428 :         }
-     372           76 :         if (tolerance > maxTolerance) {
-     373            8 :             if (numItemsPack < n_models) {
-     374            8 :                 notes.push_back("Convergence threshold reached & " + std::to_string(numItemsPack) + " models eliminated");
-     375            8 :                 VLOG_SCOPE_F(4, "Convergence threshold reached & %d models eliminated of %d", numItemsPack, n_models);
-     376          104 :                 for (int i = 0; i < numItemsPack; ++i) {
-     377           96 :                     significanceModels.pop_back();
-     378           96 :                     models.pop_back();
-     379           96 :                     n_models--;
-     380              :                 }
-     381            8 :             } else {
-     382            0 :                 notes.push_back("Convergence threshold reached & 0 models eliminated");
-     383            0 :                 VLOG_SCOPE_F(4, "Convergence threshold reached & 0 models eliminated n_models=%d numItemsPack=%d", n_models, numItemsPack);
-     384            0 :             }
-     385              :         }
-     386           76 :         if (featuresUsed.size() != features.size()) {
-     387            4 :             notes.push_back("Used features in train: " + std::to_string(featuresUsed.size()) + " of " + std::to_string(features.size()));
-     388            4 :             status = WARNING;
-     389              :         }
-     390           76 :         notes.push_back("Number of models: " + std::to_string(n_models));
-     391          108 :     }
-     392            4 :     std::vector<std::string> BoostAODE::graph(const std::string& title) const
-     393              :     {
-     394            4 :         return Ensemble::graph(title);
-     395              :     }
-     396              : }
-        
-
-
- - - - -
Generated by: LCOV version 2.0-1
-
- - - diff --git a/html/bayesnet/ensembles/BoostAODE.cc.gcov.overview.html b/html/bayesnet/ensembles/BoostAODE.cc.gcov.overview.html deleted file mode 100644 index 41fb2fd..0000000 --- a/html/bayesnet/ensembles/BoostAODE.cc.gcov.overview.html +++ /dev/null @@ -1,119 +0,0 @@ - - - - - - LCOV - BayesNet Coverage Report - bayesnet/ensembles/BoostAODE.cc - - - - - - - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - - -
- Top

- Overview -
- - diff --git a/html/bayesnet/ensembles/BoostAODE.cc.gcov.png b/html/bayesnet/ensembles/BoostAODE.cc.gcov.png deleted file mode 100644 index 9690752..0000000 Binary files a/html/bayesnet/ensembles/BoostAODE.cc.gcov.png and /dev/null differ diff --git a/html/bayesnet/ensembles/BoostAODE.h.func-c.html b/html/bayesnet/ensembles/BoostAODE.h.func-c.html deleted file mode 100644 index cd1d5b3..0000000 --- a/html/bayesnet/ensembles/BoostAODE.h.func-c.html +++ /dev/null @@ -1,90 +0,0 @@ - - - - - - - LCOV - BayesNet Coverage Report - bayesnet/ensembles/BoostAODE.h - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - bayesnet/ensembles - BoostAODE.h (source / functions)CoverageTotalHit
Test:BayesNet Coverage ReportLines:100.0 %11
Test Date:2024-05-06 17:54:04Functions:100.0 %11
Legend: Lines: - hit - not hit -
-
- -
- - - - - - - - - - - - - - - - -

Function Name Sort by function nameHit count Sort by function hit count
bayesnet::BoostAODE::~BoostAODE()88
-
-
- - - -
Generated by: LCOV version 2.0-1
-
- - - diff --git a/html/bayesnet/ensembles/BoostAODE.h.func.html b/html/bayesnet/ensembles/BoostAODE.h.func.html deleted file mode 100644 index 0d6e3e7..0000000 --- a/html/bayesnet/ensembles/BoostAODE.h.func.html +++ /dev/null @@ -1,90 +0,0 @@ - - - - - - - LCOV - BayesNet Coverage Report - bayesnet/ensembles/BoostAODE.h - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - bayesnet/ensembles - BoostAODE.h (source / functions)CoverageTotalHit
Test:BayesNet Coverage ReportLines:100.0 %11
Test Date:2024-05-06 17:54:04Functions:100.0 %11
Legend: Lines: - hit - not hit -
-
- -
- - - - - - - - - - - - - - - - -

Function Name Sort by function nameHit count Sort by function hit count
bayesnet::BoostAODE::~BoostAODE()88
-
-
- - - -
Generated by: LCOV version 2.0-1
-
- - - diff --git a/html/bayesnet/ensembles/BoostAODE.h.gcov.frameset.html b/html/bayesnet/ensembles/BoostAODE.h.gcov.frameset.html deleted file mode 100644 index bf76400..0000000 --- a/html/bayesnet/ensembles/BoostAODE.h.gcov.frameset.html +++ /dev/null @@ -1,19 +0,0 @@ - - - - - - - LCOV - BayesNet Coverage Report - bayesnet/ensembles/BoostAODE.h - - - - - - - - <center>Frames not supported by your browser!<br></center> - - - - diff --git a/html/bayesnet/ensembles/BoostAODE.h.gcov.html b/html/bayesnet/ensembles/BoostAODE.h.gcov.html deleted file mode 100644 index f435ab1..0000000 --- a/html/bayesnet/ensembles/BoostAODE.h.gcov.html +++ /dev/null @@ -1,134 +0,0 @@ - - - - - - - LCOV - BayesNet Coverage Report - bayesnet/ensembles/BoostAODE.h - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - bayesnet/ensembles - BoostAODE.h (source / functions)CoverageTotalHit
Test:BayesNet Coverage ReportLines:100.0 %11
Test Date:2024-05-06 17:54:04Functions:100.0 %11
Legend: Lines: - hit - not hit -
-
- - - - - - - - -

-
            Line data    Source code
-
-       1              : // ***************************************************************
-       2              : // SPDX-FileCopyrightText: Copyright 2024 Ricardo Montañana Gómez
-       3              : // SPDX-FileType: SOURCE
-       4              : // SPDX-License-Identifier: MIT
-       5              : // ***************************************************************
-       6              : 
-       7              : #ifndef BOOSTAODE_H
-       8              : #define BOOSTAODE_H
-       9              : #include <map>
-      10              : #include "bayesnet/classifiers/SPODE.h"
-      11              : #include "bayesnet/feature_selection/FeatureSelect.h"
-      12              : #include "Ensemble.h"
-      13              : namespace bayesnet {
-      14              :     const struct {
-      15              :         std::string CFS = "CFS";
-      16              :         std::string FCBF = "FCBF";
-      17              :         std::string IWSS = "IWSS";
-      18              :     }SelectFeatures;
-      19              :     const struct {
-      20              :         std::string ASC = "asc";
-      21              :         std::string DESC = "desc";
-      22              :         std::string RAND = "rand";
-      23              :     }Orders;
-      24              :     class BoostAODE : public Ensemble {
-      25              :     public:
-      26              :         explicit BoostAODE(bool predict_voting = false);
-      27           88 :         virtual ~BoostAODE() = default;
-      28              :         std::vector<std::string> graph(const std::string& title = "BoostAODE") const override;
-      29              :         void setHyperparameters(const nlohmann::json& hyperparameters_) override;
-      30              :     protected:
-      31              :         void buildModel(const torch::Tensor& weights) override;
-      32              :         void trainModel(const torch::Tensor& weights) override;
-      33              :     private:
-      34              :         std::tuple<torch::Tensor&, double, bool> update_weights_block(int k, torch::Tensor& ytrain, torch::Tensor& weights);
-      35              :         std::vector<int> initializeModels();
-      36              :         torch::Tensor X_train, y_train, X_test, y_test;
-      37              :         // Hyperparameters
-      38              :         bool bisection = true; // if true, use bisection stratety to add k models at once to the ensemble
-      39              :         int maxTolerance = 3;
-      40              :         std::string order_algorithm; // order to process the KBest features asc, desc, rand
-      41              :         bool convergence = true; //if true, stop when the model does not improve
-      42              :         bool convergence_best = false; // wether to keep the best accuracy to the moment or the last accuracy as prior accuracy
-      43              :         bool selectFeatures = false; // if true, use feature selection
-      44              :         std::string select_features_algorithm = Orders.DESC; // Selected feature selection algorithm
-      45              :         FeatureSelect* featureSelector = nullptr;
-      46              :         double threshold = -1;
-      47              :         bool block_update = false;
-      48              :     };
-      49              : }
-      50              : #endif
-        
-
-
- - - - -
Generated by: LCOV version 2.0-1
-
- - - diff --git a/html/bayesnet/ensembles/BoostAODE.h.gcov.overview.html b/html/bayesnet/ensembles/BoostAODE.h.gcov.overview.html deleted file mode 100644 index b0556d7..0000000 --- a/html/bayesnet/ensembles/BoostAODE.h.gcov.overview.html +++ /dev/null @@ -1,33 +0,0 @@ - - - - - - LCOV - BayesNet Coverage Report - bayesnet/ensembles/BoostAODE.h - - - - - - - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - - -
- Top

- Overview -
- - diff --git a/html/bayesnet/ensembles/BoostAODE.h.gcov.png b/html/bayesnet/ensembles/BoostAODE.h.gcov.png deleted file mode 100644 index 193c4ce..0000000 Binary files a/html/bayesnet/ensembles/BoostAODE.h.gcov.png and /dev/null differ diff --git a/html/bayesnet/ensembles/Ensemble.cc.func-c.html b/html/bayesnet/ensembles/Ensemble.cc.func-c.html deleted file mode 100644 index a883be2..0000000 --- a/html/bayesnet/ensembles/Ensemble.cc.func-c.html +++ /dev/null @@ -1,258 +0,0 @@ - - - - - - - LCOV - BayesNet Coverage Report - bayesnet/ensembles/Ensemble.cc - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - bayesnet/ensembles - Ensemble.cc (source / functions)CoverageTotalHit
Test:BayesNet Coverage ReportLines:100.0 %155155
Test Date:2024-05-06 17:54:04Functions:100.0 %2525
Legend: Lines: - hit - not hit -
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Function Name Sort by function nameHit count Sort by function hit count
bayesnet::Ensemble::getNumberOfStates() const4
bayesnet::Ensemble::show[abi:cxx11]() const4
bayesnet::Ensemble::graph(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) const16
bayesnet::Ensemble::getNumberOfEdges() const28
bayesnet::Ensemble::getNumberOfNodes() const28
bayesnet::Ensemble::predict_average_voting(std::vector<std::vector<int, std::allocator<int> >, std::allocator<std::vector<int, std::allocator<int> > > >&)32
bayesnet::Ensemble::trainModel(at::Tensor const&)40
bayesnet::Ensemble::predict_average_proba(std::vector<std::vector<int, std::allocator<int> >, std::allocator<std::vector<int, std::allocator<int> > > >&)44
bayesnet::Ensemble::score(std::vector<std::vector<int, std::allocator<int> >, std::allocator<std::vector<int, std::allocator<int> > > >&, std::vector<int, std::allocator<int> >&)52
bayesnet::Ensemble::compute_arg_max(std::vector<std::vector<double, std::allocator<double> >, std::allocator<std::vector<double, std::allocator<double> > > >&)56
bayesnet::Ensemble::predict(std::vector<std::vector<int, std::allocator<int> >, std::allocator<std::vector<int, std::allocator<int> > > >&)68
bayesnet::Ensemble::score(at::Tensor&, at::Tensor&)80
bayesnet::Ensemble::predict_proba(std::vector<std::vector<int, std::allocator<int> >, std::allocator<std::vector<int, std::allocator<int> > > >&)100
bayesnet::Ensemble::predict_average_voting(at::Tensor&)164
bayesnet::Ensemble::voting(at::Tensor&)164
bayesnet::Ensemble::predict_average_proba(at::Tensor&)296
bayesnet::Ensemble::Ensemble(bool)324
bayesnet::Ensemble::compute_arg_max(at::Tensor&)424
bayesnet::Ensemble::predict(at::Tensor&)436
bayesnet::Ensemble::predict_proba(at::Tensor&)452
bayesnet::Ensemble::predict_average_proba(std::vector<std::vector<int, std::allocator<int> >, std::allocator<std::vector<int, std::allocator<int> > > >&)::{lambda()#1}::operator()() const532
bayesnet::Ensemble::predict_average_voting(at::Tensor&)::{lambda()#1}::operator()() const1216
bayesnet::Ensemble::predict_average_proba(at::Tensor&)::{lambda()#1}::operator()() const1468
bayesnet::Ensemble::predict_average_proba(std::vector<std::vector<int, std::allocator<int> >, std::allocator<std::vector<int, std::allocator<int> > > >&)::{lambda(double)#1}::operator()(double) const43152
bayesnet::Ensemble::predict_average_proba(std::vector<std::vector<int, std::allocator<int> >, std::allocator<std::vector<int, std::allocator<int> > > >&)::{lambda()#1}::operator()() const::{lambda(double, double)#1}::operator()(double, double) const629712
-
-
- - - -
Generated by: LCOV version 2.0-1
-
- - - diff --git a/html/bayesnet/ensembles/Ensemble.cc.func.html b/html/bayesnet/ensembles/Ensemble.cc.func.html deleted file mode 100644 index 4a8acaf..0000000 --- a/html/bayesnet/ensembles/Ensemble.cc.func.html +++ /dev/null @@ -1,258 +0,0 @@ - - - - - - - LCOV - BayesNet Coverage Report - bayesnet/ensembles/Ensemble.cc - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - bayesnet/ensembles - Ensemble.cc (source / functions)CoverageTotalHit
Test:BayesNet Coverage ReportLines:100.0 %155155
Test Date:2024-05-06 17:54:04Functions:100.0 %2525
Legend: Lines: - hit - not hit -
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Function Name Sort by function nameHit count Sort by function hit count
bayesnet::Ensemble::Ensemble(bool)324
bayesnet::Ensemble::compute_arg_max(at::Tensor&)424
bayesnet::Ensemble::compute_arg_max(std::vector<std::vector<double, std::allocator<double> >, std::allocator<std::vector<double, std::allocator<double> > > >&)56
bayesnet::Ensemble::getNumberOfEdges() const28
bayesnet::Ensemble::getNumberOfNodes() const28
bayesnet::Ensemble::getNumberOfStates() const4
bayesnet::Ensemble::graph(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) const16
bayesnet::Ensemble::predict(at::Tensor&)436
bayesnet::Ensemble::predict(std::vector<std::vector<int, std::allocator<int> >, std::allocator<std::vector<int, std::allocator<int> > > >&)68
bayesnet::Ensemble::predict_average_proba(at::Tensor&)296
bayesnet::Ensemble::predict_average_proba(at::Tensor&)::{lambda()#1}::operator()() const1468
bayesnet::Ensemble::predict_average_proba(std::vector<std::vector<int, std::allocator<int> >, std::allocator<std::vector<int, std::allocator<int> > > >&)44
bayesnet::Ensemble::predict_average_proba(std::vector<std::vector<int, std::allocator<int> >, std::allocator<std::vector<int, std::allocator<int> > > >&)::{lambda()#1}::operator()() const532
bayesnet::Ensemble::predict_average_proba(std::vector<std::vector<int, std::allocator<int> >, std::allocator<std::vector<int, std::allocator<int> > > >&)::{lambda()#1}::operator()() const::{lambda(double, double)#1}::operator()(double, double) const629712
bayesnet::Ensemble::predict_average_proba(std::vector<std::vector<int, std::allocator<int> >, std::allocator<std::vector<int, std::allocator<int> > > >&)::{lambda(double)#1}::operator()(double) const43152
bayesnet::Ensemble::predict_average_voting(at::Tensor&)164
bayesnet::Ensemble::predict_average_voting(at::Tensor&)::{lambda()#1}::operator()() const1216
bayesnet::Ensemble::predict_average_voting(std::vector<std::vector<int, std::allocator<int> >, std::allocator<std::vector<int, std::allocator<int> > > >&)32
bayesnet::Ensemble::predict_proba(at::Tensor&)452
bayesnet::Ensemble::predict_proba(std::vector<std::vector<int, std::allocator<int> >, std::allocator<std::vector<int, std::allocator<int> > > >&)100
bayesnet::Ensemble::score(at::Tensor&, at::Tensor&)80
bayesnet::Ensemble::score(std::vector<std::vector<int, std::allocator<int> >, std::allocator<std::vector<int, std::allocator<int> > > >&, std::vector<int, std::allocator<int> >&)52
bayesnet::Ensemble::show[abi:cxx11]() const4
bayesnet::Ensemble::trainModel(at::Tensor const&)40
bayesnet::Ensemble::voting(at::Tensor&)164
-
-
- - - -
Generated by: LCOV version 2.0-1
-
- - - diff --git a/html/bayesnet/ensembles/Ensemble.cc.gcov.frameset.html b/html/bayesnet/ensembles/Ensemble.cc.gcov.frameset.html deleted file mode 100644 index 0a30b16..0000000 --- a/html/bayesnet/ensembles/Ensemble.cc.gcov.frameset.html +++ /dev/null @@ -1,19 +0,0 @@ - - - - - - - LCOV - BayesNet Coverage Report - bayesnet/ensembles/Ensemble.cc - - - - - - - - <center>Frames not supported by your browser!<br></center> - - - - diff --git a/html/bayesnet/ensembles/Ensemble.cc.gcov.html b/html/bayesnet/ensembles/Ensemble.cc.gcov.html deleted file mode 100644 index 9113988..0000000 --- a/html/bayesnet/ensembles/Ensemble.cc.gcov.html +++ /dev/null @@ -1,306 +0,0 @@ - - - - - - - LCOV - BayesNet Coverage Report - bayesnet/ensembles/Ensemble.cc - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - bayesnet/ensembles - Ensemble.cc (source / functions)CoverageTotalHit
Test:BayesNet Coverage ReportLines:100.0 %155155
Test Date:2024-05-06 17:54:04Functions:100.0 %2525
Legend: Lines: - hit - not hit -
-
- - - - - - - - -

-
            Line data    Source code
-
-       1              : // ***************************************************************
-       2              : // SPDX-FileCopyrightText: Copyright 2024 Ricardo Montañana Gómez
-       3              : // SPDX-FileType: SOURCE
-       4              : // SPDX-License-Identifier: MIT
-       5              : // ***************************************************************
-       6              : 
-       7              : #include "Ensemble.h"
-       8              : 
-       9              : namespace bayesnet {
-      10              : 
-      11          324 :     Ensemble::Ensemble(bool predict_voting) : Classifier(Network()), n_models(0), predict_voting(predict_voting)
-      12              :     {
-      13              : 
-      14          324 :     };
-      15              :     const std::string ENSEMBLE_NOT_FITTED = "Ensemble has not been fitted";
-      16           40 :     void Ensemble::trainModel(const torch::Tensor& weights)
-      17              :     {
-      18           40 :         n_models = models.size();
-      19          660 :         for (auto i = 0; i < n_models; ++i) {
-      20              :             // fit with std::vectors
-      21          620 :             models[i]->fit(dataset, features, className, states);
-      22              :         }
-      23           40 :     }
-      24           56 :     std::vector<int> Ensemble::compute_arg_max(std::vector<std::vector<double>>& X)
-      25              :     {
-      26           56 :         std::vector<int> y_pred;
-      27        12400 :         for (auto i = 0; i < X.size(); ++i) {
-      28        12344 :             auto max = std::max_element(X[i].begin(), X[i].end());
-      29        24688 :             y_pred.push_back(std::distance(X[i].begin(), max));
-      30              :         }
-      31          112 :         return y_pred;
-      32           56 :     }
-      33          424 :     torch::Tensor Ensemble::compute_arg_max(torch::Tensor& X)
-      34              :     {
-      35          424 :         auto y_pred = torch::argmax(X, 1);
-      36          848 :         return y_pred;
-      37          424 :     }
-      38          164 :     torch::Tensor Ensemble::voting(torch::Tensor& votes)
-      39              :     {
-      40              :         // Convert m x n_models tensor to a m x n_class_states with voting probabilities
-      41          164 :         auto y_pred_ = votes.accessor<int, 2>();
-      42          164 :         std::vector<int> y_pred_final;
-      43          164 :         int numClasses = states.at(className).size();
-      44              :         // votes is m x n_models with the prediction of every model for each sample
-      45          164 :         auto result = torch::zeros({ votes.size(0), numClasses }, torch::kFloat32);
-      46          164 :         auto sum = std::reduce(significanceModels.begin(), significanceModels.end());
-      47        42084 :         for (int i = 0; i < votes.size(0); ++i) {
-      48              :             // n_votes store in each index (value of class) the significance added by each model
-      49              :             // i.e. n_votes[0] contains how much value has the value 0 of class. That value is generated by the models predictions
-      50        41920 :             std::vector<double> n_votes(numClasses, 0.0);
-      51       375272 :             for (int j = 0; j < n_models; ++j) {
-      52       333352 :                 n_votes[y_pred_[i][j]] += significanceModels.at(j);
-      53              :             }
-      54        41920 :             result[i] = torch::tensor(n_votes);
-      55        41920 :         }
-      56              :         // To only do one division and gain precision
-      57          164 :         result /= sum;
-      58          328 :         return result;
-      59          164 :     }
-      60          100 :     std::vector<std::vector<double>> Ensemble::predict_proba(std::vector<std::vector<int>>& X)
-      61              :     {
-      62          100 :         if (!fitted) {
-      63           24 :             throw std::logic_error(ENSEMBLE_NOT_FITTED);
-      64              :         }
-      65           76 :         return predict_voting ? predict_average_voting(X) : predict_average_proba(X);
-      66              :     }
-      67          452 :     torch::Tensor Ensemble::predict_proba(torch::Tensor& X)
-      68              :     {
-      69          452 :         if (!fitted) {
-      70           24 :             throw std::logic_error(ENSEMBLE_NOT_FITTED);
-      71              :         }
-      72          428 :         return predict_voting ? predict_average_voting(X) : predict_average_proba(X);
-      73              :     }
-      74           68 :     std::vector<int> Ensemble::predict(std::vector<std::vector<int>>& X)
-      75              :     {
-      76           68 :         auto res = predict_proba(X);
-      77          104 :         return compute_arg_max(res);
-      78           52 :     }
-      79          436 :     torch::Tensor Ensemble::predict(torch::Tensor& X)
-      80              :     {
-      81          436 :         auto res = predict_proba(X);
-      82          840 :         return compute_arg_max(res);
-      83          420 :     }
-      84          296 :     torch::Tensor Ensemble::predict_average_proba(torch::Tensor& X)
-      85              :     {
-      86          296 :         auto n_states = models[0]->getClassNumStates();
-      87          296 :         torch::Tensor y_pred = torch::zeros({ X.size(1), n_states }, torch::kFloat32);
-      88          296 :         auto threads{ std::vector<std::thread>() };
-      89          296 :         std::mutex mtx;
-      90         1764 :         for (auto i = 0; i < n_models; ++i) {
-      91         1468 :             threads.push_back(std::thread([&, i]() {
-      92         1468 :                 auto ypredict = models[i]->predict_proba(X);
-      93         1468 :                 std::lock_guard<std::mutex> lock(mtx);
-      94         1468 :                 y_pred += ypredict * significanceModels[i];
-      95         1468 :                 }));
-      96              :         }
-      97         1764 :         for (auto& thread : threads) {
-      98         1468 :             thread.join();
-      99              :         }
-     100          296 :         auto sum = std::reduce(significanceModels.begin(), significanceModels.end());
-     101          296 :         y_pred /= sum;
-     102          592 :         return y_pred;
-     103          296 :     }
-     104           44 :     std::vector<std::vector<double>> Ensemble::predict_average_proba(std::vector<std::vector<int>>& X)
-     105              :     {
-     106           44 :         auto n_states = models[0]->getClassNumStates();
-     107           44 :         std::vector<std::vector<double>> y_pred(X[0].size(), std::vector<double>(n_states, 0.0));
-     108           44 :         auto threads{ std::vector<std::thread>() };
-     109           44 :         std::mutex mtx;
-     110          576 :         for (auto i = 0; i < n_models; ++i) {
-     111          532 :             threads.push_back(std::thread([&, i]() {
-     112          532 :                 auto ypredict = models[i]->predict_proba(X);
-     113          532 :                 assert(ypredict.size() == y_pred.size());
-     114          532 :                 assert(ypredict[0].size() == y_pred[0].size());
-     115          532 :                 std::lock_guard<std::mutex> lock(mtx);
-     116              :                 // Multiply each prediction by the significance of the model and then add it to the final prediction
-     117       110284 :                 for (auto j = 0; j < ypredict.size(); ++j) {
-     118       109752 :                     std::transform(y_pred[j].begin(), y_pred[j].end(), ypredict[j].begin(), y_pred[j].begin(),
-     119       739464 :                         [significanceModels = significanceModels[i]](double x, double y) { return x + y * significanceModels; });
-     120              :                 }
-     121          532 :                 }));
-     122              :         }
-     123          576 :         for (auto& thread : threads) {
-     124          532 :             thread.join();
-     125              :         }
-     126           44 :         auto sum = std::reduce(significanceModels.begin(), significanceModels.end());
-     127              :         //Divide each element of the prediction by the sum of the significances
-     128         8436 :         for (auto j = 0; j < y_pred.size(); ++j) {
-     129        51544 :             std::transform(y_pred[j].begin(), y_pred[j].end(), y_pred[j].begin(), [sum](double x) { return x / sum; });
-     130              :         }
-     131           88 :         return y_pred;
-     132           44 :     }
-     133           32 :     std::vector<std::vector<double>> Ensemble::predict_average_voting(std::vector<std::vector<int>>& X)
-     134              :     {
-     135           32 :         torch::Tensor Xt = bayesnet::vectorToTensor(X, false);
-     136           32 :         auto y_pred = predict_average_voting(Xt);
-     137           32 :         std::vector<std::vector<double>> result = tensorToVectorDouble(y_pred);
-     138           64 :         return result;
-     139           32 :     }
-     140          164 :     torch::Tensor Ensemble::predict_average_voting(torch::Tensor& X)
-     141              :     {
-     142              :         // Build a m x n_models tensor with the predictions of each model
-     143          164 :         torch::Tensor y_pred = torch::zeros({ X.size(1), n_models }, torch::kInt32);
-     144          164 :         auto threads{ std::vector<std::thread>() };
-     145          164 :         std::mutex mtx;
-     146         1380 :         for (auto i = 0; i < n_models; ++i) {
-     147         1216 :             threads.push_back(std::thread([&, i]() {
-     148         1216 :                 auto ypredict = models[i]->predict(X);
-     149         1216 :                 std::lock_guard<std::mutex> lock(mtx);
-     150         3648 :                 y_pred.index_put_({ "...", i }, ypredict);
-     151         2432 :                 }));
-     152              :         }
-     153         1380 :         for (auto& thread : threads) {
-     154         1216 :             thread.join();
-     155              :         }
-     156          328 :         return voting(y_pred);
-     157          164 :     }
-     158           80 :     float Ensemble::score(torch::Tensor& X, torch::Tensor& y)
-     159              :     {
-     160           80 :         auto y_pred = predict(X);
-     161           72 :         int correct = 0;
-     162        22584 :         for (int i = 0; i < y_pred.size(0); ++i) {
-     163        22512 :             if (y_pred[i].item<int>() == y[i].item<int>()) {
-     164        19668 :                 correct++;
-     165              :             }
-     166              :         }
-     167          144 :         return (double)correct / y_pred.size(0);
-     168           72 :     }
-     169           52 :     float Ensemble::score(std::vector<std::vector<int>>& X, std::vector<int>& y)
-     170              :     {
-     171           52 :         auto y_pred = predict(X);
-     172           44 :         int correct = 0;
-     173        11164 :         for (int i = 0; i < y_pred.size(); ++i) {
-     174        11120 :             if (y_pred[i] == y[i]) {
-     175         9276 :                 correct++;
-     176              :             }
-     177              :         }
-     178           88 :         return (double)correct / y_pred.size();
-     179           44 :     }
-     180            4 :     std::vector<std::string> Ensemble::show() const
-     181              :     {
-     182            4 :         auto result = std::vector<std::string>();
-     183           20 :         for (auto i = 0; i < n_models; ++i) {
-     184           16 :             auto res = models[i]->show();
-     185           16 :             result.insert(result.end(), res.begin(), res.end());
-     186           16 :         }
-     187            8 :         return result;
-     188            4 :     }
-     189           16 :     std::vector<std::string> Ensemble::graph(const std::string& title) const
-     190              :     {
-     191           16 :         auto result = std::vector<std::string>();
-     192          108 :         for (auto i = 0; i < n_models; ++i) {
-     193           92 :             auto res = models[i]->graph(title + "_" + std::to_string(i));
-     194           92 :             result.insert(result.end(), res.begin(), res.end());
-     195           92 :         }
-     196           32 :         return result;
-     197           16 :     }
-     198           28 :     int Ensemble::getNumberOfNodes() const
-     199              :     {
-     200           28 :         int nodes = 0;
-     201          348 :         for (auto i = 0; i < n_models; ++i) {
-     202          320 :             nodes += models[i]->getNumberOfNodes();
-     203              :         }
-     204           28 :         return nodes;
-     205              :     }
-     206           28 :     int Ensemble::getNumberOfEdges() const
-     207              :     {
-     208           28 :         int edges = 0;
-     209          348 :         for (auto i = 0; i < n_models; ++i) {
-     210          320 :             edges += models[i]->getNumberOfEdges();
-     211              :         }
-     212           28 :         return edges;
-     213              :     }
-     214            4 :     int Ensemble::getNumberOfStates() const
-     215              :     {
-     216            4 :         int nstates = 0;
-     217           20 :         for (auto i = 0; i < n_models; ++i) {
-     218           16 :             nstates += models[i]->getNumberOfStates();
-     219              :         }
-     220            4 :         return nstates;
-     221              :     }
-     222              : }
-        
-
-
- - - - -
Generated by: LCOV version 2.0-1
-
- - - diff --git a/html/bayesnet/ensembles/Ensemble.cc.gcov.overview.html b/html/bayesnet/ensembles/Ensemble.cc.gcov.overview.html deleted file mode 100644 index 8f27468..0000000 --- a/html/bayesnet/ensembles/Ensemble.cc.gcov.overview.html +++ /dev/null @@ -1,76 +0,0 @@ - - - - - - LCOV - BayesNet Coverage Report - bayesnet/ensembles/Ensemble.cc - - - - - - - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - - -
- Top

- Overview -
- - diff --git a/html/bayesnet/ensembles/Ensemble.cc.gcov.png b/html/bayesnet/ensembles/Ensemble.cc.gcov.png deleted file mode 100644 index 5c1d1c7..0000000 Binary files a/html/bayesnet/ensembles/Ensemble.cc.gcov.png and /dev/null differ diff --git a/html/bayesnet/ensembles/Ensemble.h.func-c.html b/html/bayesnet/ensembles/Ensemble.h.func-c.html deleted file mode 100644 index a1cf1a8..0000000 --- a/html/bayesnet/ensembles/Ensemble.h.func-c.html +++ /dev/null @@ -1,104 +0,0 @@ - - - - - - - LCOV - BayesNet Coverage Report - bayesnet/ensembles/Ensemble.h - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - bayesnet/ensembles - Ensemble.h (source / functions)CoverageTotalHit
Test:BayesNet Coverage ReportLines:100.0 %55
Test Date:2024-05-06 17:54:04Functions:100.0 %33
Legend: Lines: - hit - not hit -
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Function Name Sort by function nameHit count Sort by function hit count
bayesnet::Ensemble::dump_cpt[abi:cxx11]() const8
bayesnet::Ensemble::topological_order[abi:cxx11]()12
bayesnet::Ensemble::~Ensemble()124
-
-
- - - -
Generated by: LCOV version 2.0-1
-
- - - diff --git a/html/bayesnet/ensembles/Ensemble.h.func.html b/html/bayesnet/ensembles/Ensemble.h.func.html deleted file mode 100644 index d0e8f25..0000000 --- a/html/bayesnet/ensembles/Ensemble.h.func.html +++ /dev/null @@ -1,104 +0,0 @@ - - - - - - - LCOV - BayesNet Coverage Report - bayesnet/ensembles/Ensemble.h - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - bayesnet/ensembles - Ensemble.h (source / functions)CoverageTotalHit
Test:BayesNet Coverage ReportLines:100.0 %55
Test Date:2024-05-06 17:54:04Functions:100.0 %33
Legend: Lines: - hit - not hit -
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Function Name Sort by function nameHit count Sort by function hit count
bayesnet::Ensemble::dump_cpt[abi:cxx11]() const8
bayesnet::Ensemble::topological_order[abi:cxx11]()12
bayesnet::Ensemble::~Ensemble()124
-
-
- - - -
Generated by: LCOV version 2.0-1
-
- - - diff --git a/html/bayesnet/ensembles/Ensemble.h.gcov.frameset.html b/html/bayesnet/ensembles/Ensemble.h.gcov.frameset.html deleted file mode 100644 index e552355..0000000 --- a/html/bayesnet/ensembles/Ensemble.h.gcov.frameset.html +++ /dev/null @@ -1,19 +0,0 @@ - - - - - - - LCOV - BayesNet Coverage Report - bayesnet/ensembles/Ensemble.h - - - - - - - - <center>Frames not supported by your browser!<br></center> - - - - diff --git a/html/bayesnet/ensembles/Ensemble.h.gcov.html b/html/bayesnet/ensembles/Ensemble.h.gcov.html deleted file mode 100644 index e0df189..0000000 --- a/html/bayesnet/ensembles/Ensemble.h.gcov.html +++ /dev/null @@ -1,137 +0,0 @@ - - - - - - - LCOV - BayesNet Coverage Report - bayesnet/ensembles/Ensemble.h - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - bayesnet/ensembles - Ensemble.h (source / functions)CoverageTotalHit
Test:BayesNet Coverage ReportLines:100.0 %55
Test Date:2024-05-06 17:54:04Functions:100.0 %33
Legend: Lines: - hit - not hit -
-
- - - - - - - - -

-
            Line data    Source code
-
-       1              : // ***************************************************************
-       2              : // SPDX-FileCopyrightText: Copyright 2024 Ricardo Montañana Gómez
-       3              : // SPDX-FileType: SOURCE
-       4              : // SPDX-License-Identifier: MIT
-       5              : // ***************************************************************
-       6              : 
-       7              : #ifndef ENSEMBLE_H
-       8              : #define ENSEMBLE_H
-       9              : #include <torch/torch.h>
-      10              : #include "bayesnet/utils/BayesMetrics.h"
-      11              : #include "bayesnet/utils/bayesnetUtils.h"
-      12              : #include "bayesnet/classifiers/Classifier.h"
-      13              : 
-      14              : namespace bayesnet {
-      15              :     class Ensemble : public Classifier {
-      16              :     public:
-      17              :         Ensemble(bool predict_voting = true);
-      18          124 :         virtual ~Ensemble() = default;
-      19              :         torch::Tensor predict(torch::Tensor& X) override;
-      20              :         std::vector<int> predict(std::vector<std::vector<int>>& X) override;
-      21              :         torch::Tensor predict_proba(torch::Tensor& X) override;
-      22              :         std::vector<std::vector<double>> predict_proba(std::vector<std::vector<int>>& X) override;
-      23              :         float score(torch::Tensor& X, torch::Tensor& y) override;
-      24              :         float score(std::vector<std::vector<int>>& X, std::vector<int>& y) override;
-      25              :         int getNumberOfNodes() const override;
-      26              :         int getNumberOfEdges() const override;
-      27              :         int getNumberOfStates() const override;
-      28              :         std::vector<std::string> show() const override;
-      29              :         std::vector<std::string> graph(const std::string& title) const override;
-      30           12 :         std::vector<std::string> topological_order()  override
-      31              :         {
-      32           12 :             return std::vector<std::string>();
-      33              :         }
-      34            8 :         std::string dump_cpt() const override
-      35              :         {
-      36           16 :             return "";
-      37              :         }
-      38              :     protected:
-      39              :         torch::Tensor predict_average_voting(torch::Tensor& X);
-      40              :         std::vector<std::vector<double>> predict_average_voting(std::vector<std::vector<int>>& X);
-      41              :         torch::Tensor predict_average_proba(torch::Tensor& X);
-      42              :         std::vector<std::vector<double>> predict_average_proba(std::vector<std::vector<int>>& X);
-      43              :         torch::Tensor compute_arg_max(torch::Tensor& X);
-      44              :         std::vector<int> compute_arg_max(std::vector<std::vector<double>>& X);
-      45              :         torch::Tensor voting(torch::Tensor& votes);
-      46              :         unsigned n_models;
-      47              :         std::vector<std::unique_ptr<Classifier>> models;
-      48              :         std::vector<double> significanceModels;
-      49              :         void trainModel(const torch::Tensor& weights) override;
-      50              :         bool predict_voting;
-      51              :     };
-      52              : }
-      53              : #endif
-        
-
-
- - - - -
Generated by: LCOV version 2.0-1
-
- - - diff --git a/html/bayesnet/ensembles/Ensemble.h.gcov.overview.html b/html/bayesnet/ensembles/Ensemble.h.gcov.overview.html deleted file mode 100644 index 494a8f3..0000000 --- a/html/bayesnet/ensembles/Ensemble.h.gcov.overview.html +++ /dev/null @@ -1,34 +0,0 @@ - - - - - - LCOV - BayesNet Coverage Report - bayesnet/ensembles/Ensemble.h - - - - - - - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - - -
- Top

- Overview -
- - diff --git a/html/bayesnet/ensembles/Ensemble.h.gcov.png b/html/bayesnet/ensembles/Ensemble.h.gcov.png deleted file mode 100644 index ade5586..0000000 Binary files a/html/bayesnet/ensembles/Ensemble.h.gcov.png and /dev/null differ diff --git a/html/bayesnet/ensembles/index-detail-sort-f.html b/html/bayesnet/ensembles/index-detail-sort-f.html deleted file mode 100644 index dc31de1..0000000 --- a/html/bayesnet/ensembles/index-detail-sort-f.html +++ /dev/null @@ -1,222 +0,0 @@ - - - - - - - LCOV - BayesNet Coverage Report - bayesnet/ensembles - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - bayesnet/ensemblesCoverageTotalHit
Test:BayesNet Coverage ReportLines:99.1 %468464
Test Date:2024-05-06 17:54:04Functions:100.0 %5454
Legend: Rating: - low: < 75 % - medium: >= 75 % - high: >= 90 % -
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Filename Sort by file nameLine Coverage ( show details ) Sort by line coverageFunction Coverage Sort by function coverage
Rate Total Hit Rate Total Hit
A2DE.h -
100.0%
-
100.0 %11100.0 %11
AODE.h -
100.0%
-
100.0 %11100.0 %11
AODELd.h -
100.0%
-
100.0 %11100.0 %11
BoostAODE.h -
100.0%
-
100.0 %11100.0 %11
Ensemble.h -
100.0%
-
100.0 %55100.0 %33
A2DE.cc -
100.0%
-
100.0 %2323100.0 %44
AODE.cc -
100.0%
-
100.0 %2020100.0 %44
AODELd.cc -
100.0%
-
100.0 %2424100.0 %55
BoostAODE.cc -
98.3%98.3%
-
98.3 %237233100.0 %99
Ensemble.cc -
100.0%
-
100.0 %155155100.0 %2525
-
-
- - - - -
Generated by: LCOV version 2.0-1
-
- - - diff --git a/html/bayesnet/ensembles/index-detail-sort-l.html b/html/bayesnet/ensembles/index-detail-sort-l.html deleted file mode 100644 index 3871cd2..0000000 --- a/html/bayesnet/ensembles/index-detail-sort-l.html +++ /dev/null @@ -1,222 +0,0 @@ - - - - - - - LCOV - BayesNet Coverage Report - bayesnet/ensembles - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - bayesnet/ensemblesCoverageTotalHit
Test:BayesNet Coverage ReportLines:99.1 %468464
Test Date:2024-05-06 17:54:04Functions:100.0 %5454
Legend: Rating: - low: < 75 % - medium: >= 75 % - high: >= 90 % -
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Filename Sort by file nameLine Coverage ( show details ) Sort by line coverageFunction Coverage Sort by function coverage
Rate Total Hit Rate Total Hit
BoostAODE.cc -
98.3%98.3%
-
98.3 %237233100.0 %99
A2DE.h -
100.0%
-
100.0 %11100.0 %11
AODE.h -
100.0%
-
100.0 %11100.0 %11
AODELd.h -
100.0%
-
100.0 %11100.0 %11
BoostAODE.h -
100.0%
-
100.0 %11100.0 %11
Ensemble.h -
100.0%
-
100.0 %55100.0 %33
AODE.cc -
100.0%
-
100.0 %2020100.0 %44
A2DE.cc -
100.0%
-
100.0 %2323100.0 %44
AODELd.cc -
100.0%
-
100.0 %2424100.0 %55
Ensemble.cc -
100.0%
-
100.0 %155155100.0 %2525
-
-
- - - - -
Generated by: LCOV version 2.0-1
-
- - - diff --git a/html/bayesnet/ensembles/index-detail.html b/html/bayesnet/ensembles/index-detail.html deleted file mode 100644 index 2f18267..0000000 --- a/html/bayesnet/ensembles/index-detail.html +++ /dev/null @@ -1,222 +0,0 @@ - - - - - - - LCOV - BayesNet Coverage Report - bayesnet/ensembles - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - bayesnet/ensemblesCoverageTotalHit
Test:BayesNet Coverage ReportLines:99.1 %468464
Test Date:2024-05-06 17:54:04Functions:100.0 %5454
Legend: Rating: - low: < 75 % - medium: >= 75 % - high: >= 90 % -
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Filename Sort by file nameLine Coverage ( show details ) Sort by line coverageFunction Coverage Sort by function coverage
Rate Total Hit Rate Total Hit
A2DE.cc -
100.0%
-
100.0 %2323100.0 %44
A2DE.h -
100.0%
-
100.0 %11100.0 %11
AODE.cc -
100.0%
-
100.0 %2020100.0 %44
AODE.h -
100.0%
-
100.0 %11100.0 %11
AODELd.cc -
100.0%
-
100.0 %2424100.0 %55
AODELd.h -
100.0%
-
100.0 %11100.0 %11
BoostAODE.cc -
98.3%98.3%
-
98.3 %237233100.0 %99
BoostAODE.h -
100.0%
-
100.0 %11100.0 %11
Ensemble.cc -
100.0%
-
100.0 %155155100.0 %2525
Ensemble.h -
100.0%
-
100.0 %55100.0 %33
-
-
- - - - -
Generated by: LCOV version 2.0-1
-
- - - diff --git a/html/bayesnet/ensembles/index-sort-f.html b/html/bayesnet/ensembles/index-sort-f.html deleted file mode 100644 index dc31de1..0000000 --- a/html/bayesnet/ensembles/index-sort-f.html +++ /dev/null @@ -1,222 +0,0 @@ - - - - - - - LCOV - BayesNet Coverage Report - bayesnet/ensembles - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - bayesnet/ensemblesCoverageTotalHit
Test:BayesNet Coverage ReportLines:99.1 %468464
Test Date:2024-05-06 17:54:04Functions:100.0 %5454
Legend: Rating: - low: < 75 % - medium: >= 75 % - high: >= 90 % -
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Filename Sort by file nameLine Coverage ( show details ) Sort by line coverageFunction Coverage Sort by function coverage
Rate Total Hit Rate Total Hit
A2DE.h -
100.0%
-
100.0 %11100.0 %11
AODE.h -
100.0%
-
100.0 %11100.0 %11
AODELd.h -
100.0%
-
100.0 %11100.0 %11
BoostAODE.h -
100.0%
-
100.0 %11100.0 %11
Ensemble.h -
100.0%
-
100.0 %55100.0 %33
A2DE.cc -
100.0%
-
100.0 %2323100.0 %44
AODE.cc -
100.0%
-
100.0 %2020100.0 %44
AODELd.cc -
100.0%
-
100.0 %2424100.0 %55
BoostAODE.cc -
98.3%98.3%
-
98.3 %237233100.0 %99
Ensemble.cc -
100.0%
-
100.0 %155155100.0 %2525
-
-
- - - - -
Generated by: LCOV version 2.0-1
-
- - - diff --git a/html/bayesnet/ensembles/index-sort-l.html b/html/bayesnet/ensembles/index-sort-l.html deleted file mode 100644 index 3871cd2..0000000 --- a/html/bayesnet/ensembles/index-sort-l.html +++ /dev/null @@ -1,222 +0,0 @@ - - - - - - - LCOV - BayesNet Coverage Report - bayesnet/ensembles - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - bayesnet/ensemblesCoverageTotalHit
Test:BayesNet Coverage ReportLines:99.1 %468464
Test Date:2024-05-06 17:54:04Functions:100.0 %5454
Legend: Rating: - low: < 75 % - medium: >= 75 % - high: >= 90 % -
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Filename Sort by file nameLine Coverage ( show details ) Sort by line coverageFunction Coverage Sort by function coverage
Rate Total Hit Rate Total Hit
BoostAODE.cc -
98.3%98.3%
-
98.3 %237233100.0 %99
A2DE.h -
100.0%
-
100.0 %11100.0 %11
AODE.h -
100.0%
-
100.0 %11100.0 %11
AODELd.h -
100.0%
-
100.0 %11100.0 %11
BoostAODE.h -
100.0%
-
100.0 %11100.0 %11
Ensemble.h -
100.0%
-
100.0 %55100.0 %33
AODE.cc -
100.0%
-
100.0 %2020100.0 %44
A2DE.cc -
100.0%
-
100.0 %2323100.0 %44
AODELd.cc -
100.0%
-
100.0 %2424100.0 %55
Ensemble.cc -
100.0%
-
100.0 %155155100.0 %2525
-
-
- - - - -
Generated by: LCOV version 2.0-1
-
- - - diff --git a/html/bayesnet/ensembles/index.html b/html/bayesnet/ensembles/index.html deleted file mode 100644 index 2f18267..0000000 --- a/html/bayesnet/ensembles/index.html +++ /dev/null @@ -1,222 +0,0 @@ - - - - - - - LCOV - BayesNet Coverage Report - bayesnet/ensembles - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - bayesnet/ensemblesCoverageTotalHit
Test:BayesNet Coverage ReportLines:99.1 %468464
Test Date:2024-05-06 17:54:04Functions:100.0 %5454
Legend: Rating: - low: < 75 % - medium: >= 75 % - high: >= 90 % -
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Filename Sort by file nameLine Coverage ( show details ) Sort by line coverageFunction Coverage Sort by function coverage
Rate Total Hit Rate Total Hit
A2DE.cc -
100.0%
-
100.0 %2323100.0 %44
A2DE.h -
100.0%
-
100.0 %11100.0 %11
AODE.cc -
100.0%
-
100.0 %2020100.0 %44
AODE.h -
100.0%
-
100.0 %11100.0 %11
AODELd.cc -
100.0%
-
100.0 %2424100.0 %55
AODELd.h -
100.0%
-
100.0 %11100.0 %11
BoostAODE.cc -
98.3%98.3%
-
98.3 %237233100.0 %99
BoostAODE.h -
100.0%
-
100.0 %11100.0 %11
Ensemble.cc -
100.0%
-
100.0 %155155100.0 %2525
Ensemble.h -
100.0%
-
100.0 %55100.0 %33
-
-
- - - - -
Generated by: LCOV version 2.0-1
-
- - - diff --git a/html/bayesnet/feature_selection/CFS.cc.func-c.html b/html/bayesnet/feature_selection/CFS.cc.func-c.html deleted file mode 100644 index f592051..0000000 --- a/html/bayesnet/feature_selection/CFS.cc.func-c.html +++ /dev/null @@ -1,97 +0,0 @@ - - - - - - - LCOV - BayesNet Coverage Report - bayesnet/feature_selection/CFS.cc - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - bayesnet/feature_selection - CFS.cc (source / functions)CoverageTotalHit
Test:BayesNet Coverage ReportLines:97.8 %4544
Test Date:2024-05-06 17:54:04Functions:100.0 %22
Legend: Lines: - hit - not hit -
-
- -
- - - - - - - - - - - - - - - - - - - - - - - -

Function Name Sort by function nameHit count Sort by function hit count
bayesnet::CFS::fit()48
bayesnet::CFS::computeContinueCondition(std::vector<int, std::allocator<int> > const&)220
-
-
- - - -
Generated by: LCOV version 2.0-1
-
- - - diff --git a/html/bayesnet/feature_selection/CFS.cc.func.html b/html/bayesnet/feature_selection/CFS.cc.func.html deleted file mode 100644 index 08a008e..0000000 --- a/html/bayesnet/feature_selection/CFS.cc.func.html +++ /dev/null @@ -1,97 +0,0 @@ - - - - - - - LCOV - BayesNet Coverage Report - bayesnet/feature_selection/CFS.cc - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - bayesnet/feature_selection - CFS.cc (source / functions)CoverageTotalHit
Test:BayesNet Coverage ReportLines:97.8 %4544
Test Date:2024-05-06 17:54:04Functions:100.0 %22
Legend: Lines: - hit - not hit -
-
- -
- - - - - - - - - - - - - - - - - - - - - - - -

Function Name Sort by function nameHit count Sort by function hit count
bayesnet::CFS::computeContinueCondition(std::vector<int, std::allocator<int> > const&)220
bayesnet::CFS::fit()48
-
-
- - - -
Generated by: LCOV version 2.0-1
-
- - - diff --git a/html/bayesnet/feature_selection/CFS.cc.gcov.frameset.html b/html/bayesnet/feature_selection/CFS.cc.gcov.frameset.html deleted file mode 100644 index 588ad50..0000000 --- a/html/bayesnet/feature_selection/CFS.cc.gcov.frameset.html +++ /dev/null @@ -1,19 +0,0 @@ - - - - - - - LCOV - BayesNet Coverage Report - bayesnet/feature_selection/CFS.cc - - - - - - - - <center>Frames not supported by your browser!<br></center> - - - - diff --git a/html/bayesnet/feature_selection/CFS.cc.gcov.html b/html/bayesnet/feature_selection/CFS.cc.gcov.html deleted file mode 100644 index 8b25468..0000000 --- a/html/bayesnet/feature_selection/CFS.cc.gcov.html +++ /dev/null @@ -1,162 +0,0 @@ - - - - - - - LCOV - BayesNet Coverage Report - bayesnet/feature_selection/CFS.cc - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - bayesnet/feature_selection - CFS.cc (source / functions)CoverageTotalHit
Test:BayesNet Coverage ReportLines:97.8 %4544
Test Date:2024-05-06 17:54:04Functions:100.0 %22
Legend: Lines: - hit - not hit -
-
- - - - - - - - -

-
            Line data    Source code
-
-       1              : // ***************************************************************
-       2              : // SPDX-FileCopyrightText: Copyright 2024 Ricardo Montañana Gómez
-       3              : // SPDX-FileType: SOURCE
-       4              : // SPDX-License-Identifier: MIT
-       5              : // ***************************************************************
-       6              : 
-       7              : #include <limits>
-       8              : #include "bayesnet/utils/bayesnetUtils.h"
-       9              : #include "CFS.h"
-      10              : namespace bayesnet {
-      11           48 :     void CFS::fit()
-      12              :     {
-      13           48 :         initialize();
-      14           48 :         computeSuLabels();
-      15           48 :         auto featureOrder = argsort(suLabels); // sort descending order
-      16           48 :         auto continueCondition = true;
-      17           48 :         auto feature = featureOrder[0];
-      18           48 :         selectedFeatures.push_back(feature);
-      19           48 :         selectedScores.push_back(suLabels[feature]);
-      20           48 :         featureOrder.erase(featureOrder.begin());
-      21          268 :         while (continueCondition) {
-      22          220 :             double merit = std::numeric_limits<double>::lowest();
-      23          220 :             int bestFeature = -1;
-      24         1250 :             for (auto feature : featureOrder) {
-      25         1030 :                 selectedFeatures.push_back(feature);
-      26              :                 // Compute merit with selectedFeatures
-      27         1030 :                 auto meritNew = computeMeritCFS();
-      28         1030 :                 if (meritNew > merit) {
-      29          450 :                     merit = meritNew;
-      30          450 :                     bestFeature = feature;
-      31              :                 }
-      32         1030 :                 selectedFeatures.pop_back();
-      33              :             }
-      34          220 :             if (bestFeature == -1) {
-      35              :                 // meritNew has to be nan due to constant features
-      36            0 :                 break;
-      37              :             }
-      38          220 :             selectedFeatures.push_back(bestFeature);
-      39          220 :             selectedScores.push_back(merit);
-      40          220 :             featureOrder.erase(remove(featureOrder.begin(), featureOrder.end(), bestFeature), featureOrder.end());
-      41          220 :             continueCondition = computeContinueCondition(featureOrder);
-      42              :         }
-      43           48 :         fitted = true;
-      44           48 :     }
-      45          220 :     bool CFS::computeContinueCondition(const std::vector<int>& featureOrder)
-      46              :     {
-      47          220 :         if (selectedFeatures.size() == maxFeatures || featureOrder.size() == 0) {
-      48           10 :             return false;
-      49              :         }
-      50          210 :         if (selectedScores.size() >= 5) {
-      51              :             /*
-      52              :             "To prevent the best first search from exploring the entire
-      53              :             feature subset search space, a stopping criterion is imposed.
-      54              :             The search will terminate if five consecutive fully expanded
-      55              :             subsets show no improvement over the current best subset."
-      56              :             as stated in Mark A.Hall Thesis
-      57              :             */
-      58           76 :             double item_ant = std::numeric_limits<double>::lowest();
-      59           76 :             int num = 0;
-      60           76 :             std::vector<double> lastFive(selectedScores.end() - 5, selectedScores.end());
-      61          304 :             for (auto item : lastFive) {
-      62          266 :                 if (item_ant == std::numeric_limits<double>::lowest()) {
-      63           76 :                     item_ant = item;
-      64              :                 }
-      65          266 :                 if (item > item_ant) {
-      66           38 :                     break;
-      67              :                 } else {
-      68          228 :                     num++;
-      69          228 :                     item_ant = item;
-      70              :                 }
-      71              :             }
-      72           76 :             if (num == 5) {
-      73           38 :                 return false;
-      74              :             }
-      75           76 :         }
-      76          172 :         return true;
-      77              :     }
-      78              : }
-        
-
-
- - - - -
Generated by: LCOV version 2.0-1
-
- - - diff --git a/html/bayesnet/feature_selection/CFS.cc.gcov.overview.html b/html/bayesnet/feature_selection/CFS.cc.gcov.overview.html deleted file mode 100644 index dd09ca9..0000000 --- a/html/bayesnet/feature_selection/CFS.cc.gcov.overview.html +++ /dev/null @@ -1,40 +0,0 @@ - - - - - - LCOV - BayesNet Coverage Report - bayesnet/feature_selection/CFS.cc - - - - - - - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - - -
- Top

- Overview -
- - diff --git a/html/bayesnet/feature_selection/CFS.cc.gcov.png b/html/bayesnet/feature_selection/CFS.cc.gcov.png deleted file mode 100644 index c4f8398..0000000 Binary files a/html/bayesnet/feature_selection/CFS.cc.gcov.png and /dev/null differ diff --git a/html/bayesnet/feature_selection/CFS.h.func-c.html b/html/bayesnet/feature_selection/CFS.h.func-c.html deleted file mode 100644 index 88141b1..0000000 --- a/html/bayesnet/feature_selection/CFS.h.func-c.html +++ /dev/null @@ -1,97 +0,0 @@ - - - - - - - LCOV - BayesNet Coverage Report - bayesnet/feature_selection/CFS.h - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - bayesnet/feature_selection - CFS.h (source / functions)CoverageTotalHit
Test:BayesNet Coverage ReportLines:100.0 %44
Test Date:2024-05-06 17:54:04Functions:100.0 %22
Legend: Lines: - hit - not hit -
-
- -
- - - - - - - - - - - - - - - - - - - - - - - -

Function Name Sort by function nameHit count Sort by function hit count
bayesnet::CFS::CFS(at::Tensor const&, std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, int, int, at::Tensor const&)29
bayesnet::CFS::~CFS()116
-
-
- - - -
Generated by: LCOV version 2.0-1
-
- - - diff --git a/html/bayesnet/feature_selection/CFS.h.func.html b/html/bayesnet/feature_selection/CFS.h.func.html deleted file mode 100644 index 25055ab..0000000 --- a/html/bayesnet/feature_selection/CFS.h.func.html +++ /dev/null @@ -1,97 +0,0 @@ - - - - - - - LCOV - BayesNet Coverage Report - bayesnet/feature_selection/CFS.h - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - bayesnet/feature_selection - CFS.h (source / functions)CoverageTotalHit
Test:BayesNet Coverage ReportLines:100.0 %44
Test Date:2024-05-06 17:54:04Functions:100.0 %22
Legend: Lines: - hit - not hit -
-
- -
- - - - - - - - - - - - - - - - - - - - - - - -

Function Name Sort by function nameHit count Sort by function hit count
bayesnet::CFS::CFS(at::Tensor const&, std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, int, int, at::Tensor const&)29
bayesnet::CFS::~CFS()116
-
-
- - - -
Generated by: LCOV version 2.0-1
-
- - - diff --git a/html/bayesnet/feature_selection/CFS.h.gcov.frameset.html b/html/bayesnet/feature_selection/CFS.h.gcov.frameset.html deleted file mode 100644 index ee18ddb..0000000 --- a/html/bayesnet/feature_selection/CFS.h.gcov.frameset.html +++ /dev/null @@ -1,19 +0,0 @@ - - - - - - - LCOV - BayesNet Coverage Report - bayesnet/feature_selection/CFS.h - - - - - - - - <center>Frames not supported by your browser!<br></center> - - - - diff --git a/html/bayesnet/feature_selection/CFS.h.gcov.html b/html/bayesnet/feature_selection/CFS.h.gcov.html deleted file mode 100644 index dcc0e27..0000000 --- a/html/bayesnet/feature_selection/CFS.h.gcov.html +++ /dev/null @@ -1,110 +0,0 @@ - - - - - - - LCOV - BayesNet Coverage Report - bayesnet/feature_selection/CFS.h - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - bayesnet/feature_selection - CFS.h (source / functions)CoverageTotalHit
Test:BayesNet Coverage ReportLines:100.0 %44
Test Date:2024-05-06 17:54:04Functions:100.0 %22
Legend: Lines: - hit - not hit -
-
- - - - - - - - -

-
            Line data    Source code
-
-       1              : // ***************************************************************
-       2              : // SPDX-FileCopyrightText: Copyright 2024 Ricardo Montañana Gómez
-       3              : // SPDX-FileType: SOURCE
-       4              : // SPDX-License-Identifier: MIT
-       5              : // ***************************************************************
-       6              : 
-       7              : #ifndef CFS_H
-       8              : #define CFS_H
-       9              : #include <torch/torch.h>
-      10              : #include <vector>
-      11              : #include "bayesnet/feature_selection/FeatureSelect.h"
-      12              : namespace bayesnet {
-      13              :     class CFS : public FeatureSelect {
-      14              :     public:
-      15              :         // dataset is a n+1xm tensor of integers where dataset[-1] is the y std::vector
-      16           29 :         CFS(const torch::Tensor& samples, const std::vector<std::string>& features, const std::string& className, const int maxFeatures, const int classNumStates, const torch::Tensor& weights) :
-      17           29 :             FeatureSelect(samples, features, className, maxFeatures, classNumStates, weights)
-      18              :         {
-      19           29 :         }
-      20          116 :         virtual ~CFS() {};
-      21              :         void fit() override;
-      22              :     private:
-      23              :         bool computeContinueCondition(const std::vector<int>& featureOrder);
-      24              :     };
-      25              : }
-      26              : #endif
-        
-
-
- - - - -
Generated by: LCOV version 2.0-1
-
- - - diff --git a/html/bayesnet/feature_selection/CFS.h.gcov.overview.html b/html/bayesnet/feature_selection/CFS.h.gcov.overview.html deleted file mode 100644 index 3eec86d..0000000 --- a/html/bayesnet/feature_selection/CFS.h.gcov.overview.html +++ /dev/null @@ -1,27 +0,0 @@ - - - - - - LCOV - BayesNet Coverage Report - bayesnet/feature_selection/CFS.h - - - - - - - overview - overview - overview - overview - overview - overview - overview - - -
- Top

- Overview -
- - diff --git a/html/bayesnet/feature_selection/CFS.h.gcov.png b/html/bayesnet/feature_selection/CFS.h.gcov.png deleted file mode 100644 index 7278b3e..0000000 Binary files a/html/bayesnet/feature_selection/CFS.h.gcov.png and /dev/null differ diff --git a/html/bayesnet/feature_selection/FCBF.cc.func-c.html b/html/bayesnet/feature_selection/FCBF.cc.func-c.html deleted file mode 100644 index b87959a..0000000 --- a/html/bayesnet/feature_selection/FCBF.cc.func-c.html +++ /dev/null @@ -1,97 +0,0 @@ - - - - - - - LCOV - BayesNet Coverage Report - bayesnet/feature_selection/FCBF.cc - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - bayesnet/feature_selection - FCBF.cc (source / functions)CoverageTotalHit
Test:BayesNet Coverage ReportLines:100.0 %2626
Test Date:2024-05-06 17:54:04Functions:100.0 %22
Legend: Lines: - hit - not hit -
-
- -
- - - - - - - - - - - - - - - - - - - - - - - -

Function Name Sort by function nameHit count Sort by function hit count
bayesnet::FCBF::fit()56
bayesnet::FCBF::FCBF(at::Tensor const&, std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, int, int, at::Tensor const&, double)76
-
-
- - - -
Generated by: LCOV version 2.0-1
-
- - - diff --git a/html/bayesnet/feature_selection/FCBF.cc.func.html b/html/bayesnet/feature_selection/FCBF.cc.func.html deleted file mode 100644 index 268b9d7..0000000 --- a/html/bayesnet/feature_selection/FCBF.cc.func.html +++ /dev/null @@ -1,97 +0,0 @@ - - - - - - - LCOV - BayesNet Coverage Report - bayesnet/feature_selection/FCBF.cc - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - bayesnet/feature_selection - FCBF.cc (source / functions)CoverageTotalHit
Test:BayesNet Coverage ReportLines:100.0 %2626
Test Date:2024-05-06 17:54:04Functions:100.0 %22
Legend: Lines: - hit - not hit -
-
- -
- - - - - - - - - - - - - - - - - - - - - - - -

Function Name Sort by function nameHit count Sort by function hit count
bayesnet::FCBF::FCBF(at::Tensor const&, std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, int, int, at::Tensor const&, double)76
bayesnet::FCBF::fit()56
-
-
- - - -
Generated by: LCOV version 2.0-1
-
- - - diff --git a/html/bayesnet/feature_selection/FCBF.cc.gcov.frameset.html b/html/bayesnet/feature_selection/FCBF.cc.gcov.frameset.html deleted file mode 100644 index 4878c98..0000000 --- a/html/bayesnet/feature_selection/FCBF.cc.gcov.frameset.html +++ /dev/null @@ -1,19 +0,0 @@ - - - - - - - LCOV - BayesNet Coverage Report - bayesnet/feature_selection/FCBF.cc - - - - - - - - <center>Frames not supported by your browser!<br></center> - - - - diff --git a/html/bayesnet/feature_selection/FCBF.cc.gcov.html b/html/bayesnet/feature_selection/FCBF.cc.gcov.html deleted file mode 100644 index 8d88c3f..0000000 --- a/html/bayesnet/feature_selection/FCBF.cc.gcov.html +++ /dev/null @@ -1,134 +0,0 @@ - - - - - - - LCOV - BayesNet Coverage Report - bayesnet/feature_selection/FCBF.cc - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - bayesnet/feature_selection - FCBF.cc (source / functions)CoverageTotalHit
Test:BayesNet Coverage ReportLines:100.0 %2626
Test Date:2024-05-06 17:54:04Functions:100.0 %22
Legend: Lines: - hit - not hit -
-
- - - - - - - - -

-
            Line data    Source code
-
-       1              : // ***************************************************************
-       2              : // SPDX-FileCopyrightText: Copyright 2024 Ricardo Montañana Gómez
-       3              : // SPDX-FileType: SOURCE
-       4              : // SPDX-License-Identifier: MIT
-       5              : // ***************************************************************
-       6              : 
-       7              : #include "bayesnet/utils/bayesnetUtils.h"
-       8              : #include "FCBF.h"
-       9              : namespace bayesnet {
-      10              : 
-      11           76 :     FCBF::FCBF(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) :
-      12           76 :         FeatureSelect(samples, features, className, maxFeatures, classNumStates, weights), threshold(threshold)
-      13              :     {
-      14           76 :         if (threshold < 1e-7) {
-      15           20 :             throw std::invalid_argument("Threshold cannot be less than 1e-7");
-      16              :         }
-      17           76 :     }
-      18           56 :     void FCBF::fit()
-      19              :     {
-      20           56 :         initialize();
-      21           56 :         computeSuLabels();
-      22           56 :         auto featureOrder = argsort(suLabels); // sort descending order
-      23           56 :         auto featureOrderCopy = featureOrder;
-      24          419 :         for (const auto& feature : featureOrder) {
-      25              :             // Don't self compare
-      26          372 :             featureOrderCopy.erase(featureOrderCopy.begin());
-      27          372 :             if (suLabels.at(feature) == 0.0) {
-      28              :                 // The feature has been removed from the list
-      29          153 :                 continue;
-      30              :             }
-      31          219 :             if (suLabels.at(feature) < threshold) {
-      32            5 :                 break;
-      33              :             }
-      34              :             // Remove redundant features
-      35         1220 :             for (const auto& featureCopy : featureOrderCopy) {
-      36         1006 :                 double value = computeSuFeatures(feature, featureCopy);
-      37         1006 :                 if (value >= suLabels.at(featureCopy)) {
-      38              :                     // Remove feature from list
-      39          333 :                     suLabels[featureCopy] = 0.0;
-      40              :                 }
-      41              :             }
-      42          214 :             selectedFeatures.push_back(feature);
-      43          214 :             selectedScores.push_back(suLabels[feature]);
-      44          214 :             if (selectedFeatures.size() == maxFeatures) {
-      45            4 :                 break;
-      46              :             }
-      47              :         }
-      48           56 :         fitted = true;
-      49           56 :     }
-      50              : }
-        
-
-
- - - - -
Generated by: LCOV version 2.0-1
-
- - - diff --git a/html/bayesnet/feature_selection/FCBF.cc.gcov.overview.html b/html/bayesnet/feature_selection/FCBF.cc.gcov.overview.html deleted file mode 100644 index daa8e3d..0000000 --- a/html/bayesnet/feature_selection/FCBF.cc.gcov.overview.html +++ /dev/null @@ -1,33 +0,0 @@ - - - - - - LCOV - BayesNet Coverage Report - bayesnet/feature_selection/FCBF.cc - - - - - - - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - - -
- Top

- Overview -
- - diff --git a/html/bayesnet/feature_selection/FCBF.cc.gcov.png b/html/bayesnet/feature_selection/FCBF.cc.gcov.png deleted file mode 100644 index 1a469dc..0000000 Binary files a/html/bayesnet/feature_selection/FCBF.cc.gcov.png and /dev/null differ diff --git a/html/bayesnet/feature_selection/FCBF.h.func-c.html b/html/bayesnet/feature_selection/FCBF.h.func-c.html deleted file mode 100644 index 6966211..0000000 --- a/html/bayesnet/feature_selection/FCBF.h.func-c.html +++ /dev/null @@ -1,90 +0,0 @@ - - - - - - - LCOV - BayesNet Coverage Report - bayesnet/feature_selection/FCBF.h - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - bayesnet/feature_selection - FCBF.h (source / functions)CoverageTotalHit
Test:BayesNet Coverage ReportLines:100.0 %11
Test Date:2024-05-06 17:54:04Functions:100.0 %11
Legend: Lines: - hit - not hit -
-
- -
- - - - - - - - - - - - - - - - -

Function Name Sort by function nameHit count Sort by function hit count
bayesnet::FCBF::~FCBF()56
-
-
- - - -
Generated by: LCOV version 2.0-1
-
- - - diff --git a/html/bayesnet/feature_selection/FCBF.h.func.html b/html/bayesnet/feature_selection/FCBF.h.func.html deleted file mode 100644 index 137b177..0000000 --- a/html/bayesnet/feature_selection/FCBF.h.func.html +++ /dev/null @@ -1,90 +0,0 @@ - - - - - - - LCOV - BayesNet Coverage Report - bayesnet/feature_selection/FCBF.h - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - bayesnet/feature_selection - FCBF.h (source / functions)CoverageTotalHit
Test:BayesNet Coverage ReportLines:100.0 %11
Test Date:2024-05-06 17:54:04Functions:100.0 %11
Legend: Lines: - hit - not hit -
-
- -
- - - - - - - - - - - - - - - - -

Function Name Sort by function nameHit count Sort by function hit count
bayesnet::FCBF::~FCBF()56
-
-
- - - -
Generated by: LCOV version 2.0-1
-
- - - diff --git a/html/bayesnet/feature_selection/FCBF.h.gcov.frameset.html b/html/bayesnet/feature_selection/FCBF.h.gcov.frameset.html deleted file mode 100644 index f36d486..0000000 --- a/html/bayesnet/feature_selection/FCBF.h.gcov.frameset.html +++ /dev/null @@ -1,19 +0,0 @@ - - - - - - - LCOV - BayesNet Coverage Report - bayesnet/feature_selection/FCBF.h - - - - - - - - <center>Frames not supported by your browser!<br></center> - - - - diff --git a/html/bayesnet/feature_selection/FCBF.h.gcov.html b/html/bayesnet/feature_selection/FCBF.h.gcov.html deleted file mode 100644 index 19d3186..0000000 --- a/html/bayesnet/feature_selection/FCBF.h.gcov.html +++ /dev/null @@ -1,107 +0,0 @@ - - - - - - - LCOV - BayesNet Coverage Report - bayesnet/feature_selection/FCBF.h - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - bayesnet/feature_selection - FCBF.h (source / functions)CoverageTotalHit
Test:BayesNet Coverage ReportLines:100.0 %11
Test Date:2024-05-06 17:54:04Functions:100.0 %11
Legend: Lines: - hit - not hit -
-
- - - - - - - - -

-
            Line data    Source code
-
-       1              : // ***************************************************************
-       2              : // SPDX-FileCopyrightText: Copyright 2024 Ricardo Montañana Gómez
-       3              : // SPDX-FileType: SOURCE
-       4              : // SPDX-License-Identifier: MIT
-       5              : // ***************************************************************
-       6              : 
-       7              : #ifndef FCBF_H
-       8              : #define FCBF_H
-       9              : #include <torch/torch.h>
-      10              : #include <vector>
-      11              : #include "bayesnet/feature_selection/FeatureSelect.h"
-      12              : namespace bayesnet {
-      13              :     class FCBF : public FeatureSelect {
-      14              :     public:
-      15              :         // dataset is a n+1xm tensor of integers where dataset[-1] is the y std::vector
-      16              :         FCBF(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);
-      17           56 :         virtual ~FCBF() {};
-      18              :         void fit() override;
-      19              :     private:
-      20              :         double threshold = -1;
-      21              :     };
-      22              : }
-      23              : #endif
-        
-
-
- - - - -
Generated by: LCOV version 2.0-1
-
- - - diff --git a/html/bayesnet/feature_selection/FCBF.h.gcov.overview.html b/html/bayesnet/feature_selection/FCBF.h.gcov.overview.html deleted file mode 100644 index dab5a4c..0000000 --- a/html/bayesnet/feature_selection/FCBF.h.gcov.overview.html +++ /dev/null @@ -1,26 +0,0 @@ - - - - - - LCOV - BayesNet Coverage Report - bayesnet/feature_selection/FCBF.h - - - - - - - overview - overview - overview - overview - overview - overview - - -
- Top

- Overview -
- - diff --git a/html/bayesnet/feature_selection/FCBF.h.gcov.png b/html/bayesnet/feature_selection/FCBF.h.gcov.png deleted file mode 100644 index 971e62c..0000000 Binary files a/html/bayesnet/feature_selection/FCBF.h.gcov.png and /dev/null differ diff --git a/html/bayesnet/feature_selection/FeatureSelect.cc.func-c.html b/html/bayesnet/feature_selection/FeatureSelect.cc.func-c.html deleted file mode 100644 index 4320859..0000000 --- a/html/bayesnet/feature_selection/FeatureSelect.cc.func-c.html +++ /dev/null @@ -1,139 +0,0 @@ - - - - - - - LCOV - BayesNet Coverage Report - bayesnet/feature_selection/FeatureSelect.cc - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - bayesnet/feature_selection - FeatureSelect.cc (source / functions)CoverageTotalHit
Test:BayesNet Coverage ReportLines:100.0 %4444
Test Date:2024-05-06 17:54:04Functions:100.0 %88
Legend: Lines: - hit - not hit -
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Function Name Sort by function nameHit count Sort by function hit count
bayesnet::FeatureSelect::computeSuLabels()151
bayesnet::FeatureSelect::initialize()151
bayesnet::FeatureSelect::getScores() const156
bayesnet::FeatureSelect::getFeatures() const171
bayesnet::FeatureSelect::FeatureSelect(at::Tensor const&, std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, int, int, at::Tensor const&)221
bayesnet::FeatureSelect::computeMeritCFS()1239
bayesnet::FeatureSelect::symmetricalUncertainty(int, int)3728
bayesnet::FeatureSelect::computeSuFeatures(int, int)7921
-
-
- - - -
Generated by: LCOV version 2.0-1
-
- - - diff --git a/html/bayesnet/feature_selection/FeatureSelect.cc.func.html b/html/bayesnet/feature_selection/FeatureSelect.cc.func.html deleted file mode 100644 index 679b2f0..0000000 --- a/html/bayesnet/feature_selection/FeatureSelect.cc.func.html +++ /dev/null @@ -1,139 +0,0 @@ - - - - - - - LCOV - BayesNet Coverage Report - bayesnet/feature_selection/FeatureSelect.cc - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - bayesnet/feature_selection - FeatureSelect.cc (source / functions)CoverageTotalHit
Test:BayesNet Coverage ReportLines:100.0 %4444
Test Date:2024-05-06 17:54:04Functions:100.0 %88
Legend: Lines: - hit - not hit -
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Function Name Sort by function nameHit count Sort by function hit count
bayesnet::FeatureSelect::FeatureSelect(at::Tensor const&, std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, int, int, at::Tensor const&)221
bayesnet::FeatureSelect::computeMeritCFS()1239
bayesnet::FeatureSelect::computeSuFeatures(int, int)7921
bayesnet::FeatureSelect::computeSuLabels()151
bayesnet::FeatureSelect::getFeatures() const171
bayesnet::FeatureSelect::getScores() const156
bayesnet::FeatureSelect::initialize()151
bayesnet::FeatureSelect::symmetricalUncertainty(int, int)3728
-
-
- - - -
Generated by: LCOV version 2.0-1
-
- - - diff --git a/html/bayesnet/feature_selection/FeatureSelect.cc.gcov.frameset.html b/html/bayesnet/feature_selection/FeatureSelect.cc.gcov.frameset.html deleted file mode 100644 index 50030eb..0000000 --- a/html/bayesnet/feature_selection/FeatureSelect.cc.gcov.frameset.html +++ /dev/null @@ -1,19 +0,0 @@ - - - - - - - LCOV - BayesNet Coverage Report - bayesnet/feature_selection/FeatureSelect.cc - - - - - - - - <center>Frames not supported by your browser!<br></center> - - - - diff --git a/html/bayesnet/feature_selection/FeatureSelect.cc.gcov.html b/html/bayesnet/feature_selection/FeatureSelect.cc.gcov.html deleted file mode 100644 index 66b3f08..0000000 --- a/html/bayesnet/feature_selection/FeatureSelect.cc.gcov.html +++ /dev/null @@ -1,168 +0,0 @@ - - - - - - - LCOV - BayesNet Coverage Report - bayesnet/feature_selection/FeatureSelect.cc - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - bayesnet/feature_selection - FeatureSelect.cc (source / functions)CoverageTotalHit
Test:BayesNet Coverage ReportLines:100.0 %4444
Test Date:2024-05-06 17:54:04Functions:100.0 %88
Legend: Lines: - hit - not hit -
-
- - - - - - - - -

-
            Line data    Source code
-
-       1              : // ***************************************************************
-       2              : // SPDX-FileCopyrightText: Copyright 2024 Ricardo Montañana Gómez
-       3              : // SPDX-FileType: SOURCE
-       4              : // SPDX-License-Identifier: MIT
-       5              : // ***************************************************************
-       6              : 
-       7              : #include <limits>
-       8              : #include "bayesnet/utils/bayesnetUtils.h"
-       9              : #include "FeatureSelect.h"
-      10              : namespace bayesnet {
-      11          221 :     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) :
-      12          221 :         Metrics(samples, features, className, classNumStates), maxFeatures(maxFeatures == 0 ? samples.size(0) - 1 : maxFeatures), weights(weights)
-      13              : 
-      14              :     {
-      15          221 :     }
-      16          151 :     void FeatureSelect::initialize()
-      17              :     {
-      18          151 :         selectedFeatures.clear();
-      19          151 :         selectedScores.clear();
-      20          151 :     }
-      21         3728 :     double FeatureSelect::symmetricalUncertainty(int a, int b)
-      22              :     {
-      23              :         /*
-      24              :         Compute symmetrical uncertainty. Normalize* information gain (mutual
-      25              :         information) with the entropies of the features in order to compensate
-      26              :         the bias due to high cardinality features. *Range [0, 1]
-      27              :         (https://www.sciencedirect.com/science/article/pii/S0020025519303603)
-      28              :         */
-      29        11184 :         auto x = samples.index({ a, "..." });
-      30        11184 :         auto y = samples.index({ b, "..." });
-      31         3728 :         auto mu = mutualInformation(x, y, weights);
-      32         3728 :         auto hx = entropy(x, weights);
-      33         3728 :         auto hy = entropy(y, weights);
-      34         3728 :         return 2.0 * mu / (hx + hy);
-      35        11184 :     }
-      36          151 :     void FeatureSelect::computeSuLabels()
-      37              :     {
-      38              :         // Compute Simmetrical Uncertainty between features and labels
-      39              :         // https://en.wikipedia.org/wiki/Symmetric_uncertainty
-      40         1258 :         for (int i = 0; i < features.size(); ++i) {
-      41         1107 :             suLabels.push_back(symmetricalUncertainty(i, -1));
-      42              :         }
-      43          151 :     }
-      44         7921 :     double FeatureSelect::computeSuFeatures(const int firstFeature, const int secondFeature)
-      45              :     {
-      46              :         // Compute Simmetrical Uncertainty between features
-      47              :         // https://en.wikipedia.org/wiki/Symmetric_uncertainty
-      48              :         try {
-      49         7921 :             return suFeatures.at({ firstFeature, secondFeature });
-      50              :         }
-      51         2621 :         catch (const std::out_of_range& e) {
-      52         2621 :             double result = symmetricalUncertainty(firstFeature, secondFeature);
-      53         2621 :             suFeatures[{firstFeature, secondFeature}] = result;
-      54         2621 :             return result;
-      55         2621 :         }
-      56              :     }
-      57         1239 :     double FeatureSelect::computeMeritCFS()
-      58              :     {
-      59         1239 :         double rcf = 0;
-      60         5693 :         for (auto feature : selectedFeatures) {
-      61         4454 :             rcf += suLabels[feature];
-      62              :         }
-      63         1239 :         double rff = 0;
-      64         1239 :         int n = selectedFeatures.size();
-      65         8154 :         for (const auto& item : doCombinations(selectedFeatures)) {
-      66         6915 :             rff += computeSuFeatures(item.first, item.second);
-      67         1239 :         }
-      68         1239 :         return rcf / sqrt(n + (n * n - n) * rff);
-      69              :     }
-      70          171 :     std::vector<int> FeatureSelect::getFeatures() const
-      71              :     {
-      72          171 :         if (!fitted) {
-      73           20 :             throw std::runtime_error("FeatureSelect not fitted");
-      74              :         }
-      75          151 :         return selectedFeatures;
-      76              :     }
-      77          156 :     std::vector<double> FeatureSelect::getScores() const
-      78              :     {
-      79          156 :         if (!fitted) {
-      80           20 :             throw std::runtime_error("FeatureSelect not fitted");
-      81              :         }
-      82          136 :         return selectedScores;
-      83              :     }
-      84              : }
-        
-
-
- - - - -
Generated by: LCOV version 2.0-1
-
- - - diff --git a/html/bayesnet/feature_selection/FeatureSelect.cc.gcov.overview.html b/html/bayesnet/feature_selection/FeatureSelect.cc.gcov.overview.html deleted file mode 100644 index 4498404..0000000 --- a/html/bayesnet/feature_selection/FeatureSelect.cc.gcov.overview.html +++ /dev/null @@ -1,41 +0,0 @@ - - - - - - LCOV - BayesNet Coverage Report - bayesnet/feature_selection/FeatureSelect.cc - - - - - - - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - - -
- Top

- Overview -
- - diff --git a/html/bayesnet/feature_selection/FeatureSelect.cc.gcov.png b/html/bayesnet/feature_selection/FeatureSelect.cc.gcov.png deleted file mode 100644 index e61c0b7..0000000 Binary files a/html/bayesnet/feature_selection/FeatureSelect.cc.gcov.png and /dev/null differ diff --git a/html/bayesnet/feature_selection/FeatureSelect.h.func-c.html b/html/bayesnet/feature_selection/FeatureSelect.h.func-c.html deleted file mode 100644 index ae09db8..0000000 --- a/html/bayesnet/feature_selection/FeatureSelect.h.func-c.html +++ /dev/null @@ -1,90 +0,0 @@ - - - - - - - LCOV - BayesNet Coverage Report - bayesnet/feature_selection/FeatureSelect.h - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - bayesnet/feature_selection - FeatureSelect.h (source / functions)CoverageTotalHit
Test:BayesNet Coverage ReportLines:100.0 %11
Test Date:2024-05-06 17:54:04Functions:100.0 %11
Legend: Lines: - hit - not hit -
-
- -
- - - - - - - - - - - - - - - - -

Function Name Sort by function nameHit count Sort by function hit count
bayesnet::FeatureSelect::~FeatureSelect()111
-
-
- - - -
Generated by: LCOV version 2.0-1
-
- - - diff --git a/html/bayesnet/feature_selection/FeatureSelect.h.func.html b/html/bayesnet/feature_selection/FeatureSelect.h.func.html deleted file mode 100644 index b72ffbf..0000000 --- a/html/bayesnet/feature_selection/FeatureSelect.h.func.html +++ /dev/null @@ -1,90 +0,0 @@ - - - - - - - LCOV - BayesNet Coverage Report - bayesnet/feature_selection/FeatureSelect.h - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - bayesnet/feature_selection - FeatureSelect.h (source / functions)CoverageTotalHit
Test:BayesNet Coverage ReportLines:100.0 %11
Test Date:2024-05-06 17:54:04Functions:100.0 %11
Legend: Lines: - hit - not hit -
-
- -
- - - - - - - - - - - - - - - - -

Function Name Sort by function nameHit count Sort by function hit count
bayesnet::FeatureSelect::~FeatureSelect()111
-
-
- - - -
Generated by: LCOV version 2.0-1
-
- - - diff --git a/html/bayesnet/feature_selection/FeatureSelect.h.gcov.frameset.html b/html/bayesnet/feature_selection/FeatureSelect.h.gcov.frameset.html deleted file mode 100644 index 3302cc5..0000000 --- a/html/bayesnet/feature_selection/FeatureSelect.h.gcov.frameset.html +++ /dev/null @@ -1,19 +0,0 @@ - - - - - - - LCOV - BayesNet Coverage Report - bayesnet/feature_selection/FeatureSelect.h - - - - - - - - <center>Frames not supported by your browser!<br></center> - - - - diff --git a/html/bayesnet/feature_selection/FeatureSelect.h.gcov.html b/html/bayesnet/feature_selection/FeatureSelect.h.gcov.html deleted file mode 100644 index a01bdf7..0000000 --- a/html/bayesnet/feature_selection/FeatureSelect.h.gcov.html +++ /dev/null @@ -1,120 +0,0 @@ - - - - - - - LCOV - BayesNet Coverage Report - bayesnet/feature_selection/FeatureSelect.h - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - bayesnet/feature_selection - FeatureSelect.h (source / functions)CoverageTotalHit
Test:BayesNet Coverage ReportLines:100.0 %11
Test Date:2024-05-06 17:54:04Functions:100.0 %11
Legend: Lines: - hit - not hit -
-
- - - - - - - - -

-
            Line data    Source code
-
-       1              : // ***************************************************************
-       2              : // SPDX-FileCopyrightText: Copyright 2024 Ricardo Montañana Gómez
-       3              : // SPDX-FileType: SOURCE
-       4              : // SPDX-License-Identifier: MIT
-       5              : // ***************************************************************
-       6              : 
-       7              : #ifndef FEATURE_SELECT_H
-       8              : #define FEATURE_SELECT_H
-       9              : #include <torch/torch.h>
-      10              : #include <vector>
-      11              : #include "bayesnet/utils/BayesMetrics.h"
-      12              : namespace bayesnet {
-      13              :     class FeatureSelect : public Metrics {
-      14              :     public:
-      15              :         // dataset is a n+1xm tensor of integers where dataset[-1] is the y std::vector
-      16              :         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);
-      17          111 :         virtual ~FeatureSelect() {};
-      18              :         virtual void fit() = 0;
-      19              :         std::vector<int> getFeatures() const;
-      20              :         std::vector<double> getScores() const;
-      21              :     protected:
-      22              :         void initialize();
-      23              :         void computeSuLabels();
-      24              :         double computeSuFeatures(const int a, const int b);
-      25              :         double symmetricalUncertainty(int a, int b);
-      26              :         double computeMeritCFS();
-      27              :         const torch::Tensor& weights;
-      28              :         int maxFeatures;
-      29              :         std::vector<int> selectedFeatures;
-      30              :         std::vector<double> selectedScores;
-      31              :         std::vector<double> suLabels;
-      32              :         std::map<std::pair<int, int>, double> suFeatures;
-      33              :         bool fitted = false;
-      34              :     };
-      35              : }
-      36              : #endif
-        
-
-
- - - - -
Generated by: LCOV version 2.0-1
-
- - - diff --git a/html/bayesnet/feature_selection/FeatureSelect.h.gcov.overview.html b/html/bayesnet/feature_selection/FeatureSelect.h.gcov.overview.html deleted file mode 100644 index 3a8b201..0000000 --- a/html/bayesnet/feature_selection/FeatureSelect.h.gcov.overview.html +++ /dev/null @@ -1,29 +0,0 @@ - - - - - - LCOV - BayesNet Coverage Report - bayesnet/feature_selection/FeatureSelect.h - - - - - - - overview - overview - overview - overview - overview - overview - overview - overview - overview - - -
- Top

- Overview -
- - diff --git a/html/bayesnet/feature_selection/FeatureSelect.h.gcov.png b/html/bayesnet/feature_selection/FeatureSelect.h.gcov.png deleted file mode 100644 index da3566c..0000000 Binary files a/html/bayesnet/feature_selection/FeatureSelect.h.gcov.png and /dev/null differ diff --git a/html/bayesnet/feature_selection/IWSS.cc.func-c.html b/html/bayesnet/feature_selection/IWSS.cc.func-c.html deleted file mode 100644 index 45a4ce3..0000000 --- a/html/bayesnet/feature_selection/IWSS.cc.func-c.html +++ /dev/null @@ -1,97 +0,0 @@ - - - - - - - LCOV - BayesNet Coverage Report - bayesnet/feature_selection/IWSS.cc - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - bayesnet/feature_selection - IWSS.cc (source / functions)CoverageTotalHit
Test:BayesNet Coverage ReportLines:96.7 %3029
Test Date:2024-05-06 17:54:04Functions:100.0 %22
Legend: Lines: - hit - not hit -
-
- -
- - - - - - - - - - - - - - - - - - - - - - - -

Function Name Sort by function nameHit count Sort by function hit count
bayesnet::IWSS::fit()47
bayesnet::IWSS::IWSS(at::Tensor const&, std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, int, int, at::Tensor const&, double)87
-
-
- - - -
Generated by: LCOV version 2.0-1
-
- - - diff --git a/html/bayesnet/feature_selection/IWSS.cc.func.html b/html/bayesnet/feature_selection/IWSS.cc.func.html deleted file mode 100644 index 54a0e67..0000000 --- a/html/bayesnet/feature_selection/IWSS.cc.func.html +++ /dev/null @@ -1,97 +0,0 @@ - - - - - - - LCOV - BayesNet Coverage Report - bayesnet/feature_selection/IWSS.cc - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - bayesnet/feature_selection - IWSS.cc (source / functions)CoverageTotalHit
Test:BayesNet Coverage ReportLines:96.7 %3029
Test Date:2024-05-06 17:54:04Functions:100.0 %22
Legend: Lines: - hit - not hit -
-
- -
- - - - - - - - - - - - - - - - - - - - - - - -

Function Name Sort by function nameHit count Sort by function hit count
bayesnet::IWSS::IWSS(at::Tensor const&, std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, int, int, at::Tensor const&, double)87
bayesnet::IWSS::fit()47
-
-
- - - -
Generated by: LCOV version 2.0-1
-
- - - diff --git a/html/bayesnet/feature_selection/IWSS.cc.gcov.frameset.html b/html/bayesnet/feature_selection/IWSS.cc.gcov.frameset.html deleted file mode 100644 index 4d69b9c..0000000 --- a/html/bayesnet/feature_selection/IWSS.cc.gcov.frameset.html +++ /dev/null @@ -1,19 +0,0 @@ - - - - - - - LCOV - BayesNet Coverage Report - bayesnet/feature_selection/IWSS.cc - - - - - - - - <center>Frames not supported by your browser!<br></center> - - - - diff --git a/html/bayesnet/feature_selection/IWSS.cc.gcov.html b/html/bayesnet/feature_selection/IWSS.cc.gcov.html deleted file mode 100644 index b53a393..0000000 --- a/html/bayesnet/feature_selection/IWSS.cc.gcov.html +++ /dev/null @@ -1,137 +0,0 @@ - - - - - - - LCOV - BayesNet Coverage Report - bayesnet/feature_selection/IWSS.cc - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - bayesnet/feature_selection - IWSS.cc (source / functions)CoverageTotalHit
Test:BayesNet Coverage ReportLines:96.7 %3029
Test Date:2024-05-06 17:54:04Functions:100.0 %22
Legend: Lines: - hit - not hit -
-
- - - - - - - - -

-
            Line data    Source code
-
-       1              : // ***************************************************************
-       2              : // SPDX-FileCopyrightText: Copyright 2024 Ricardo Montañana Gómez
-       3              : // SPDX-FileType: SOURCE
-       4              : // SPDX-License-Identifier: MIT
-       5              : // ***************************************************************
-       6              : 
-       7              : #include <limits>
-       8              : #include "bayesnet/utils/bayesnetUtils.h"
-       9              : #include "IWSS.h"
-      10              : namespace bayesnet {
-      11           87 :     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) :
-      12           87 :         FeatureSelect(samples, features, className, maxFeatures, classNumStates, weights), threshold(threshold)
-      13              :     {
-      14           87 :         if (threshold < 0 || threshold > .5) {
-      15           40 :             throw std::invalid_argument("Threshold has to be in [0, 0.5]");
-      16              :         }
-      17           87 :     }
-      18           47 :     void IWSS::fit()
-      19              :     {
-      20           47 :         initialize();
-      21           47 :         computeSuLabels();
-      22           47 :         auto featureOrder = argsort(suLabels); // sort descending order
-      23           47 :         auto featureOrderCopy = featureOrder;
-      24              :         // Add first and second features to result
-      25              :         //     First with its own score
-      26           47 :         auto first_feature = pop_first(featureOrderCopy);
-      27           47 :         selectedFeatures.push_back(first_feature);
-      28           47 :         selectedScores.push_back(suLabels.at(first_feature));
-      29              :         //     Second with the score of the candidates
-      30           47 :         selectedFeatures.push_back(pop_first(featureOrderCopy));
-      31           47 :         auto merit = computeMeritCFS();
-      32           47 :         selectedScores.push_back(merit);
-      33          162 :         for (const auto feature : featureOrderCopy) {
-      34          162 :             selectedFeatures.push_back(feature);
-      35              :             // Compute merit with selectedFeatures
-      36          162 :             auto meritNew = computeMeritCFS();
-      37          162 :             double delta = merit != 0.0 ? std::abs(merit - meritNew) / merit : 0.0;
-      38          162 :             if (meritNew > merit || delta < threshold) {
-      39          117 :                 if (meritNew > merit) {
-      40            0 :                     merit = meritNew;
-      41              :                 }
-      42          117 :                 selectedScores.push_back(meritNew);
-      43              :             } else {
-      44           45 :                 selectedFeatures.pop_back();
-      45           47 :                 break;
-      46              :             }
-      47          117 :             if (selectedFeatures.size() == maxFeatures) {
-      48            2 :                 break;
-      49              :             }
-      50              :         }
-      51           47 :         fitted = true;
-      52           47 :     }
-      53              : }
-        
-
-
- - - - -
Generated by: LCOV version 2.0-1
-
- - - diff --git a/html/bayesnet/feature_selection/IWSS.cc.gcov.overview.html b/html/bayesnet/feature_selection/IWSS.cc.gcov.overview.html deleted file mode 100644 index 276b9c5..0000000 --- a/html/bayesnet/feature_selection/IWSS.cc.gcov.overview.html +++ /dev/null @@ -1,34 +0,0 @@ - - - - - - LCOV - BayesNet Coverage Report - bayesnet/feature_selection/IWSS.cc - - - - - - - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - - -
- Top

- Overview -
- - diff --git a/html/bayesnet/feature_selection/IWSS.cc.gcov.png b/html/bayesnet/feature_selection/IWSS.cc.gcov.png deleted file mode 100644 index 38463bc..0000000 Binary files a/html/bayesnet/feature_selection/IWSS.cc.gcov.png and /dev/null differ diff --git a/html/bayesnet/feature_selection/IWSS.h.func-c.html b/html/bayesnet/feature_selection/IWSS.h.func-c.html deleted file mode 100644 index 06cb3e9..0000000 --- a/html/bayesnet/feature_selection/IWSS.h.func-c.html +++ /dev/null @@ -1,90 +0,0 @@ - - - - - - - LCOV - BayesNet Coverage Report - bayesnet/feature_selection/IWSS.h - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - bayesnet/feature_selection - IWSS.h (source / functions)CoverageTotalHit
Test:BayesNet Coverage ReportLines:100.0 %11
Test Date:2024-05-06 17:54:04Functions:100.0 %11
Legend: Lines: - hit - not hit -
-
- -
- - - - - - - - - - - - - - - - -

Function Name Sort by function nameHit count Sort by function hit count
bayesnet::IWSS::~IWSS()48
-
-
- - - -
Generated by: LCOV version 2.0-1
-
- - - diff --git a/html/bayesnet/feature_selection/IWSS.h.func.html b/html/bayesnet/feature_selection/IWSS.h.func.html deleted file mode 100644 index d0ed2a5..0000000 --- a/html/bayesnet/feature_selection/IWSS.h.func.html +++ /dev/null @@ -1,90 +0,0 @@ - - - - - - - LCOV - BayesNet Coverage Report - bayesnet/feature_selection/IWSS.h - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - bayesnet/feature_selection - IWSS.h (source / functions)CoverageTotalHit
Test:BayesNet Coverage ReportLines:100.0 %11
Test Date:2024-05-06 17:54:04Functions:100.0 %11
Legend: Lines: - hit - not hit -
-
- -
- - - - - - - - - - - - - - - - -

Function Name Sort by function nameHit count Sort by function hit count
bayesnet::IWSS::~IWSS()48
-
-
- - - -
Generated by: LCOV version 2.0-1
-
- - - diff --git a/html/bayesnet/feature_selection/IWSS.h.gcov.frameset.html b/html/bayesnet/feature_selection/IWSS.h.gcov.frameset.html deleted file mode 100644 index 949a657..0000000 --- a/html/bayesnet/feature_selection/IWSS.h.gcov.frameset.html +++ /dev/null @@ -1,19 +0,0 @@ - - - - - - - LCOV - BayesNet Coverage Report - bayesnet/feature_selection/IWSS.h - - - - - - - - <center>Frames not supported by your browser!<br></center> - - - - diff --git a/html/bayesnet/feature_selection/IWSS.h.gcov.html b/html/bayesnet/feature_selection/IWSS.h.gcov.html deleted file mode 100644 index a31c3e2..0000000 --- a/html/bayesnet/feature_selection/IWSS.h.gcov.html +++ /dev/null @@ -1,107 +0,0 @@ - - - - - - - LCOV - BayesNet Coverage Report - bayesnet/feature_selection/IWSS.h - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - bayesnet/feature_selection - IWSS.h (source / functions)CoverageTotalHit
Test:BayesNet Coverage ReportLines:100.0 %11
Test Date:2024-05-06 17:54:04Functions:100.0 %11
Legend: Lines: - hit - not hit -
-
- - - - - - - - -

-
            Line data    Source code
-
-       1              : // ***************************************************************
-       2              : // SPDX-FileCopyrightText: Copyright 2024 Ricardo Montañana Gómez
-       3              : // SPDX-FileType: SOURCE
-       4              : // SPDX-License-Identifier: MIT
-       5              : // ***************************************************************
-       6              : 
-       7              : #ifndef IWSS_H
-       8              : #define IWSS_H
-       9              : #include <vector>
-      10              : #include <torch/torch.h>
-      11              : #include "FeatureSelect.h"
-      12              : namespace bayesnet {
-      13              :     class IWSS : public FeatureSelect {
-      14              :     public:
-      15              :         // dataset is a n+1xm tensor of integers where dataset[-1] is the y std::vector
-      16              :         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);
-      17           48 :         virtual ~IWSS() {};
-      18              :         void fit() override;
-      19              :     private:
-      20              :         double threshold = -1;
-      21              :     };
-      22              : }
-      23              : #endif
-        
-
-
- - - - -
Generated by: LCOV version 2.0-1
-
- - - diff --git a/html/bayesnet/feature_selection/IWSS.h.gcov.overview.html b/html/bayesnet/feature_selection/IWSS.h.gcov.overview.html deleted file mode 100644 index c38ee9d..0000000 --- a/html/bayesnet/feature_selection/IWSS.h.gcov.overview.html +++ /dev/null @@ -1,26 +0,0 @@ - - - - - - LCOV - BayesNet Coverage Report - bayesnet/feature_selection/IWSS.h - - - - - - - overview - overview - overview - overview - overview - overview - - -
- Top

- Overview -
- - diff --git a/html/bayesnet/feature_selection/IWSS.h.gcov.png b/html/bayesnet/feature_selection/IWSS.h.gcov.png deleted file mode 100644 index d7f9b0a..0000000 Binary files a/html/bayesnet/feature_selection/IWSS.h.gcov.png and /dev/null differ diff --git a/html/bayesnet/feature_selection/index-detail-sort-f.html b/html/bayesnet/feature_selection/index-detail-sort-f.html deleted file mode 100644 index d0145d5..0000000 --- a/html/bayesnet/feature_selection/index-detail-sort-f.html +++ /dev/null @@ -1,198 +0,0 @@ - - - - - - - LCOV - BayesNet Coverage Report - bayesnet/feature_selection - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - bayesnet/feature_selectionCoverageTotalHit
Test:BayesNet Coverage ReportLines:98.7 %152150
Test Date:2024-05-06 17:54:04Functions:100.0 %1919
Legend: Rating: - low: < 75 % - medium: >= 75 % - high: >= 90 % -
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Filename Sort by file nameLine Coverage ( show details ) Sort by line coverageFunction Coverage Sort by function coverage
Rate Total Hit Rate Total Hit
FCBF.h -
100.0%
-
100.0 %11100.0 %11
FeatureSelect.h -
100.0%
-
100.0 %11100.0 %11
IWSS.h -
100.0%
-
100.0 %11100.0 %11
CFS.cc -
97.8%97.8%
-
97.8 %4544100.0 %22
CFS.h -
100.0%
-
100.0 %44100.0 %22
FCBF.cc -
100.0%
-
100.0 %2626100.0 %22
IWSS.cc -
96.7%96.7%
-
96.7 %3029100.0 %22
FeatureSelect.cc -
100.0%
-
100.0 %4444100.0 %88
-
-
- - - - -
Generated by: LCOV version 2.0-1
-
- - - diff --git a/html/bayesnet/feature_selection/index-detail-sort-l.html b/html/bayesnet/feature_selection/index-detail-sort-l.html deleted file mode 100644 index c644fe0..0000000 --- a/html/bayesnet/feature_selection/index-detail-sort-l.html +++ /dev/null @@ -1,198 +0,0 @@ - - - - - - - LCOV - BayesNet Coverage Report - bayesnet/feature_selection - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - bayesnet/feature_selectionCoverageTotalHit
Test:BayesNet Coverage ReportLines:98.7 %152150
Test Date:2024-05-06 17:54:04Functions:100.0 %1919
Legend: Rating: - low: < 75 % - medium: >= 75 % - high: >= 90 % -
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Filename Sort by file nameLine Coverage ( show details ) Sort by line coverageFunction Coverage Sort by function coverage
Rate Total Hit Rate Total Hit
IWSS.cc -
96.7%96.7%
-
96.7 %3029100.0 %22
CFS.cc -
97.8%97.8%
-
97.8 %4544100.0 %22
FCBF.h -
100.0%
-
100.0 %11100.0 %11
FeatureSelect.h -
100.0%
-
100.0 %11100.0 %11
IWSS.h -
100.0%
-
100.0 %11100.0 %11
CFS.h -
100.0%
-
100.0 %44100.0 %22
FCBF.cc -
100.0%
-
100.0 %2626100.0 %22
FeatureSelect.cc -
100.0%
-
100.0 %4444100.0 %88
-
-
- - - - -
Generated by: LCOV version 2.0-1
-
- - - diff --git a/html/bayesnet/feature_selection/index-detail.html b/html/bayesnet/feature_selection/index-detail.html deleted file mode 100644 index 5e03de6..0000000 --- a/html/bayesnet/feature_selection/index-detail.html +++ /dev/null @@ -1,198 +0,0 @@ - - - - - - - LCOV - BayesNet Coverage Report - bayesnet/feature_selection - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - bayesnet/feature_selectionCoverageTotalHit
Test:BayesNet Coverage ReportLines:98.7 %152150
Test Date:2024-05-06 17:54:04Functions:100.0 %1919
Legend: Rating: - low: < 75 % - medium: >= 75 % - high: >= 90 % -
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Filename Sort by file nameLine Coverage ( show details ) Sort by line coverageFunction Coverage Sort by function coverage
Rate Total Hit Rate Total Hit
CFS.cc -
97.8%97.8%
-
97.8 %4544100.0 %22
CFS.h -
100.0%
-
100.0 %44100.0 %22
FCBF.cc -
100.0%
-
100.0 %2626100.0 %22
FCBF.h -
100.0%
-
100.0 %11100.0 %11
FeatureSelect.cc -
100.0%
-
100.0 %4444100.0 %88
FeatureSelect.h -
100.0%
-
100.0 %11100.0 %11
IWSS.cc -
96.7%96.7%
-
96.7 %3029100.0 %22
IWSS.h -
100.0%
-
100.0 %11100.0 %11
-
-
- - - - -
Generated by: LCOV version 2.0-1
-
- - - diff --git a/html/bayesnet/feature_selection/index-sort-f.html b/html/bayesnet/feature_selection/index-sort-f.html deleted file mode 100644 index d0145d5..0000000 --- a/html/bayesnet/feature_selection/index-sort-f.html +++ /dev/null @@ -1,198 +0,0 @@ - - - - - - - LCOV - BayesNet Coverage Report - bayesnet/feature_selection - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - bayesnet/feature_selectionCoverageTotalHit
Test:BayesNet Coverage ReportLines:98.7 %152150
Test Date:2024-05-06 17:54:04Functions:100.0 %1919
Legend: Rating: - low: < 75 % - medium: >= 75 % - high: >= 90 % -
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Filename Sort by file nameLine Coverage ( show details ) Sort by line coverageFunction Coverage Sort by function coverage
Rate Total Hit Rate Total Hit
FCBF.h -
100.0%
-
100.0 %11100.0 %11
FeatureSelect.h -
100.0%
-
100.0 %11100.0 %11
IWSS.h -
100.0%
-
100.0 %11100.0 %11
CFS.cc -
97.8%97.8%
-
97.8 %4544100.0 %22
CFS.h -
100.0%
-
100.0 %44100.0 %22
FCBF.cc -
100.0%
-
100.0 %2626100.0 %22
IWSS.cc -
96.7%96.7%
-
96.7 %3029100.0 %22
FeatureSelect.cc -
100.0%
-
100.0 %4444100.0 %88
-
-
- - - - -
Generated by: LCOV version 2.0-1
-
- - - diff --git a/html/bayesnet/feature_selection/index-sort-l.html b/html/bayesnet/feature_selection/index-sort-l.html deleted file mode 100644 index c644fe0..0000000 --- a/html/bayesnet/feature_selection/index-sort-l.html +++ /dev/null @@ -1,198 +0,0 @@ - - - - - - - LCOV - BayesNet Coverage Report - bayesnet/feature_selection - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - bayesnet/feature_selectionCoverageTotalHit
Test:BayesNet Coverage ReportLines:98.7 %152150
Test Date:2024-05-06 17:54:04Functions:100.0 %1919
Legend: Rating: - low: < 75 % - medium: >= 75 % - high: >= 90 % -
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Filename Sort by file nameLine Coverage ( show details ) Sort by line coverageFunction Coverage Sort by function coverage
Rate Total Hit Rate Total Hit
IWSS.cc -
96.7%96.7%
-
96.7 %3029100.0 %22
CFS.cc -
97.8%97.8%
-
97.8 %4544100.0 %22
FCBF.h -
100.0%
-
100.0 %11100.0 %11
FeatureSelect.h -
100.0%
-
100.0 %11100.0 %11
IWSS.h -
100.0%
-
100.0 %11100.0 %11
CFS.h -
100.0%
-
100.0 %44100.0 %22
FCBF.cc -
100.0%
-
100.0 %2626100.0 %22
FeatureSelect.cc -
100.0%
-
100.0 %4444100.0 %88
-
-
- - - - -
Generated by: LCOV version 2.0-1
-
- - - diff --git a/html/bayesnet/feature_selection/index.html b/html/bayesnet/feature_selection/index.html deleted file mode 100644 index 5e03de6..0000000 --- a/html/bayesnet/feature_selection/index.html +++ /dev/null @@ -1,198 +0,0 @@ - - - - - - - LCOV - BayesNet Coverage Report - bayesnet/feature_selection - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - bayesnet/feature_selectionCoverageTotalHit
Test:BayesNet Coverage ReportLines:98.7 %152150
Test Date:2024-05-06 17:54:04Functions:100.0 %1919
Legend: Rating: - low: < 75 % - medium: >= 75 % - high: >= 90 % -
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Filename Sort by file nameLine Coverage ( show details ) Sort by line coverageFunction Coverage Sort by function coverage
Rate Total Hit Rate Total Hit
CFS.cc -
97.8%97.8%
-
97.8 %4544100.0 %22
CFS.h -
100.0%
-
100.0 %44100.0 %22
FCBF.cc -
100.0%
-
100.0 %2626100.0 %22
FCBF.h -
100.0%
-
100.0 %11100.0 %11
FeatureSelect.cc -
100.0%
-
100.0 %4444100.0 %88
FeatureSelect.h -
100.0%
-
100.0 %11100.0 %11
IWSS.cc -
96.7%96.7%
-
96.7 %3029100.0 %22
IWSS.h -
100.0%
-
100.0 %11100.0 %11
-
-
- - - - -
Generated by: LCOV version 2.0-1
-
- - - diff --git a/html/bayesnet/index-detail-sort-f.html b/html/bayesnet/index-detail-sort-f.html deleted file mode 100644 index 5fba070..0000000 --- a/html/bayesnet/index-detail-sort-f.html +++ /dev/null @@ -1,114 +0,0 @@ - - - - - - - LCOV - BayesNet Coverage Report - bayesnet - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - bayesnetCoverageTotalHit
Test:BayesNet Coverage ReportLines:100.0 %11
Test Date:2024-05-06 17:54:04Functions:100.0 %11
Legend: Rating: - low: < 75 % - medium: >= 75 % - high: >= 90 % -
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Filename Sort by file nameLine Coverage ( show details ) Sort by line coverageFunction Coverage Sort by function coverage
Rate Total Hit Rate Total Hit
BaseClassifier.h -
100.0%
-
100.0 %11100.0 %11
-
-
- - - - -
Generated by: LCOV version 2.0-1
-
- - - diff --git a/html/bayesnet/index-detail-sort-l.html b/html/bayesnet/index-detail-sort-l.html deleted file mode 100644 index 9283a50..0000000 --- a/html/bayesnet/index-detail-sort-l.html +++ /dev/null @@ -1,114 +0,0 @@ - - - - - - - LCOV - BayesNet Coverage Report - bayesnet - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - bayesnetCoverageTotalHit
Test:BayesNet Coverage ReportLines:100.0 %11
Test Date:2024-05-06 17:54:04Functions:100.0 %11
Legend: Rating: - low: < 75 % - medium: >= 75 % - high: >= 90 % -
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Filename Sort by file nameLine Coverage ( show details ) Sort by line coverageFunction Coverage Sort by function coverage
Rate Total Hit Rate Total Hit
BaseClassifier.h -
100.0%
-
100.0 %11100.0 %11
-
-
- - - - -
Generated by: LCOV version 2.0-1
-
- - - diff --git a/html/bayesnet/index-detail.html b/html/bayesnet/index-detail.html deleted file mode 100644 index c4bf771..0000000 --- a/html/bayesnet/index-detail.html +++ /dev/null @@ -1,114 +0,0 @@ - - - - - - - LCOV - BayesNet Coverage Report - bayesnet - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - bayesnetCoverageTotalHit
Test:BayesNet Coverage ReportLines:100.0 %11
Test Date:2024-05-06 17:54:04Functions:100.0 %11
Legend: Rating: - low: < 75 % - medium: >= 75 % - high: >= 90 % -
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Filename Sort by file nameLine Coverage ( show details ) Sort by line coverageFunction Coverage Sort by function coverage
Rate Total Hit Rate Total Hit
BaseClassifier.h -
100.0%
-
100.0 %11100.0 %11
-
-
- - - - -
Generated by: LCOV version 2.0-1
-
- - - diff --git a/html/bayesnet/index-sort-f.html b/html/bayesnet/index-sort-f.html deleted file mode 100644 index 5fba070..0000000 --- a/html/bayesnet/index-sort-f.html +++ /dev/null @@ -1,114 +0,0 @@ - - - - - - - LCOV - BayesNet Coverage Report - bayesnet - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - bayesnetCoverageTotalHit
Test:BayesNet Coverage ReportLines:100.0 %11
Test Date:2024-05-06 17:54:04Functions:100.0 %11
Legend: Rating: - low: < 75 % - medium: >= 75 % - high: >= 90 % -
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Filename Sort by file nameLine Coverage ( show details ) Sort by line coverageFunction Coverage Sort by function coverage
Rate Total Hit Rate Total Hit
BaseClassifier.h -
100.0%
-
100.0 %11100.0 %11
-
-
- - - - -
Generated by: LCOV version 2.0-1
-
- - - diff --git a/html/bayesnet/index-sort-l.html b/html/bayesnet/index-sort-l.html deleted file mode 100644 index 9283a50..0000000 --- a/html/bayesnet/index-sort-l.html +++ /dev/null @@ -1,114 +0,0 @@ - - - - - - - LCOV - BayesNet Coverage Report - bayesnet - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - bayesnetCoverageTotalHit
Test:BayesNet Coverage ReportLines:100.0 %11
Test Date:2024-05-06 17:54:04Functions:100.0 %11
Legend: Rating: - low: < 75 % - medium: >= 75 % - high: >= 90 % -
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Filename Sort by file nameLine Coverage ( show details ) Sort by line coverageFunction Coverage Sort by function coverage
Rate Total Hit Rate Total Hit
BaseClassifier.h -
100.0%
-
100.0 %11100.0 %11
-
-
- - - - -
Generated by: LCOV version 2.0-1
-
- - - diff --git a/html/bayesnet/index.html b/html/bayesnet/index.html deleted file mode 100644 index c4bf771..0000000 --- a/html/bayesnet/index.html +++ /dev/null @@ -1,114 +0,0 @@ - - - - - - - LCOV - BayesNet Coverage Report - bayesnet - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - bayesnetCoverageTotalHit
Test:BayesNet Coverage ReportLines:100.0 %11
Test Date:2024-05-06 17:54:04Functions:100.0 %11
Legend: Rating: - low: < 75 % - medium: >= 75 % - high: >= 90 % -
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Filename Sort by file nameLine Coverage ( show details ) Sort by line coverageFunction Coverage Sort by function coverage
Rate Total Hit Rate Total Hit
BaseClassifier.h -
100.0%
-
100.0 %11100.0 %11
-
-
- - - - -
Generated by: LCOV version 2.0-1
-
- - - diff --git a/html/bayesnet/network/Network.cc.func-c.html b/html/bayesnet/network/Network.cc.func-c.html deleted file mode 100644 index 82785c8..0000000 --- a/html/bayesnet/network/Network.cc.func-c.html +++ /dev/null @@ -1,363 +0,0 @@ - - - - - - - LCOV - BayesNet Coverage Report - bayesnet/network/Network.cc - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - bayesnet/network - Network.cc (source / functions)CoverageTotalHit
Test:BayesNet Coverage ReportLines:100.0 %295295
Test Date:2024-05-06 17:54:04Functions:100.0 %4040
Legend: Lines: - hit - not hit -
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Function Name Sort by function nameHit count Sort by function hit count
bayesnet::Network::fit(at::Tensor const&, at::Tensor const&, at::Tensor const&, std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::map<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::vector<int, std::allocator<int> >, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, std::vector<int, std::allocator<int> > > > > const&)4
bayesnet::Network::Network(float)8
bayesnet::Network::dump_cpt[abi:cxx11]() const8
bayesnet::Network::score(std::vector<std::vector<int, std::allocator<int> >, std::allocator<std::vector<int, std::allocator<int> > > > const&, std::vector<int, std::allocator<int> > const&)20
bayesnet::Network::show[abi:cxx11]() const28
bayesnet::Network::getSamples()48
bayesnet::Network::getStates() const48
bayesnet::Network::predict(std::vector<std::vector<int, std::allocator<int> >, std::allocator<std::vector<int, std::allocator<int> > > > const&)48
bayesnet::Network::fit(std::vector<std::vector<int, std::allocator<int> >, std::allocator<std::vector<int, std::allocator<int> > > > const&, std::vector<int, std::allocator<int> > const&, std::vector<double, std::allocator<double> > const&, std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::map<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::vector<int, std::allocator<int> >, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, std::vector<int, std::allocator<int> > > > > const&)92
bayesnet::Network::graph(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) const112
bayesnet::Network::topological_sort[abi:cxx11]()220
bayesnet::Network::getNumEdges() const364
bayesnet::Network::getFeatures[abi:cxx11]() const380
bayesnet::Network::getEdges[abi:cxx11]() const408
bayesnet::Network::predict_proba(std::vector<std::vector<int, std::allocator<int> >, std::allocator<std::vector<int, std::allocator<int> > > > const&)552
bayesnet::Network::predict_proba(at::Tensor const&)1476
bayesnet::Network::initialize()1740
bayesnet::Network::fit(at::Tensor const&, at::Tensor const&, std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::map<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::vector<int, std::allocator<int> >, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, std::vector<int, std::allocator<int> > > > > const&)1792
bayesnet::Network::completeFit(std::map<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::vector<int, std::allocator<int> >, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, std::vector<int, std::allocator<int> > > > > const&, at::Tensor const&)1824
bayesnet::Network::setStates(std::map<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::vector<int, std::allocator<int> >, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, std::vector<int, std::allocator<int> > > > > const&)1824
bayesnet::Network::predict(at::Tensor const&)1844
bayesnet::Network::checkFitData(int, int, int, std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::map<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::vector<int, std::allocator<int> >, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, std::vector<int, std::allocator<int> > > > > const&, at::Tensor const&)1888
bayesnet::Network::Network(bayesnet::Network const&)2244
bayesnet::Network::getMaxThreads() const2256
bayesnet::Network::Network()2332
bayesnet::Network::getClassNumStates() const2616
bayesnet::Network::predict_tensor(at::Tensor const&, bool)3320
bayesnet::Network::addNode(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)31216
bayesnet::Network::completeFit(std::map<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::vector<int, std::allocator<int> >, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, std::vector<int, std::allocator<int> > > > > const&, at::Tensor const&)::{lambda()#1}::operator()() const32828
bayesnet::Network::setStates(std::map<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::vector<int, std::allocator<int> >, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, std::vector<int, std::allocator<int> > > > > const&)::{lambda(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)#1}::operator()(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) const32828
bayesnet::Network::addEdge(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)59152
bayesnet::Network::isCyclic(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::unordered_set<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::hash<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::equal_to<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > >&, std::unordered_set<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::hash<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::equal_to<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > >&)70324
bayesnet::Network::predict_sample(std::vector<int, std::allocator<int> > const&)114512
bayesnet::Network::predict_sample(at::Tensor const&)781712
bayesnet::Network::exactInference(std::map<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, int, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, int> > >&)896208
bayesnet::Network::computeFactor(std::map<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, int, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, int> > >&)3734984
bayesnet::Network::exactInference(std::map<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, int, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, int> > >&)::{lambda()#1}::operator()() const3734984
bayesnet::Network::exactInference(std::map<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, int, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, int> > >&)::{lambda(double const&)#1}::operator()(double const&) const3734984
bayesnet::Network::getClassName[abi:cxx11]() const3735008
bayesnet::Network::getNodes[abi:cxx11]()3735276
-
-
- - - -
Generated by: LCOV version 2.0-1
-
- - - diff --git a/html/bayesnet/network/Network.cc.func.html b/html/bayesnet/network/Network.cc.func.html deleted file mode 100644 index 7369fb0..0000000 --- a/html/bayesnet/network/Network.cc.func.html +++ /dev/null @@ -1,363 +0,0 @@ - - - - - - - LCOV - BayesNet Coverage Report - bayesnet/network/Network.cc - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - bayesnet/network - Network.cc (source / functions)CoverageTotalHit
Test:BayesNet Coverage ReportLines:100.0 %295295
Test Date:2024-05-06 17:54:04Functions:100.0 %4040
Legend: Lines: - hit - not hit -
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Function Name Sort by function nameHit count Sort by function hit count
bayesnet::Network::Network()2332
bayesnet::Network::Network(bayesnet::Network const&)2244
bayesnet::Network::Network(float)8
bayesnet::Network::addEdge(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)59152
bayesnet::Network::addNode(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)31216
bayesnet::Network::checkFitData(int, int, int, std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::map<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::vector<int, std::allocator<int> >, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, std::vector<int, std::allocator<int> > > > > const&, at::Tensor const&)1888
bayesnet::Network::completeFit(std::map<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::vector<int, std::allocator<int> >, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, std::vector<int, std::allocator<int> > > > > const&, at::Tensor const&)1824
bayesnet::Network::completeFit(std::map<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::vector<int, std::allocator<int> >, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, std::vector<int, std::allocator<int> > > > > const&, at::Tensor const&)::{lambda()#1}::operator()() const32828
bayesnet::Network::computeFactor(std::map<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, int, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, int> > >&)3734984
bayesnet::Network::dump_cpt[abi:cxx11]() const8
bayesnet::Network::exactInference(std::map<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, int, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, int> > >&)896208
bayesnet::Network::exactInference(std::map<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, int, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, int> > >&)::{lambda()#1}::operator()() const3734984
bayesnet::Network::exactInference(std::map<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, int, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, int> > >&)::{lambda(double const&)#1}::operator()(double const&) const3734984
bayesnet::Network::fit(at::Tensor const&, at::Tensor const&, at::Tensor const&, std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::map<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::vector<int, std::allocator<int> >, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, std::vector<int, std::allocator<int> > > > > const&)4
bayesnet::Network::fit(at::Tensor const&, at::Tensor const&, std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::map<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::vector<int, std::allocator<int> >, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, std::vector<int, std::allocator<int> > > > > const&)1792
bayesnet::Network::fit(std::vector<std::vector<int, std::allocator<int> >, std::allocator<std::vector<int, std::allocator<int> > > > const&, std::vector<int, std::allocator<int> > const&, std::vector<double, std::allocator<double> > const&, std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::map<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::vector<int, std::allocator<int> >, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, std::vector<int, std::allocator<int> > > > > const&)92
bayesnet::Network::getClassName[abi:cxx11]() const3735008
bayesnet::Network::getClassNumStates() const2616
bayesnet::Network::getEdges[abi:cxx11]() const408
bayesnet::Network::getFeatures[abi:cxx11]() const380
bayesnet::Network::getMaxThreads() const2256
bayesnet::Network::getNodes[abi:cxx11]()3735276
bayesnet::Network::getNumEdges() const364
bayesnet::Network::getSamples()48
bayesnet::Network::getStates() const48
bayesnet::Network::graph(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) const112
bayesnet::Network::initialize()1740
bayesnet::Network::isCyclic(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::unordered_set<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::hash<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::equal_to<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > >&, std::unordered_set<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::hash<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::equal_to<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > >&)70324
bayesnet::Network::predict(at::Tensor const&)1844
bayesnet::Network::predict(std::vector<std::vector<int, std::allocator<int> >, std::allocator<std::vector<int, std::allocator<int> > > > const&)48
bayesnet::Network::predict_proba(at::Tensor const&)1476
bayesnet::Network::predict_proba(std::vector<std::vector<int, std::allocator<int> >, std::allocator<std::vector<int, std::allocator<int> > > > const&)552
bayesnet::Network::predict_sample(at::Tensor const&)781712
bayesnet::Network::predict_sample(std::vector<int, std::allocator<int> > const&)114512
bayesnet::Network::predict_tensor(at::Tensor const&, bool)3320
bayesnet::Network::score(std::vector<std::vector<int, std::allocator<int> >, std::allocator<std::vector<int, std::allocator<int> > > > const&, std::vector<int, std::allocator<int> > const&)20
bayesnet::Network::setStates(std::map<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::vector<int, std::allocator<int> >, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, std::vector<int, std::allocator<int> > > > > const&)1824
bayesnet::Network::setStates(std::map<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::vector<int, std::allocator<int> >, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, std::vector<int, std::allocator<int> > > > > const&)::{lambda(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)#1}::operator()(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) const32828
bayesnet::Network::show[abi:cxx11]() const28
bayesnet::Network::topological_sort[abi:cxx11]()220
-
-
- - - -
Generated by: LCOV version 2.0-1
-
- - - diff --git a/html/bayesnet/network/Network.cc.gcov.frameset.html b/html/bayesnet/network/Network.cc.gcov.frameset.html deleted file mode 100644 index 4233619..0000000 --- a/html/bayesnet/network/Network.cc.gcov.frameset.html +++ /dev/null @@ -1,19 +0,0 @@ - - - - - - - LCOV - BayesNet Coverage Report - bayesnet/network/Network.cc - - - - - - - - <center>Frames not supported by your browser!<br></center> - - - - diff --git a/html/bayesnet/network/Network.cc.gcov.html b/html/bayesnet/network/Network.cc.gcov.html deleted file mode 100644 index 4ebb2a5..0000000 --- a/html/bayesnet/network/Network.cc.gcov.html +++ /dev/null @@ -1,513 +0,0 @@ - - - - - - - LCOV - BayesNet Coverage Report - bayesnet/network/Network.cc - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - bayesnet/network - Network.cc (source / functions)CoverageTotalHit
Test:BayesNet Coverage ReportLines:100.0 %295295
Test Date:2024-05-06 17:54:04Functions:100.0 %4040
Legend: Lines: - hit - not hit -
-
- - - - - - - - -

-
            Line data    Source code
-
-       1              : // ***************************************************************
-       2              : // SPDX-FileCopyrightText: Copyright 2024 Ricardo Montañana Gómez
-       3              : // SPDX-FileType: SOURCE
-       4              : // SPDX-License-Identifier: MIT
-       5              : // ***************************************************************
-       6              : 
-       7              : #include <thread>
-       8              : #include <mutex>
-       9              : #include <sstream>
-      10              : #include "Network.h"
-      11              : #include "bayesnet/utils/bayesnetUtils.h"
-      12              : namespace bayesnet {
-      13         2332 :     Network::Network() : fitted{ false }, maxThreads{ 0.95 }, classNumStates{ 0 }, laplaceSmoothing{ 0 }
-      14              :     {
-      15         2332 :     }
-      16            8 :     Network::Network(float maxT) : fitted{ false }, maxThreads{ maxT }, classNumStates{ 0 }, laplaceSmoothing{ 0 }
-      17              :     {
-      18              : 
-      19            8 :     }
-      20         2244 :     Network::Network(const Network& other) : laplaceSmoothing(other.laplaceSmoothing), features(other.features), className(other.className), classNumStates(other.getClassNumStates()),
-      21         4488 :         maxThreads(other.getMaxThreads()), fitted(other.fitted), samples(other.samples)
-      22              :     {
-      23         2244 :         if (samples.defined())
-      24            4 :             samples = samples.clone();
-      25         2264 :         for (const auto& node : other.nodes) {
-      26           20 :             nodes[node.first] = std::make_unique<Node>(*node.second);
-      27              :         }
-      28         2244 :     }
-      29         1740 :     void Network::initialize()
-      30              :     {
-      31         1740 :         features.clear();
-      32         1740 :         className = "";
-      33         1740 :         classNumStates = 0;
-      34         1740 :         fitted = false;
-      35         1740 :         nodes.clear();
-      36         1740 :         samples = torch::Tensor();
-      37         1740 :     }
-      38         2256 :     float Network::getMaxThreads() const
-      39              :     {
-      40         2256 :         return maxThreads;
-      41              :     }
-      42           48 :     torch::Tensor& Network::getSamples()
-      43              :     {
-      44           48 :         return samples;
-      45              :     }
-      46        31216 :     void Network::addNode(const std::string& name)
-      47              :     {
-      48        31216 :         if (name == "") {
-      49            8 :             throw std::invalid_argument("Node name cannot be empty");
-      50              :         }
-      51        31208 :         if (nodes.find(name) != nodes.end()) {
-      52            4 :             return;
-      53              :         }
-      54        31204 :         if (find(features.begin(), features.end(), name) == features.end()) {
-      55        31204 :             features.push_back(name);
-      56              :         }
-      57        31204 :         nodes[name] = std::make_unique<Node>(name);
-      58              :     }
-      59          380 :     std::vector<std::string> Network::getFeatures() const
-      60              :     {
-      61          380 :         return features;
-      62              :     }
-      63         2616 :     int Network::getClassNumStates() const
-      64              :     {
-      65         2616 :         return classNumStates;
-      66              :     }
-      67           48 :     int Network::getStates() const
-      68              :     {
-      69           48 :         int result = 0;
-      70          288 :         for (auto& node : nodes) {
-      71          240 :             result += node.second->getNumStates();
-      72              :         }
-      73           48 :         return result;
-      74              :     }
-      75      3735008 :     std::string Network::getClassName() const
-      76              :     {
-      77      3735008 :         return className;
-      78              :     }
-      79        70324 :     bool Network::isCyclic(const std::string& nodeId, std::unordered_set<std::string>& visited, std::unordered_set<std::string>& recStack)
-      80              :     {
-      81        70324 :         if (visited.find(nodeId) == visited.end()) // if node hasn't been visited yet
-      82              :         {
-      83        70324 :             visited.insert(nodeId);
-      84        70324 :             recStack.insert(nodeId);
-      85        81496 :             for (Node* child : nodes[nodeId]->getChildren()) {
-      86        11196 :                 if (visited.find(child->getName()) == visited.end() && isCyclic(child->getName(), visited, recStack))
-      87           24 :                     return true;
-      88        11180 :                 if (recStack.find(child->getName()) != recStack.end())
-      89            8 :                     return true;
-      90              :             }
-      91              :         }
-      92        70300 :         recStack.erase(nodeId); // remove node from recursion stack before function ends
-      93        70300 :         return false;
-      94              :     }
-      95        59152 :     void Network::addEdge(const std::string& parent, const std::string& child)
-      96              :     {
-      97        59152 :         if (nodes.find(parent) == nodes.end()) {
-      98            8 :             throw std::invalid_argument("Parent node " + parent + " does not exist");
-      99              :         }
-     100        59144 :         if (nodes.find(child) == nodes.end()) {
-     101            8 :             throw std::invalid_argument("Child node " + child + " does not exist");
-     102              :         }
-     103              :         // Temporarily add edge to check for cycles
-     104        59136 :         nodes[parent]->addChild(nodes[child].get());
-     105        59136 :         nodes[child]->addParent(nodes[parent].get());
-     106        59136 :         std::unordered_set<std::string> visited;
-     107        59136 :         std::unordered_set<std::string> recStack;
-     108        59136 :         if (isCyclic(nodes[child]->getName(), visited, recStack)) // if adding this edge forms a cycle
-     109              :         {
-     110              :             // remove problematic edge
-     111            8 :             nodes[parent]->removeChild(nodes[child].get());
-     112            8 :             nodes[child]->removeParent(nodes[parent].get());
-     113            8 :             throw std::invalid_argument("Adding this edge forms a cycle in the graph.");
-     114              :         }
-     115        59144 :     }
-     116      3735276 :     std::map<std::string, std::unique_ptr<Node>>& Network::getNodes()
-     117              :     {
-     118      3735276 :         return nodes;
-     119              :     }
-     120         1888 :     void Network::checkFitData(int n_samples, int n_features, int n_samples_y, const std::vector<std::string>& featureNames, const std::string& className, const std::map<std::string, std::vector<int>>& states, const torch::Tensor& weights)
-     121              :     {
-     122         1888 :         if (weights.size(0) != n_samples) {
-     123            8 :             throw std::invalid_argument("Weights (" + std::to_string(weights.size(0)) + ") must have the same number of elements as samples (" + std::to_string(n_samples) + ") in Network::fit");
-     124              :         }
-     125         1880 :         if (n_samples != n_samples_y) {
-     126            8 :             throw std::invalid_argument("X and y must have the same number of samples in Network::fit (" + std::to_string(n_samples) + " != " + std::to_string(n_samples_y) + ")");
-     127              :         }
-     128         1872 :         if (n_features != featureNames.size()) {
-     129            8 :             throw std::invalid_argument("X and features must have the same number of features in Network::fit (" + std::to_string(n_features) + " != " + std::to_string(featureNames.size()) + ")");
-     130              :         }
-     131         1864 :         if (features.size() == 0) {
-     132            8 :             throw std::invalid_argument("The network has not been initialized. You must call addNode() before calling fit()");
-     133              :         }
-     134         1856 :         if (n_features != features.size() - 1) {
-     135            8 :             throw std::invalid_argument("X and local features must have the same number of features in Network::fit (" + std::to_string(n_features) + " != " + std::to_string(features.size() - 1) + ")");
-     136              :         }
-     137         1848 :         if (find(features.begin(), features.end(), className) == features.end()) {
-     138            8 :             throw std::invalid_argument("Class Name not found in Network::features");
-     139              :         }
-     140        32868 :         for (auto& feature : featureNames) {
-     141        31044 :             if (find(features.begin(), features.end(), feature) == features.end()) {
-     142            8 :                 throw std::invalid_argument("Feature " + feature + " not found in Network::features");
-     143              :             }
-     144        31036 :             if (states.find(feature) == states.end()) {
-     145            8 :                 throw std::invalid_argument("Feature " + feature + " not found in states");
-     146              :             }
-     147              :         }
-     148         1824 :     }
-     149         1824 :     void Network::setStates(const std::map<std::string, std::vector<int>>& states)
-     150              :     {
-     151              :         // Set states to every Node in the network
-     152         1824 :         for_each(features.begin(), features.end(), [this, &states](const std::string& feature) {
-     153        32828 :             nodes.at(feature)->setNumStates(states.at(feature).size());
-     154        32828 :             });
-     155         1824 :         classNumStates = nodes.at(className)->getNumStates();
-     156         1824 :     }
-     157              :     // X comes in nxm, where n is the number of features and m the number of samples
-     158            4 :     void Network::fit(const torch::Tensor& X, const torch::Tensor& y, const torch::Tensor& weights, const std::vector<std::string>& featureNames, const std::string& className, const std::map<std::string, std::vector<int>>& states)
-     159              :     {
-     160            4 :         checkFitData(X.size(1), X.size(0), y.size(0), featureNames, className, states, weights);
-     161            4 :         this->className = className;
-     162            4 :         torch::Tensor ytmp = torch::transpose(y.view({ y.size(0), 1 }), 0, 1);
-     163           12 :         samples = torch::cat({ X , ytmp }, 0);
-     164           20 :         for (int i = 0; i < featureNames.size(); ++i) {
-     165           48 :             auto row_feature = X.index({ i, "..." });
-     166           16 :         }
-     167            4 :         completeFit(states, weights);
-     168           24 :     }
-     169         1792 :     void Network::fit(const torch::Tensor& samples, const torch::Tensor& weights, const std::vector<std::string>& featureNames, const std::string& className, const std::map<std::string, std::vector<int>>& states)
-     170              :     {
-     171         1792 :         checkFitData(samples.size(1), samples.size(0) - 1, samples.size(1), featureNames, className, states, weights);
-     172         1792 :         this->className = className;
-     173         1792 :         this->samples = samples;
-     174         1792 :         completeFit(states, weights);
-     175         1792 :     }
-     176              :     // input_data comes in nxm, where n is the number of features and m the number of samples
-     177           92 :     void Network::fit(const std::vector<std::vector<int>>& input_data, const std::vector<int>& labels, const std::vector<double>& weights_, const std::vector<std::string>& featureNames, const std::string& className, const std::map<std::string, std::vector<int>>& states)
-     178              :     {
-     179           92 :         const torch::Tensor weights = torch::tensor(weights_, torch::kFloat64);
-     180           92 :         checkFitData(input_data[0].size(), input_data.size(), labels.size(), featureNames, className, states, weights);
-     181           28 :         this->className = className;
-     182              :         // Build tensor of samples (nxm) (n+1 because of the class)
-     183           28 :         samples = torch::zeros({ static_cast<int>(input_data.size() + 1), static_cast<int>(input_data[0].size()) }, torch::kInt32);
-     184          140 :         for (int i = 0; i < featureNames.size(); ++i) {
-     185          448 :             samples.index_put_({ i, "..." }, torch::tensor(input_data[i], torch::kInt32));
-     186              :         }
-     187          112 :         samples.index_put_({ -1, "..." }, torch::tensor(labels, torch::kInt32));
-     188           28 :         completeFit(states, weights);
-     189          232 :     }
-     190         1824 :     void Network::completeFit(const std::map<std::string, std::vector<int>>& states, const torch::Tensor& weights)
-     191              :     {
-     192         1824 :         setStates(states);
-     193         1824 :         laplaceSmoothing = 1.0 / samples.size(1); // To use in CPT computation
-     194         1824 :         std::vector<std::thread> threads;
-     195        34652 :         for (auto& node : nodes) {
-     196        32828 :             threads.emplace_back([this, &node, &weights]() {
-     197        32828 :                 node.second->computeCPT(samples, features, laplaceSmoothing, weights);
-     198        32828 :                 });
-     199              :         }
-     200        34652 :         for (auto& thread : threads) {
-     201        32828 :             thread.join();
-     202              :         }
-     203         1824 :         fitted = true;
-     204         1824 :     }
-     205         3320 :     torch::Tensor Network::predict_tensor(const torch::Tensor& samples, const bool proba)
-     206              :     {
-     207         3320 :         if (!fitted) {
-     208            8 :             throw std::logic_error("You must call fit() before calling predict()");
-     209              :         }
-     210         3312 :         torch::Tensor result;
-     211         3312 :         result = torch::zeros({ samples.size(1), classNumStates }, torch::kFloat64);
-     212       785016 :         for (int i = 0; i < samples.size(1); ++i) {
-     213      2345136 :             const torch::Tensor sample = samples.index({ "...", i });
-     214       781712 :             auto psample = predict_sample(sample);
-     215       781704 :             auto temp = torch::tensor(psample, torch::kFloat64);
-     216              :             //            result.index_put_({ i, "..." }, torch::tensor(predict_sample(sample), torch::kFloat64));
-     217      2345112 :             result.index_put_({ i, "..." }, temp);
-     218       781712 :         }
-     219         3304 :         if (proba)
-     220         1476 :             return result;
-     221         3656 :         return result.argmax(1);
-     222      1566728 :     }
-     223              :     // Return mxn tensor of probabilities
-     224         1476 :     torch::Tensor Network::predict_proba(const torch::Tensor& samples)
-     225              :     {
-     226         1476 :         return predict_tensor(samples, true);
-     227              :     }
-     228              : 
-     229              :     // Return mxn tensor of probabilities
-     230         1844 :     torch::Tensor Network::predict(const torch::Tensor& samples)
-     231              :     {
-     232         1844 :         return predict_tensor(samples, false);
-     233              :     }
-     234              : 
-     235              :     // Return mx1 std::vector of predictions
-     236              :     // tsamples is nxm std::vector of samples
-     237           48 :     std::vector<int> Network::predict(const std::vector<std::vector<int>>& tsamples)
-     238              :     {
-     239           48 :         if (!fitted) {
-     240           16 :             throw std::logic_error("You must call fit() before calling predict()");
-     241              :         }
-     242           32 :         std::vector<int> predictions;
-     243           32 :         std::vector<int> sample;
-     244         3564 :         for (int row = 0; row < tsamples[0].size(); ++row) {
-     245         3540 :             sample.clear();
-     246        26252 :             for (int col = 0; col < tsamples.size(); ++col) {
-     247        22712 :                 sample.push_back(tsamples[col][row]);
-     248              :             }
-     249         3540 :             std::vector<double> classProbabilities = predict_sample(sample);
-     250              :             // Find the class with the maximum posterior probability
-     251         3532 :             auto maxElem = max_element(classProbabilities.begin(), classProbabilities.end());
-     252         3532 :             int predictedClass = distance(classProbabilities.begin(), maxElem);
-     253         3532 :             predictions.push_back(predictedClass);
-     254         3532 :         }
-     255           48 :         return predictions;
-     256           40 :     }
-     257              :     // Return mxn std::vector of probabilities
-     258              :     // tsamples is nxm std::vector of samples
-     259          552 :     std::vector<std::vector<double>> Network::predict_proba(const std::vector<std::vector<int>>& tsamples)
-     260              :     {
-     261          552 :         if (!fitted) {
-     262            8 :             throw std::logic_error("You must call fit() before calling predict_proba()");
-     263              :         }
-     264          544 :         std::vector<std::vector<double>> predictions;
-     265          544 :         std::vector<int> sample;
-     266       111516 :         for (int row = 0; row < tsamples[0].size(); ++row) {
-     267       110972 :             sample.clear();
-     268      1055620 :             for (int col = 0; col < tsamples.size(); ++col) {
-     269       944648 :                 sample.push_back(tsamples[col][row]);
-     270              :             }
-     271       110972 :             predictions.push_back(predict_sample(sample));
-     272              :         }
-     273         1088 :         return predictions;
-     274          544 :     }
-     275           20 :     double Network::score(const std::vector<std::vector<int>>& tsamples, const std::vector<int>& labels)
-     276              :     {
-     277           20 :         std::vector<int> y_pred = predict(tsamples);
-     278           12 :         int correct = 0;
-     279         2324 :         for (int i = 0; i < y_pred.size(); ++i) {
-     280         2312 :             if (y_pred[i] == labels[i]) {
-     281         1944 :                 correct++;
-     282              :             }
-     283              :         }
-     284           24 :         return (double)correct / y_pred.size();
-     285           12 :     }
-     286              :     // Return 1xn std::vector of probabilities
-     287       114512 :     std::vector<double> Network::predict_sample(const std::vector<int>& sample)
-     288              :     {
-     289              :         // Ensure the sample size is equal to the number of features
-     290       114512 :         if (sample.size() != features.size() - 1) {
-     291           16 :             throw std::invalid_argument("Sample size (" + std::to_string(sample.size()) +
-     292           24 :                 ") does not match the number of features (" + std::to_string(features.size() - 1) + ")");
-     293              :         }
-     294       114504 :         std::map<std::string, int> evidence;
-     295      1081840 :         for (int i = 0; i < sample.size(); ++i) {
-     296       967336 :             evidence[features[i]] = sample[i];
-     297              :         }
-     298       229008 :         return exactInference(evidence);
-     299       114504 :     }
-     300              :     // Return 1xn std::vector of probabilities
-     301       781712 :     std::vector<double> Network::predict_sample(const torch::Tensor& sample)
-     302              :     {
-     303              :         // Ensure the sample size is equal to the number of features
-     304       781712 :         if (sample.size(0) != features.size() - 1) {
-     305           16 :             throw std::invalid_argument("Sample size (" + std::to_string(sample.size(0)) +
-     306           24 :                 ") does not match the number of features (" + std::to_string(features.size() - 1) + ")");
-     307              :         }
-     308       781704 :         std::map<std::string, int> evidence;
-     309     18085136 :         for (int i = 0; i < sample.size(0); ++i) {
-     310     17303432 :             evidence[features[i]] = sample[i].item<int>();
-     311              :         }
-     312      1563408 :         return exactInference(evidence);
-     313       781704 :     }
-     314      3734984 :     double Network::computeFactor(std::map<std::string, int>& completeEvidence)
-     315              :     {
-     316      3734984 :         double result = 1.0;
-     317     72886736 :         for (auto& node : getNodes()) {
-     318     69151752 :             result *= node.second->getFactorValue(completeEvidence);
-     319              :         }
-     320      3734984 :         return result;
-     321              :     }
-     322       896208 :     std::vector<double> Network::exactInference(std::map<std::string, int>& evidence)
-     323              :     {
-     324       896208 :         std::vector<double> result(classNumStates, 0.0);
-     325       896208 :         std::vector<std::thread> threads;
-     326       896208 :         std::mutex mtx;
-     327      4631192 :         for (int i = 0; i < classNumStates; ++i) {
-     328      3734984 :             threads.emplace_back([this, &result, &evidence, i, &mtx]() {
-     329      3734984 :                 auto completeEvidence = std::map<std::string, int>(evidence);
-     330      3734984 :                 completeEvidence[getClassName()] = i;
-     331      3734984 :                 double factor = computeFactor(completeEvidence);
-     332      3734984 :                 std::lock_guard<std::mutex> lock(mtx);
-     333      3734984 :                 result[i] = factor;
-     334      3734984 :                 });
-     335              :         }
-     336      4631192 :         for (auto& thread : threads) {
-     337      3734984 :             thread.join();
-     338              :         }
-     339              :         // Normalize result
-     340       896208 :         double sum = accumulate(result.begin(), result.end(), 0.0);
-     341      4631192 :         transform(result.begin(), result.end(), result.begin(), [sum](const double& value) { return value / sum; });
-     342      1792416 :         return result;
-     343       896208 :     }
-     344           28 :     std::vector<std::string> Network::show() const
-     345              :     {
-     346           28 :         std::vector<std::string> result;
-     347              :         // Draw the network
-     348          160 :         for (auto& node : nodes) {
-     349          132 :             std::string line = node.first + " -> ";
-     350          308 :             for (auto child : node.second->getChildren()) {
-     351          176 :                 line += child->getName() + ", ";
-     352              :             }
-     353          132 :             result.push_back(line);
-     354          132 :         }
-     355           56 :         return result;
-     356           28 :     }
-     357          112 :     std::vector<std::string> Network::graph(const std::string& title) const
-     358              :     {
-     359          112 :         auto output = std::vector<std::string>();
-     360          112 :         auto prefix = "digraph BayesNet {\nlabel=<BayesNet ";
-     361          112 :         auto suffix = ">\nfontsize=30\nfontcolor=blue\nlabelloc=t\nlayout=circo\n";
-     362          112 :         std::string header = prefix + title + suffix;
-     363          112 :         output.push_back(header);
-     364          844 :         for (auto& node : nodes) {
-     365          732 :             auto result = node.second->graph(className);
-     366          732 :             output.insert(output.end(), result.begin(), result.end());
-     367          732 :         }
-     368          112 :         output.push_back("}\n");
-     369          224 :         return output;
-     370          112 :     }
-     371          408 :     std::vector<std::pair<std::string, std::string>> Network::getEdges() const
-     372              :     {
-     373          408 :         auto edges = std::vector<std::pair<std::string, std::string>>();
-     374         7396 :         for (const auto& node : nodes) {
-     375         6988 :             auto head = node.first;
-     376        20312 :             for (const auto& child : node.second->getChildren()) {
-     377        13324 :                 auto tail = child->getName();
-     378        13324 :                 edges.push_back({ head, tail });
-     379        13324 :             }
-     380         6988 :         }
-     381          816 :         return edges;
-     382          408 :     }
-     383          364 :     int Network::getNumEdges() const
-     384              :     {
-     385          364 :         return getEdges().size();
-     386              :     }
-     387          220 :     std::vector<std::string> Network::topological_sort()
-     388              :     {
-     389              :         /* Check if al the fathers of every node are before the node */
-     390          220 :         auto result = features;
-     391          220 :         result.erase(remove(result.begin(), result.end(), className), result.end());
-     392          220 :         bool ending{ false };
-     393          628 :         while (!ending) {
-     394          408 :             ending = true;
-     395         3804 :             for (auto feature : features) {
-     396         3396 :                 auto fathers = nodes[feature]->getParents();
-     397         9000 :                 for (const auto& father : fathers) {
-     398         5604 :                     auto fatherName = father->getName();
-     399         5604 :                     if (fatherName == className) {
-     400         2980 :                         continue;
-     401              :                     }
-     402              :                     // Check if father is placed before the actual feature
-     403         2624 :                     auto it = find(result.begin(), result.end(), fatherName);
-     404         2624 :                     if (it != result.end()) {
-     405         2624 :                         auto it2 = find(result.begin(), result.end(), feature);
-     406         2624 :                         if (it2 != result.end()) {
-     407         5248 :                             if (distance(it, it2) < 0) {
-     408              :                                 // if it is not, insert it before the feature
-     409          244 :                                 result.erase(remove(result.begin(), result.end(), fatherName), result.end());
-     410          244 :                                 result.insert(it2, fatherName);
-     411          244 :                                 ending = false;
-     412              :                             }
-     413              :                         }
-     414              :                     }
-     415         5604 :                 }
-     416         3396 :             }
-     417              :         }
-     418          440 :         return result;
-     419          220 :     }
-     420            8 :     std::string Network::dump_cpt() const
-     421              :     {
-     422            8 :         std::stringstream oss;
-     423           48 :         for (auto& node : nodes) {
-     424           40 :             oss << "* " << node.first << ": (" << node.second->getNumStates() << ") : " << node.second->getCPT().sizes() << std::endl;
-     425           40 :             oss << node.second->getCPT() << std::endl;
-     426              :         }
-     427           16 :         return oss.str();
-     428            8 :     }
-     429              : }
-        
-
-
- - - - -
Generated by: LCOV version 2.0-1
-
- - - diff --git a/html/bayesnet/network/Network.cc.gcov.overview.html b/html/bayesnet/network/Network.cc.gcov.overview.html deleted file mode 100644 index 96bc96f..0000000 --- a/html/bayesnet/network/Network.cc.gcov.overview.html +++ /dev/null @@ -1,128 +0,0 @@ - - - - - - LCOV - BayesNet Coverage Report - bayesnet/network/Network.cc - - - - - - - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - - -
- Top

- Overview -
- - diff --git a/html/bayesnet/network/Network.cc.gcov.png b/html/bayesnet/network/Network.cc.gcov.png deleted file mode 100644 index 9bc84fb..0000000 Binary files a/html/bayesnet/network/Network.cc.gcov.png and /dev/null differ diff --git a/html/bayesnet/network/Network.h.func-c.html b/html/bayesnet/network/Network.h.func-c.html deleted file mode 100644 index f51978c..0000000 --- a/html/bayesnet/network/Network.h.func-c.html +++ /dev/null @@ -1,90 +0,0 @@ - - - - - - - LCOV - BayesNet Coverage Report - bayesnet/network/Network.h - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - bayesnet/network - Network.h (source / functions)CoverageTotalHit
Test:BayesNet Coverage ReportLines:100.0 %11
Test Date:2024-05-06 17:54:04Functions:100.0 %11
Legend: Lines: - hit - not hit -
-
- -
- - - - - - - - - - - - - - - - -

Function Name Sort by function nameHit count Sort by function hit count
bayesnet::Network::~Network()4024
-
-
- - - -
Generated by: LCOV version 2.0-1
-
- - - diff --git a/html/bayesnet/network/Network.h.func.html b/html/bayesnet/network/Network.h.func.html deleted file mode 100644 index 755cf34..0000000 --- a/html/bayesnet/network/Network.h.func.html +++ /dev/null @@ -1,90 +0,0 @@ - - - - - - - LCOV - BayesNet Coverage Report - bayesnet/network/Network.h - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - bayesnet/network - Network.h (source / functions)CoverageTotalHit
Test:BayesNet Coverage ReportLines:100.0 %11
Test Date:2024-05-06 17:54:04Functions:100.0 %11
Legend: Lines: - hit - not hit -
-
- -
- - - - - - - - - - - - - - - - -

Function Name Sort by function nameHit count Sort by function hit count
bayesnet::Network::~Network()4024
-
-
- - - -
Generated by: LCOV version 2.0-1
-
- - - diff --git a/html/bayesnet/network/Network.h.gcov.frameset.html b/html/bayesnet/network/Network.h.gcov.frameset.html deleted file mode 100644 index 6fe326f..0000000 --- a/html/bayesnet/network/Network.h.gcov.frameset.html +++ /dev/null @@ -1,19 +0,0 @@ - - - - - - - LCOV - BayesNet Coverage Report - bayesnet/network/Network.h - - - - - - - - <center>Frames not supported by your browser!<br></center> - - - - diff --git a/html/bayesnet/network/Network.h.gcov.html b/html/bayesnet/network/Network.h.gcov.html deleted file mode 100644 index ac9673f..0000000 --- a/html/bayesnet/network/Network.h.gcov.html +++ /dev/null @@ -1,153 +0,0 @@ - - - - - - - LCOV - BayesNet Coverage Report - bayesnet/network/Network.h - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - bayesnet/network - Network.h (source / functions)CoverageTotalHit
Test:BayesNet Coverage ReportLines:100.0 %11
Test Date:2024-05-06 17:54:04Functions:100.0 %11
Legend: Lines: - hit - not hit -
-
- - - - - - - - -

-
            Line data    Source code
-
-       1              : // ***************************************************************
-       2              : // SPDX-FileCopyrightText: Copyright 2024 Ricardo Montañana Gómez
-       3              : // SPDX-FileType: SOURCE
-       4              : // SPDX-License-Identifier: MIT
-       5              : // ***************************************************************
-       6              : 
-       7              : #ifndef NETWORK_H
-       8              : #define NETWORK_H
-       9              : #include <map>
-      10              : #include <vector>
-      11              : #include "bayesnet/config.h"
-      12              : #include "Node.h"
-      13              : 
-      14              : namespace bayesnet {
-      15              :     class Network {
-      16              :     public:
-      17              :         Network();
-      18              :         explicit Network(float);
-      19              :         explicit Network(const Network&);
-      20         4024 :         ~Network() = default;
-      21              :         torch::Tensor& getSamples();
-      22              :         float getMaxThreads() const;
-      23              :         void addNode(const std::string&);
-      24              :         void addEdge(const std::string&, const std::string&);
-      25              :         std::map<std::string, std::unique_ptr<Node>>& getNodes();
-      26              :         std::vector<std::string> getFeatures() const;
-      27              :         int getStates() const;
-      28              :         std::vector<std::pair<std::string, std::string>> getEdges() const;
-      29              :         int getNumEdges() const;
-      30              :         int getClassNumStates() const;
-      31              :         std::string getClassName() const;
-      32              :         /*
-      33              :         Notice: Nodes have to be inserted in the same order as they are in the dataset, i.e., first node is first column and so on.
-      34              :         */
-      35              :         void fit(const std::vector<std::vector<int>>& input_data, const std::vector<int>& labels, const std::vector<double>& weights, const std::vector<std::string>& featureNames, const std::string& className, const std::map<std::string, std::vector<int>>& states);
-      36              :         void fit(const torch::Tensor& X, const torch::Tensor& y, const torch::Tensor& weights, const std::vector<std::string>& featureNames, const std::string& className, const std::map<std::string, std::vector<int>>& states);
-      37              :         void fit(const torch::Tensor& samples, const torch::Tensor& weights, const std::vector<std::string>& featureNames, const std::string& className, const std::map<std::string, std::vector<int>>& states);
-      38              :         std::vector<int> predict(const std::vector<std::vector<int>>&); // Return mx1 std::vector of predictions
-      39              :         torch::Tensor predict(const torch::Tensor&); // Return mx1 tensor of predictions
-      40              :         torch::Tensor predict_tensor(const torch::Tensor& samples, const bool proba);
-      41              :         std::vector<std::vector<double>> predict_proba(const std::vector<std::vector<int>>&); // Return mxn std::vector of probabilities
-      42              :         torch::Tensor predict_proba(const torch::Tensor&); // Return mxn tensor of probabilities
-      43              :         double score(const std::vector<std::vector<int>>&, const std::vector<int>&);
-      44              :         std::vector<std::string> topological_sort();
-      45              :         std::vector<std::string> show() const;
-      46              :         std::vector<std::string> graph(const std::string& title) const; // Returns a std::vector of std::strings representing the graph in graphviz format
-      47              :         void initialize();
-      48              :         std::string dump_cpt() const;
-      49              :         inline std::string version() { return  { project_version.begin(), project_version.end() }; }
-      50              :     private:
-      51              :         std::map<std::string, std::unique_ptr<Node>> nodes;
-      52              :         bool fitted;
-      53              :         float maxThreads = 0.95;
-      54              :         int classNumStates;
-      55              :         std::vector<std::string> features; // Including classname
-      56              :         std::string className;
-      57              :         double laplaceSmoothing;
-      58              :         torch::Tensor samples; // n+1xm tensor used to fit the model
-      59              :         bool isCyclic(const std::string&, std::unordered_set<std::string>&, std::unordered_set<std::string>&);
-      60              :         std::vector<double> predict_sample(const std::vector<int>&);
-      61              :         std::vector<double> predict_sample(const torch::Tensor&);
-      62              :         std::vector<double> exactInference(std::map<std::string, int>&);
-      63              :         double computeFactor(std::map<std::string, int>&);
-      64              :         void completeFit(const std::map<std::string, std::vector<int>>& states, const torch::Tensor& weights);
-      65              :         void checkFitData(int n_features, int n_samples, int n_samples_y, const std::vector<std::string>& featureNames, const std::string& className, const std::map<std::string, std::vector<int>>& states, const torch::Tensor& weights);
-      66              :         void setStates(const std::map<std::string, std::vector<int>>&);
-      67              :     };
-      68              : }
-      69              : #endif
-        
-
-
- - - - -
Generated by: LCOV version 2.0-1
-
- - - diff --git a/html/bayesnet/network/Network.h.gcov.overview.html b/html/bayesnet/network/Network.h.gcov.overview.html deleted file mode 100644 index bdda93e..0000000 --- a/html/bayesnet/network/Network.h.gcov.overview.html +++ /dev/null @@ -1,38 +0,0 @@ - - - - - - LCOV - BayesNet Coverage Report - bayesnet/network/Network.h - - - - - - - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - - -
- Top

- Overview -
- - diff --git a/html/bayesnet/network/Network.h.gcov.png b/html/bayesnet/network/Network.h.gcov.png deleted file mode 100644 index f815125..0000000 Binary files a/html/bayesnet/network/Network.h.gcov.png and /dev/null differ diff --git a/html/bayesnet/network/Node.cc.func-c.html b/html/bayesnet/network/Node.cc.func-c.html deleted file mode 100644 index dab5657..0000000 --- a/html/bayesnet/network/Node.cc.func-c.html +++ /dev/null @@ -1,223 +0,0 @@ - - - - - - - LCOV - BayesNet Coverage Report - bayesnet/network/Node.cc - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - bayesnet/network - Node.cc (source / functions)CoverageTotalHit
Test:BayesNet Coverage ReportLines:100.0 %8888
Test Date:2024-05-06 17:54:04Functions:100.0 %2020
Legend: Lines: - hit - not hit -
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Function Name Sort by function nameHit count Sort by function hit count
bayesnet::Node::clear()9
bayesnet::Node::removeChild(bayesnet::Node*)17
bayesnet::Node::removeParent(bayesnet::Node*)17
bayesnet::Node::combinations(std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > const&)45
bayesnet::Node::minFill()45
bayesnet::Node::getCPT()429
bayesnet::Node::graph(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)732
auto bayesnet::Node::graph(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)::{lambda(auto:1 const&)#1}::operator()<bayesnet::Node*>(bayesnet::Node* const&) const1108
bayesnet::Node::getParents()5087
bayesnet::Node::Node(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)31339
bayesnet::Node::setNumStates(int)32864
bayesnet::Node::computeCPT(at::Tensor const&, std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > const&, double, at::Tensor const&)32894
bayesnet::Node::addChild(bayesnet::Node*)59235
bayesnet::Node::addParent(bayesnet::Node*)59262
auto bayesnet::Node::computeCPT(at::Tensor const&, std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > const&, double, at::Tensor const&)::{lambda(auto:1 const&)#1}::operator()<bayesnet::Node*>(bayesnet::Node* const&) const62020
bayesnet::Node::getNumStates() const64124
bayesnet::Node::getChildren()77571
bayesnet::Node::getFactorValue(std::map<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, int, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, int> > >&)69151761
auto bayesnet::Node::getFactorValue(std::map<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, int, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, int> > >&)::{lambda(auto:1 const&)#1}::operator()<bayesnet::Node*>(bayesnet::Node* const&) const129301512
bayesnet::Node::getName[abi:cxx11]() const150429643
-
-
- - - -
Generated by: LCOV version 2.0-1
-
- - - diff --git a/html/bayesnet/network/Node.cc.func.html b/html/bayesnet/network/Node.cc.func.html deleted file mode 100644 index d8e7bd8..0000000 --- a/html/bayesnet/network/Node.cc.func.html +++ /dev/null @@ -1,223 +0,0 @@ - - - - - - - LCOV - BayesNet Coverage Report - bayesnet/network/Node.cc - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - bayesnet/network - Node.cc (source / functions)CoverageTotalHit
Test:BayesNet Coverage ReportLines:100.0 %8888
Test Date:2024-05-06 17:54:04Functions:100.0 %2020
Legend: Lines: - hit - not hit -
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Function Name Sort by function nameHit count Sort by function hit count
auto bayesnet::Node::computeCPT(at::Tensor const&, std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > const&, double, at::Tensor const&)::{lambda(auto:1 const&)#1}::operator()<bayesnet::Node*>(bayesnet::Node* const&) const62020
auto bayesnet::Node::getFactorValue(std::map<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, int, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, int> > >&)::{lambda(auto:1 const&)#1}::operator()<bayesnet::Node*>(bayesnet::Node* const&) const129301512
auto bayesnet::Node::graph(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)::{lambda(auto:1 const&)#1}::operator()<bayesnet::Node*>(bayesnet::Node* const&) const1108
bayesnet::Node::Node(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)31339
bayesnet::Node::addChild(bayesnet::Node*)59235
bayesnet::Node::addParent(bayesnet::Node*)59262
bayesnet::Node::clear()9
bayesnet::Node::combinations(std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > const&)45
bayesnet::Node::computeCPT(at::Tensor const&, std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > const&, double, at::Tensor const&)32894
bayesnet::Node::getCPT()429
bayesnet::Node::getChildren()77571
bayesnet::Node::getFactorValue(std::map<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, int, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, int> > >&)69151761
bayesnet::Node::getName[abi:cxx11]() const150429643
bayesnet::Node::getNumStates() const64124
bayesnet::Node::getParents()5087
bayesnet::Node::graph(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)732
bayesnet::Node::minFill()45
bayesnet::Node::removeChild(bayesnet::Node*)17
bayesnet::Node::removeParent(bayesnet::Node*)17
bayesnet::Node::setNumStates(int)32864
-
-
- - - -
Generated by: LCOV version 2.0-1
-
- - - diff --git a/html/bayesnet/network/Node.cc.gcov.frameset.html b/html/bayesnet/network/Node.cc.gcov.frameset.html deleted file mode 100644 index 48cc9aa..0000000 --- a/html/bayesnet/network/Node.cc.gcov.frameset.html +++ /dev/null @@ -1,19 +0,0 @@ - - - - - - - LCOV - BayesNet Coverage Report - bayesnet/network/Node.cc - - - - - - - - <center>Frames not supported by your browser!<br></center> - - - - diff --git a/html/bayesnet/network/Node.cc.gcov.html b/html/bayesnet/network/Node.cc.gcov.html deleted file mode 100644 index 84aebe5..0000000 --- a/html/bayesnet/network/Node.cc.gcov.html +++ /dev/null @@ -1,224 +0,0 @@ - - - - - - - LCOV - BayesNet Coverage Report - bayesnet/network/Node.cc - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - bayesnet/network - Node.cc (source / functions)CoverageTotalHit
Test:BayesNet Coverage ReportLines:100.0 %8888
Test Date:2024-05-06 17:54:04Functions:100.0 %2020
Legend: Lines: - hit - not hit -
-
- - - - - - - - -

-
            Line data    Source code
-
-       1              : // ***************************************************************
-       2              : // SPDX-FileCopyrightText: Copyright 2024 Ricardo Montañana Gómez
-       3              : // SPDX-FileType: SOURCE
-       4              : // SPDX-License-Identifier: MIT
-       5              : // ***************************************************************
-       6              : 
-       7              : #include "Node.h"
-       8              : 
-       9              : namespace bayesnet {
-      10              : 
-      11        31339 :     Node::Node(const std::string& name)
-      12        31339 :         : name(name)
-      13              :     {
-      14        31339 :     }
-      15            9 :     void Node::clear()
-      16              :     {
-      17            9 :         parents.clear();
-      18            9 :         children.clear();
-      19            9 :         cpTable = torch::Tensor();
-      20            9 :         dimensions.clear();
-      21            9 :         numStates = 0;
-      22            9 :     }
-      23    150429643 :     std::string Node::getName() const
-      24              :     {
-      25    150429643 :         return name;
-      26              :     }
-      27        59262 :     void Node::addParent(Node* parent)
-      28              :     {
-      29        59262 :         parents.push_back(parent);
-      30        59262 :     }
-      31           17 :     void Node::removeParent(Node* parent)
-      32              :     {
-      33           17 :         parents.erase(std::remove(parents.begin(), parents.end(), parent), parents.end());
-      34           17 :     }
-      35           17 :     void Node::removeChild(Node* child)
-      36              :     {
-      37           17 :         children.erase(std::remove(children.begin(), children.end(), child), children.end());
-      38           17 :     }
-      39        59235 :     void Node::addChild(Node* child)
-      40              :     {
-      41        59235 :         children.push_back(child);
-      42        59235 :     }
-      43         5087 :     std::vector<Node*>& Node::getParents()
-      44              :     {
-      45         5087 :         return parents;
-      46              :     }
-      47        77571 :     std::vector<Node*>& Node::getChildren()
-      48              :     {
-      49        77571 :         return children;
-      50              :     }
-      51        64124 :     int Node::getNumStates() const
-      52              :     {
-      53        64124 :         return numStates;
-      54              :     }
-      55        32864 :     void Node::setNumStates(int numStates)
-      56              :     {
-      57        32864 :         this->numStates = numStates;
-      58        32864 :     }
-      59          429 :     torch::Tensor& Node::getCPT()
-      60              :     {
-      61          429 :         return cpTable;
-      62              :     }
-      63              :     /*
-      64              :      The MinFill criterion is a heuristic for variable elimination.
-      65              :      The variable that minimizes the number of edges that need to be added to the graph to make it triangulated.
-      66              :      This is done by counting the number of edges that need to be added to the graph if the variable is eliminated.
-      67              :      The variable with the minimum number of edges is chosen.
-      68              :      Here this is done computing the length of the combinations of the node neighbors taken 2 by 2.
-      69              :     */
-      70           45 :     unsigned Node::minFill()
-      71              :     {
-      72           45 :         std::unordered_set<std::string> neighbors;
-      73          117 :         for (auto child : children) {
-      74           72 :             neighbors.emplace(child->getName());
-      75              :         }
-      76          108 :         for (auto parent : parents) {
-      77           63 :             neighbors.emplace(parent->getName());
-      78              :         }
-      79           45 :         auto source = std::vector<std::string>(neighbors.begin(), neighbors.end());
-      80           90 :         return combinations(source).size();
-      81           45 :     }
-      82           45 :     std::vector<std::pair<std::string, std::string>> Node::combinations(const std::vector<std::string>& source)
-      83              :     {
-      84           45 :         std::vector<std::pair<std::string, std::string>> result;
-      85          180 :         for (int i = 0; i < source.size(); ++i) {
-      86          135 :             std::string temp = source[i];
-      87          279 :             for (int j = i + 1; j < source.size(); ++j) {
-      88          144 :                 result.push_back({ temp, source[j] });
-      89              :             }
-      90          135 :         }
-      91           90 :         return result;
-      92           45 :     }
-      93        32894 :     void Node::computeCPT(const torch::Tensor& dataset, const std::vector<std::string>& features, const double laplaceSmoothing, const torch::Tensor& weights)
-      94              :     {
-      95        32894 :         dimensions.clear();
-      96              :         // Get dimensions of the CPT
-      97        32894 :         dimensions.push_back(numStates);
-      98        94914 :         transform(parents.begin(), parents.end(), back_inserter(dimensions), [](const auto& parent) { return parent->getNumStates(); });
-      99              :         // Create a tensor of zeros with the dimensions of the CPT
-     100        32894 :         cpTable = torch::zeros(dimensions, torch::kFloat) + laplaceSmoothing;
-     101              :         // Fill table with counts
-     102        32894 :         auto pos = find(features.begin(), features.end(), name);
-     103        32894 :         if (pos == features.end()) {
-     104            8 :             throw std::logic_error("Feature " + name + " not found in dataset");
-     105              :         }
-     106        32886 :         int name_index = pos - features.begin();
-     107     11221522 :         for (int n_sample = 0; n_sample < dataset.size(1); ++n_sample) {
-     108     11188649 :             c10::List<c10::optional<at::Tensor>> coordinates;
-     109     33565947 :             coordinates.push_back(dataset.index({ name_index, n_sample }));
-     110     32200749 :             for (auto parent : parents) {
-     111     21012113 :                 pos = find(features.begin(), features.end(), parent->getName());
-     112     21012113 :                 if (pos == features.end()) {
-     113           13 :                     throw std::logic_error("Feature parent " + parent->getName() + " not found in dataset");
-     114              :                 }
-     115     21012100 :                 int parent_index = pos - features.begin();
-     116     63036300 :                 coordinates.push_back(dataset.index({ parent_index, n_sample }));
-     117              :             }
-     118              :             // Increment the count of the corresponding coordinate
-     119     22377272 :             cpTable.index_put_({ coordinates }, cpTable.index({ coordinates }) + weights.index({ n_sample }).item<double>());
-     120     11188649 :         }
-     121              :         // Normalize the counts
-     122        32873 :         cpTable = cpTable / cpTable.sum(0);
-     123     43422258 :     }
-     124     69151761 :     float Node::getFactorValue(std::map<std::string, int>& evidence)
-     125              :     {
-     126     69151761 :         c10::List<c10::optional<at::Tensor>> coordinates;
-     127              :         // following predetermined order of indices in the cpTable (see Node.h)
-     128     69151761 :         coordinates.push_back(at::tensor(evidence[name]));
-     129    198453273 :         transform(parents.begin(), parents.end(), std::back_inserter(coordinates), [&evidence](const auto& parent) { return at::tensor(evidence[parent->getName()]); });
-     130    138303522 :         return cpTable.index({ coordinates }).item<float>();
-     131     69151761 :     }
-     132          732 :     std::vector<std::string> Node::graph(const std::string& className)
-     133              :     {
-     134          732 :         auto output = std::vector<std::string>();
-     135          732 :         auto suffix = name == className ? ", fontcolor=red, fillcolor=lightblue, style=filled " : "";
-     136          732 :         output.push_back(name + " [shape=circle" + suffix + "] \n");
-     137         1840 :         transform(children.begin(), children.end(), back_inserter(output), [this](const auto& child) { return name + " -> " + child->getName(); });
-     138         1464 :         return output;
-     139          732 :     }
-     140              : }
-        
-
-
- - - - -
Generated by: LCOV version 2.0-1
-
- - - diff --git a/html/bayesnet/network/Node.cc.gcov.overview.html b/html/bayesnet/network/Node.cc.gcov.overview.html deleted file mode 100644 index 59f204f..0000000 --- a/html/bayesnet/network/Node.cc.gcov.overview.html +++ /dev/null @@ -1,55 +0,0 @@ - - - - - - LCOV - BayesNet Coverage Report - bayesnet/network/Node.cc - - - - - - - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - - -
- Top

- Overview -
- - diff --git a/html/bayesnet/network/Node.cc.gcov.png b/html/bayesnet/network/Node.cc.gcov.png deleted file mode 100644 index e5942a5..0000000 Binary files a/html/bayesnet/network/Node.cc.gcov.png and /dev/null differ diff --git a/html/bayesnet/network/index-detail-sort-f.html b/html/bayesnet/network/index-detail-sort-f.html deleted file mode 100644 index f5574a3..0000000 --- a/html/bayesnet/network/index-detail-sort-f.html +++ /dev/null @@ -1,138 +0,0 @@ - - - - - - - LCOV - BayesNet Coverage Report - bayesnet/network - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - bayesnet/networkCoverageTotalHit
Test:BayesNet Coverage ReportLines:100.0 %384384
Test Date:2024-05-06 17:54:04Functions:100.0 %6161
Legend: Rating: - low: < 75 % - medium: >= 75 % - high: >= 90 % -
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Filename Sort by file nameLine Coverage ( show details ) Sort by line coverageFunction Coverage Sort by function coverage
Rate Total Hit Rate Total Hit
Network.h -
100.0%
-
100.0 %11100.0 %11
Node.cc -
100.0%
-
100.0 %8888100.0 %2020
Network.cc -
100.0%
-
100.0 %295295100.0 %4040
-
-
- - - - -
Generated by: LCOV version 2.0-1
-
- - - diff --git a/html/bayesnet/network/index-detail-sort-l.html b/html/bayesnet/network/index-detail-sort-l.html deleted file mode 100644 index b032e99..0000000 --- a/html/bayesnet/network/index-detail-sort-l.html +++ /dev/null @@ -1,138 +0,0 @@ - - - - - - - LCOV - BayesNet Coverage Report - bayesnet/network - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - bayesnet/networkCoverageTotalHit
Test:BayesNet Coverage ReportLines:100.0 %384384
Test Date:2024-05-06 17:54:04Functions:100.0 %6161
Legend: Rating: - low: < 75 % - medium: >= 75 % - high: >= 90 % -
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Filename Sort by file nameLine Coverage ( show details ) Sort by line coverageFunction Coverage Sort by function coverage
Rate Total Hit Rate Total Hit
Network.h -
100.0%
-
100.0 %11100.0 %11
Node.cc -
100.0%
-
100.0 %8888100.0 %2020
Network.cc -
100.0%
-
100.0 %295295100.0 %4040
-
-
- - - - -
Generated by: LCOV version 2.0-1
-
- - - diff --git a/html/bayesnet/network/index-detail.html b/html/bayesnet/network/index-detail.html deleted file mode 100644 index 60f89a2..0000000 --- a/html/bayesnet/network/index-detail.html +++ /dev/null @@ -1,138 +0,0 @@ - - - - - - - LCOV - BayesNet Coverage Report - bayesnet/network - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - bayesnet/networkCoverageTotalHit
Test:BayesNet Coverage ReportLines:100.0 %384384
Test Date:2024-05-06 17:54:04Functions:100.0 %6161
Legend: Rating: - low: < 75 % - medium: >= 75 % - high: >= 90 % -
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Filename Sort by file nameLine Coverage ( show details ) Sort by line coverageFunction Coverage Sort by function coverage
Rate Total Hit Rate Total Hit
Network.cc -
100.0%
-
100.0 %295295100.0 %4040
Network.h -
100.0%
-
100.0 %11100.0 %11
Node.cc -
100.0%
-
100.0 %8888100.0 %2020
-
-
- - - - -
Generated by: LCOV version 2.0-1
-
- - - diff --git a/html/bayesnet/network/index-sort-f.html b/html/bayesnet/network/index-sort-f.html deleted file mode 100644 index f5574a3..0000000 --- a/html/bayesnet/network/index-sort-f.html +++ /dev/null @@ -1,138 +0,0 @@ - - - - - - - LCOV - BayesNet Coverage Report - bayesnet/network - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - bayesnet/networkCoverageTotalHit
Test:BayesNet Coverage ReportLines:100.0 %384384
Test Date:2024-05-06 17:54:04Functions:100.0 %6161
Legend: Rating: - low: < 75 % - medium: >= 75 % - high: >= 90 % -
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Filename Sort by file nameLine Coverage ( show details ) Sort by line coverageFunction Coverage Sort by function coverage
Rate Total Hit Rate Total Hit
Network.h -
100.0%
-
100.0 %11100.0 %11
Node.cc -
100.0%
-
100.0 %8888100.0 %2020
Network.cc -
100.0%
-
100.0 %295295100.0 %4040
-
-
- - - - -
Generated by: LCOV version 2.0-1
-
- - - diff --git a/html/bayesnet/network/index-sort-l.html b/html/bayesnet/network/index-sort-l.html deleted file mode 100644 index b032e99..0000000 --- a/html/bayesnet/network/index-sort-l.html +++ /dev/null @@ -1,138 +0,0 @@ - - - - - - - LCOV - BayesNet Coverage Report - bayesnet/network - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - bayesnet/networkCoverageTotalHit
Test:BayesNet Coverage ReportLines:100.0 %384384
Test Date:2024-05-06 17:54:04Functions:100.0 %6161
Legend: Rating: - low: < 75 % - medium: >= 75 % - high: >= 90 % -
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Filename Sort by file nameLine Coverage ( show details ) Sort by line coverageFunction Coverage Sort by function coverage
Rate Total Hit Rate Total Hit
Network.h -
100.0%
-
100.0 %11100.0 %11
Node.cc -
100.0%
-
100.0 %8888100.0 %2020
Network.cc -
100.0%
-
100.0 %295295100.0 %4040
-
-
- - - - -
Generated by: LCOV version 2.0-1
-
- - - diff --git a/html/bayesnet/network/index.html b/html/bayesnet/network/index.html deleted file mode 100644 index 60f89a2..0000000 --- a/html/bayesnet/network/index.html +++ /dev/null @@ -1,138 +0,0 @@ - - - - - - - LCOV - BayesNet Coverage Report - bayesnet/network - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - bayesnet/networkCoverageTotalHit
Test:BayesNet Coverage ReportLines:100.0 %384384
Test Date:2024-05-06 17:54:04Functions:100.0 %6161
Legend: Rating: - low: < 75 % - medium: >= 75 % - high: >= 90 % -
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Filename Sort by file nameLine Coverage ( show details ) Sort by line coverageFunction Coverage Sort by function coverage
Rate Total Hit Rate Total Hit
Network.cc -
100.0%
-
100.0 %295295100.0 %4040
Network.h -
100.0%
-
100.0 %11100.0 %11
Node.cc -
100.0%
-
100.0 %8888100.0 %2020
-
-
- - - - -
Generated by: LCOV version 2.0-1
-
- - - diff --git a/html/bayesnet/utils/BayesMetrics.cc.func-c.html b/html/bayesnet/utils/BayesMetrics.cc.func-c.html deleted file mode 100644 index 4a62b6f..0000000 --- a/html/bayesnet/utils/BayesMetrics.cc.func-c.html +++ /dev/null @@ -1,160 +0,0 @@ - - - - - - - LCOV - BayesNet Coverage Report - bayesnet/utils/BayesMetrics.cc - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - bayesnet/utils - BayesMetrics.cc (source / functions)CoverageTotalHit
Test:BayesNet Coverage ReportLines:98.2 %114112
Test Date:2024-05-06 17:54:04Functions:100.0 %1111
Legend: Lines: - hit - not hit -
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Function Name Sort by function nameHit count Sort by function hit count
bayesnet::Metrics::getScoresKBest() const48
bayesnet::Metrics::Metrics(std::vector<std::vector<int, std::allocator<int> >, std::allocator<std::vector<int, std::allocator<int> > > > const&, std::vector<int, std::allocator<int> > const&, std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, int)96
bayesnet::Metrics::maximumSpanningTree(std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > const&, at::Tensor const&, int)148
bayesnet::Metrics::conditionalEdge(at::Tensor const&)152
bayesnet::Metrics::SelectKBestWeighted(at::Tensor const&, bool, unsigned int)478
bayesnet::Metrics::SelectKBestWeighted(at::Tensor const&, bool, unsigned int)::{lambda(int, int)#1}::operator()(int, int) const2088
bayesnet::Metrics::Metrics(at::Tensor const&, std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, int)2123
bayesnet::Metrics::conditionalEntropy(at::Tensor const&, at::Tensor const&, at::Tensor const&)34276
bayesnet::Metrics::mutualInformation(at::Tensor const&, at::Tensor const&, at::Tensor const&)34276
bayesnet::Metrics::entropy(at::Tensor const&, at::Tensor const&)41732
bayesnet::Metrics::SelectKBestWeighted(at::Tensor const&, bool, unsigned int)::{lambda(int, int)#2}::operator()(int, int) const64808
-
-
- - - -
Generated by: LCOV version 2.0-1
-
- - - diff --git a/html/bayesnet/utils/BayesMetrics.cc.func.html b/html/bayesnet/utils/BayesMetrics.cc.func.html deleted file mode 100644 index bd8292c..0000000 --- a/html/bayesnet/utils/BayesMetrics.cc.func.html +++ /dev/null @@ -1,160 +0,0 @@ - - - - - - - LCOV - BayesNet Coverage Report - bayesnet/utils/BayesMetrics.cc - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - bayesnet/utils - BayesMetrics.cc (source / functions)CoverageTotalHit
Test:BayesNet Coverage ReportLines:98.2 %114112
Test Date:2024-05-06 17:54:04Functions:100.0 %1111
Legend: Lines: - hit - not hit -
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Function Name Sort by function nameHit count Sort by function hit count
bayesnet::Metrics::Metrics(at::Tensor const&, std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, int)2123
bayesnet::Metrics::Metrics(std::vector<std::vector<int, std::allocator<int> >, std::allocator<std::vector<int, std::allocator<int> > > > const&, std::vector<int, std::allocator<int> > const&, std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, int)96
bayesnet::Metrics::SelectKBestWeighted(at::Tensor const&, bool, unsigned int)478
bayesnet::Metrics::SelectKBestWeighted(at::Tensor const&, bool, unsigned int)::{lambda(int, int)#1}::operator()(int, int) const2088
bayesnet::Metrics::SelectKBestWeighted(at::Tensor const&, bool, unsigned int)::{lambda(int, int)#2}::operator()(int, int) const64808
bayesnet::Metrics::conditionalEdge(at::Tensor const&)152
bayesnet::Metrics::conditionalEntropy(at::Tensor const&, at::Tensor const&, at::Tensor const&)34276
bayesnet::Metrics::entropy(at::Tensor const&, at::Tensor const&)41732
bayesnet::Metrics::getScoresKBest() const48
bayesnet::Metrics::maximumSpanningTree(std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > const&, at::Tensor const&, int)148
bayesnet::Metrics::mutualInformation(at::Tensor const&, at::Tensor const&, at::Tensor const&)34276
-
-
- - - -
Generated by: LCOV version 2.0-1
-
- - - diff --git a/html/bayesnet/utils/BayesMetrics.cc.gcov.frameset.html b/html/bayesnet/utils/BayesMetrics.cc.gcov.frameset.html deleted file mode 100644 index b487ab4..0000000 --- a/html/bayesnet/utils/BayesMetrics.cc.gcov.frameset.html +++ /dev/null @@ -1,19 +0,0 @@ - - - - - - - LCOV - BayesNet Coverage Report - bayesnet/utils/BayesMetrics.cc - - - - - - - - <center>Frames not supported by your browser!<br></center> - - - - diff --git a/html/bayesnet/utils/BayesMetrics.cc.gcov.html b/html/bayesnet/utils/BayesMetrics.cc.gcov.html deleted file mode 100644 index 9c67e25..0000000 --- a/html/bayesnet/utils/BayesMetrics.cc.gcov.html +++ /dev/null @@ -1,245 +0,0 @@ - - - - - - - LCOV - BayesNet Coverage Report - bayesnet/utils/BayesMetrics.cc - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - bayesnet/utils - BayesMetrics.cc (source / functions)CoverageTotalHit
Test:BayesNet Coverage ReportLines:98.2 %114112
Test Date:2024-05-06 17:54:04Functions:100.0 %1111
Legend: Lines: - hit - not hit -
-
- - - - - - - - -

-
            Line data    Source code
-
-       1              : // ***************************************************************
-       2              : // SPDX-FileCopyrightText: Copyright 2024 Ricardo Montañana Gómez
-       3              : // SPDX-FileType: SOURCE
-       4              : // SPDX-License-Identifier: MIT
-       5              : // ***************************************************************
-       6              : 
-       7              : #include "Mst.h"
-       8              : #include "BayesMetrics.h"
-       9              : namespace bayesnet {
-      10              :     //samples is n+1xm tensor used to fit the model
-      11         2123 :     Metrics::Metrics(const torch::Tensor& samples, const std::vector<std::string>& features, const std::string& className, const int classNumStates)
-      12         2123 :         : samples(samples)
-      13         2123 :         , className(className)
-      14         2123 :         , features(features)
-      15         2123 :         , classNumStates(classNumStates)
-      16              :     {
-      17         2123 :     }
-      18              :     //samples is n+1xm std::vector used to fit the model
-      19           96 :     Metrics::Metrics(const std::vector<std::vector<int>>& vsamples, const std::vector<int>& labels, const std::vector<std::string>& features, const std::string& className, const int classNumStates)
-      20           96 :         : samples(torch::zeros({ static_cast<int>(vsamples.size() + 1), static_cast<int>(vsamples[0].size()) }, torch::kInt32))
-      21           96 :         , className(className)
-      22           96 :         , features(features)
-      23           96 :         , classNumStates(classNumStates)
-      24              :     {
-      25          768 :         for (int i = 0; i < vsamples.size(); ++i) {
-      26         2688 :             samples.index_put_({ i,  "..." }, torch::tensor(vsamples[i], torch::kInt32));
-      27              :         }
-      28          384 :         samples.index_put_({ -1, "..." }, torch::tensor(labels, torch::kInt32));
-      29          864 :     }
-      30          478 :     std::vector<int> Metrics::SelectKBestWeighted(const torch::Tensor& weights, bool ascending, unsigned k)
-      31              :     {
-      32              :         // Return the K Best features 
-      33          478 :         auto n = features.size();
-      34          478 :         if (k == 0) {
-      35            6 :             k = n;
-      36              :         }
-      37              :         // compute scores
-      38          478 :         scoresKBest.clear();
-      39          478 :         featuresKBest.clear();
-      40         1434 :         auto label = samples.index({ -1, "..." });
-      41        10522 :         for (int i = 0; i < n; ++i) {
-      42        30132 :             scoresKBest.push_back(mutualInformation(label, samples.index({ i, "..." }), weights));
-      43        10044 :             featuresKBest.push_back(i);
-      44              :         }
-      45              :         // sort & reduce scores and features
-      46          478 :         if (ascending) {
-      47           94 :             sort(featuresKBest.begin(), featuresKBest.end(), [&](int i, int j)
-      48         2088 :                 { return scoresKBest[i] < scoresKBest[j]; });
-      49           94 :             sort(scoresKBest.begin(), scoresKBest.end(), std::less<double>());
-      50           94 :             if (k < n) {
-      51          154 :                 for (int i = 0; i < n - k; ++i) {
-      52          110 :                     featuresKBest.erase(featuresKBest.begin());
-      53          110 :                     scoresKBest.erase(scoresKBest.begin());
-      54              :                 }
-      55              :             }
-      56              :         } else {
-      57          384 :             sort(featuresKBest.begin(), featuresKBest.end(), [&](int i, int j)
-      58        64808 :                 { return scoresKBest[i] > scoresKBest[j]; });
-      59          384 :             sort(scoresKBest.begin(), scoresKBest.end(), std::greater<double>());
-      60          384 :             featuresKBest.resize(k);
-      61          384 :             scoresKBest.resize(k);
-      62              :         }
-      63          956 :         return featuresKBest;
-      64        11000 :     }
-      65           48 :     std::vector<double> Metrics::getScoresKBest() const
-      66              :     {
-      67           48 :         return scoresKBest;
-      68              :     }
-      69              : 
-      70          152 :     torch::Tensor Metrics::conditionalEdge(const torch::Tensor& weights)
-      71              :     {
-      72          152 :         auto result = std::vector<double>();
-      73          152 :         auto source = std::vector<std::string>(features);
-      74          152 :         source.push_back(className);
-      75          152 :         auto combinations = doCombinations(source);
-      76              :         // Compute class prior
-      77          152 :         auto margin = torch::zeros({ classNumStates }, torch::kFloat);
-      78          828 :         for (int value = 0; value < classNumStates; ++value) {
-      79         2704 :             auto mask = samples.index({ -1,  "..." }) == value;
-      80          676 :             margin[value] = mask.sum().item<double>() / samples.size(1);
-      81          676 :         }
-      82         4164 :         for (auto [first, second] : combinations) {
-      83         4012 :             int index_first = find(features.begin(), features.end(), first) - features.begin();
-      84         4012 :             int index_second = find(features.begin(), features.end(), second) - features.begin();
-      85         4012 :             double accumulated = 0;
-      86        23820 :             for (int value = 0; value < classNumStates; ++value) {
-      87        79232 :                 auto mask = samples.index({ -1, "..." }) == value;
-      88        59424 :                 auto first_dataset = samples.index({ index_first, mask });
-      89        59424 :                 auto second_dataset = samples.index({ index_second, mask });
-      90        39616 :                 auto weights_dataset = weights.index({ mask });
-      91        39616 :                 auto mi = mutualInformation(first_dataset, second_dataset, weights_dataset);
-      92        19808 :                 auto pb = margin[value].item<double>();
-      93        19808 :                 accumulated += pb * mi;
-      94        19808 :             }
-      95         4012 :             result.push_back(accumulated);
-      96         4012 :         }
-      97          152 :         long n_vars = source.size();
-      98          152 :         auto matrix = torch::zeros({ n_vars, n_vars });
-      99          152 :         auto indices = torch::triu_indices(n_vars, n_vars, 1);
-     100         4164 :         for (auto i = 0; i < result.size(); ++i) {
-     101         4012 :             auto x = indices[0][i];
-     102         4012 :             auto y = indices[1][i];
-     103         4012 :             matrix[x][y] = result[i];
-     104         4012 :             matrix[y][x] = result[i];
-     105         4012 :         }
-     106          304 :         return matrix;
-     107        99868 :     }
-     108        41732 :     double Metrics::entropy(const torch::Tensor& feature, const torch::Tensor& weights)
-     109              :     {
-     110        41732 :         torch::Tensor counts = feature.bincount(weights);
-     111        41732 :         double totalWeight = counts.sum().item<double>();
-     112        41732 :         torch::Tensor probs = counts.to(torch::kFloat) / totalWeight;
-     113        41732 :         torch::Tensor logProbs = torch::log(probs);
-     114        41732 :         torch::Tensor entropy = -probs * logProbs;
-     115        83464 :         return entropy.nansum().item<double>();
-     116        41732 :     }
-     117              :     // H(Y|X) = sum_{x in X} p(x) H(Y|X=x)
-     118        34276 :     double Metrics::conditionalEntropy(const torch::Tensor& firstFeature, const torch::Tensor& secondFeature, const torch::Tensor& weights)
-     119              :     {
-     120        34276 :         int numSamples = firstFeature.sizes()[0];
-     121        34276 :         torch::Tensor featureCounts = secondFeature.bincount(weights);
-     122        34276 :         std::unordered_map<int, std::unordered_map<int, double>> jointCounts;
-     123        34276 :         double totalWeight = 0;
-     124      6993324 :         for (auto i = 0; i < numSamples; i++) {
-     125      6959048 :             jointCounts[secondFeature[i].item<int>()][firstFeature[i].item<int>()] += weights[i].item<double>();
-     126      6959048 :             totalWeight += weights[i].item<float>();
-     127              :         }
-     128        34276 :         if (totalWeight == 0)
-     129            0 :             return 0;
-     130        34276 :         double entropyValue = 0;
-     131       168251 :         for (int value = 0; value < featureCounts.sizes()[0]; ++value) {
-     132       133975 :             double p_f = featureCounts[value].item<double>() / totalWeight;
-     133       133975 :             double entropy_f = 0;
-     134       454356 :             for (auto& [label, jointCount] : jointCounts[value]) {
-     135       320381 :                 double p_l_f = jointCount / featureCounts[value].item<double>();
-     136       320381 :                 if (p_l_f > 0) {
-     137       320381 :                     entropy_f -= p_l_f * log(p_l_f);
-     138              :                 } else {
-     139            0 :                     entropy_f = 0;
-     140              :                 }
-     141              :             }
-     142       133975 :             entropyValue += p_f * entropy_f;
-     143              :         }
-     144        34276 :         return entropyValue;
-     145        34276 :     }
-     146              :     // I(X;Y) = H(Y) - H(Y|X)
-     147        34276 :     double Metrics::mutualInformation(const torch::Tensor& firstFeature, const torch::Tensor& secondFeature, const torch::Tensor& weights)
-     148              :     {
-     149        34276 :         return entropy(firstFeature, weights) - conditionalEntropy(firstFeature, secondFeature, weights);
-     150              :     }
-     151              :     /*
-     152              :     Compute the maximum spanning tree considering the weights as distances
-     153              :     and the indices of the weights as nodes of this square matrix using
-     154              :     Kruskal algorithm
-     155              :     */
-     156          148 :     std::vector<std::pair<int, int>> Metrics::maximumSpanningTree(const std::vector<std::string>& features, const torch::Tensor& weights, const int root)
-     157              :     {
-     158          148 :         auto mst = MST(features, weights, root);
-     159          296 :         return mst.maximumSpanningTree();
-     160          148 :     }
-     161              : }
-        
-
-
- - - - -
Generated by: LCOV version 2.0-1
-
- - - diff --git a/html/bayesnet/utils/BayesMetrics.cc.gcov.overview.html b/html/bayesnet/utils/BayesMetrics.cc.gcov.overview.html deleted file mode 100644 index 3c88dcb..0000000 --- a/html/bayesnet/utils/BayesMetrics.cc.gcov.overview.html +++ /dev/null @@ -1,61 +0,0 @@ - - - - - - LCOV - BayesNet Coverage Report - bayesnet/utils/BayesMetrics.cc - - - - - - - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - - -
- Top

- Overview -
- - diff --git a/html/bayesnet/utils/BayesMetrics.cc.gcov.png b/html/bayesnet/utils/BayesMetrics.cc.gcov.png deleted file mode 100644 index 30f9de1..0000000 Binary files a/html/bayesnet/utils/BayesMetrics.cc.gcov.png and /dev/null differ diff --git a/html/bayesnet/utils/BayesMetrics.h.func-c.html b/html/bayesnet/utils/BayesMetrics.h.func-c.html deleted file mode 100644 index e1f2f23..0000000 --- a/html/bayesnet/utils/BayesMetrics.h.func-c.html +++ /dev/null @@ -1,118 +0,0 @@ - - - - - - - LCOV - BayesNet Coverage Report - bayesnet/utils/BayesMetrics.h - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - bayesnet/utils - BayesMetrics.h (source / functions)CoverageTotalHit
Test:BayesNet Coverage ReportLines:100.0 %1313
Test Date:2024-05-06 17:54:04Functions:100.0 %44
Legend: Lines: - hit - not hit -
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Function Name Sort by function nameHit count Sort by function hit count
int bayesnet::Metrics::pop_first<int>(std::vector<int, std::allocator<int> >&)94
std::vector<std::pair<int, int>, std::allocator<std::pair<int, int> > > bayesnet::Metrics::doCombinations<int>(std::vector<int, std::allocator<int> > const&)1391
std::vector, std::allocator >, std::__cxx11::basic_string, std::allocator > >, std::allocator, std::allocator >, std::__cxx11::basic_string, std::allocator > > > > bayesnet::Metrics::doCombinations, std::allocator > >(std::vector, std::allocator >, std::allocator, std::allocator > > > const&)152
std::vector, std::allocator > > bayesnet::Metrics::doCombinations(std::vector > const&)1239
bayesnet::Metrics::Metrics()2240
-
-
- - - -
Generated by: LCOV version 2.0-1
-
- - - diff --git a/html/bayesnet/utils/BayesMetrics.h.func.html b/html/bayesnet/utils/BayesMetrics.h.func.html deleted file mode 100644 index 9e066cc..0000000 --- a/html/bayesnet/utils/BayesMetrics.h.func.html +++ /dev/null @@ -1,118 +0,0 @@ - - - - - - - LCOV - BayesNet Coverage Report - bayesnet/utils/BayesMetrics.h - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - bayesnet/utils - BayesMetrics.h (source / functions)CoverageTotalHit
Test:BayesNet Coverage ReportLines:100.0 %1313
Test Date:2024-05-06 17:54:04Functions:100.0 %44
Legend: Lines: - hit - not hit -
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Function Name Sort by function nameHit count Sort by function hit count
bayesnet::Metrics::Metrics()2240
int bayesnet::Metrics::pop_first<int>(std::vector<int, std::allocator<int> >&)94
std::vector<std::pair<int, int>, std::allocator<std::pair<int, int> > > bayesnet::Metrics::doCombinations<int>(std::vector<int, std::allocator<int> > const&)1391
std::vector, std::allocator > > bayesnet::Metrics::doCombinations(std::vector > const&)1239
std::vector, std::allocator >, std::__cxx11::basic_string, std::allocator > >, std::allocator, std::allocator >, std::__cxx11::basic_string, std::allocator > > > > bayesnet::Metrics::doCombinations, std::allocator > >(std::vector, std::allocator >, std::allocator, std::allocator > > > const&)152
-
-
- - - -
Generated by: LCOV version 2.0-1
-
- - - diff --git a/html/bayesnet/utils/BayesMetrics.h.gcov.frameset.html b/html/bayesnet/utils/BayesMetrics.h.gcov.frameset.html deleted file mode 100644 index 81a526c..0000000 --- a/html/bayesnet/utils/BayesMetrics.h.gcov.frameset.html +++ /dev/null @@ -1,19 +0,0 @@ - - - - - - - LCOV - BayesNet Coverage Report - bayesnet/utils/BayesMetrics.h - - - - - - - - <center>Frames not supported by your browser!<br></center> - - - - diff --git a/html/bayesnet/utils/BayesMetrics.h.gcov.html b/html/bayesnet/utils/BayesMetrics.h.gcov.html deleted file mode 100644 index 1ac7634..0000000 --- a/html/bayesnet/utils/BayesMetrics.h.gcov.html +++ /dev/null @@ -1,138 +0,0 @@ - - - - - - - LCOV - BayesNet Coverage Report - bayesnet/utils/BayesMetrics.h - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - bayesnet/utils - BayesMetrics.h (source / functions)CoverageTotalHit
Test:BayesNet Coverage ReportLines:100.0 %1313
Test Date:2024-05-06 17:54:04Functions:100.0 %44
Legend: Lines: - hit - not hit -
-
- - - - - - - - -

-
            Line data    Source code
-
-       1              : // ***************************************************************
-       2              : // SPDX-FileCopyrightText: Copyright 2024 Ricardo Montañana Gómez
-       3              : // SPDX-FileType: SOURCE
-       4              : // SPDX-License-Identifier: MIT
-       5              : // ***************************************************************
-       6              : 
-       7              : #ifndef BAYESNET_METRICS_H
-       8              : #define BAYESNET_METRICS_H
-       9              : #include <vector>
-      10              : #include <string>
-      11              : #include <torch/torch.h>
-      12              : namespace bayesnet {
-      13              :     class Metrics {
-      14              :     public:
-      15         2240 :         Metrics() = default;
-      16              :         Metrics(const torch::Tensor& samples, const std::vector<std::string>& features, const std::string& className, const int classNumStates);
-      17              :         Metrics(const std::vector<std::vector<int>>& vsamples, const std::vector<int>& labels, const std::vector<std::string>& features, const std::string& className, const int classNumStates);
-      18              :         std::vector<int> SelectKBestWeighted(const torch::Tensor& weights, bool ascending = false, unsigned k = 0);
-      19              :         std::vector<double> getScoresKBest() const;
-      20              :         double mutualInformation(const torch::Tensor& firstFeature, const torch::Tensor& secondFeature, const torch::Tensor& weights);
-      21              :         torch::Tensor conditionalEdge(const torch::Tensor& weights);
-      22              :         std::vector<std::pair<int, int>> maximumSpanningTree(const std::vector<std::string>& features, const torch::Tensor& weights, const int root);
-      23              :     protected:
-      24              :         torch::Tensor samples; // n+1xm torch::Tensor used to fit the model where samples[-1] is the y std::vector
-      25              :         std::string className;
-      26              :         double entropy(const torch::Tensor& feature, const torch::Tensor& weights);
-      27              :         std::vector<std::string> features;
-      28              :         template <class T>
-      29         1391 :         std::vector<std::pair<T, T>> doCombinations(const std::vector<T>& source)
-      30              :         {
-      31         1391 :             std::vector<std::pair<T, T>> result;
-      32         6981 :             for (int i = 0; i < source.size(); ++i) {
-      33         5590 :                 T temp = source[i];
-      34        16517 :                 for (int j = i + 1; j < source.size(); ++j) {
-      35        10927 :                     result.push_back({ temp, source[j] });
-      36              :                 }
-      37              :             }
-      38         2782 :             return result;
-      39         1391 :         }
-      40              :         template <class T>
-      41           94 :         T pop_first(std::vector<T>& v)
-      42              :         {
-      43           94 :             T temp = v[0];
-      44           94 :             v.erase(v.begin());
-      45           94 :             return temp;
-      46              :         }
-      47              :     private:
-      48              :         int classNumStates = 0;
-      49              :         std::vector<double> scoresKBest;
-      50              :         std::vector<int> featuresKBest; // sorted indices of the features
-      51              :         double conditionalEntropy(const torch::Tensor& firstFeature, const torch::Tensor& secondFeature, const torch::Tensor& weights);
-      52              :     };
-      53              : }
-      54              : #endif
-        
-
-
- - - - -
Generated by: LCOV version 2.0-1
-
- - - diff --git a/html/bayesnet/utils/BayesMetrics.h.gcov.overview.html b/html/bayesnet/utils/BayesMetrics.h.gcov.overview.html deleted file mode 100644 index df94876..0000000 --- a/html/bayesnet/utils/BayesMetrics.h.gcov.overview.html +++ /dev/null @@ -1,34 +0,0 @@ - - - - - - LCOV - BayesNet Coverage Report - bayesnet/utils/BayesMetrics.h - - - - - - - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - - -
- Top

- Overview -
- - diff --git a/html/bayesnet/utils/BayesMetrics.h.gcov.png b/html/bayesnet/utils/BayesMetrics.h.gcov.png deleted file mode 100644 index e051d4e..0000000 Binary files a/html/bayesnet/utils/BayesMetrics.h.gcov.png and /dev/null differ diff --git a/html/bayesnet/utils/Mst.cc.func-c.html b/html/bayesnet/utils/Mst.cc.func-c.html deleted file mode 100644 index 5525d06..0000000 --- a/html/bayesnet/utils/Mst.cc.func-c.html +++ /dev/null @@ -1,153 +0,0 @@ - - - - - - - LCOV - BayesNet Coverage Report - bayesnet/utils/Mst.cc - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - bayesnet/utils - Mst.cc (source / functions)CoverageTotalHit
Test:BayesNet Coverage ReportLines:94.1 %6864
Test Date:2024-05-06 17:54:04Functions:100.0 %1010
Legend: Lines: - hit - not hit -
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Function Name Sort by function nameHit count Sort by function hit count
bayesnet::Graph::Graph(int)148
bayesnet::Graph::kruskal_algorithm()148
bayesnet::MST::MST(std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > const&, at::Tensor const&, int)148
bayesnet::MST::maximumSpanningTree()148
bayesnet::reorder(std::vector<std::pair<float, std::pair<int, int> >, std::allocator<std::pair<float, std::pair<int, int> > > >, int)148
bayesnet::Graph::union_set(int, int)828
bayesnet::insertElement(std::__cxx11::list<int, std::allocator<int> >&, int)828
bayesnet::Graph::addEdge(int, int, float)3032
auto bayesnet::Graph::kruskal_algorithm()::{lambda(auto:1 const&, auto:2 const&)#1}::operator()<std::pair<float, std::pair<int, int> >, std::pair<float, std::pair<int, int> > >(std::pair<float, std::pair<int, int> > const&, std::pair<float, std::pair<int, int> > const&) const11716
bayesnet::Graph::find_set(int)14076
-
-
- - - -
Generated by: LCOV version 2.0-1
-
- - - diff --git a/html/bayesnet/utils/Mst.cc.func.html b/html/bayesnet/utils/Mst.cc.func.html deleted file mode 100644 index 166f248..0000000 --- a/html/bayesnet/utils/Mst.cc.func.html +++ /dev/null @@ -1,153 +0,0 @@ - - - - - - - LCOV - BayesNet Coverage Report - bayesnet/utils/Mst.cc - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - bayesnet/utils - Mst.cc (source / functions)CoverageTotalHit
Test:BayesNet Coverage ReportLines:94.1 %6864
Test Date:2024-05-06 17:54:04Functions:100.0 %1010
Legend: Lines: - hit - not hit -
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Function Name Sort by function nameHit count Sort by function hit count
auto bayesnet::Graph::kruskal_algorithm()::{lambda(auto:1 const&, auto:2 const&)#1}::operator()<std::pair<float, std::pair<int, int> >, std::pair<float, std::pair<int, int> > >(std::pair<float, std::pair<int, int> > const&, std::pair<float, std::pair<int, int> > const&) const11716
bayesnet::Graph::Graph(int)148
bayesnet::Graph::addEdge(int, int, float)3032
bayesnet::Graph::find_set(int)14076
bayesnet::Graph::kruskal_algorithm()148
bayesnet::Graph::union_set(int, int)828
bayesnet::MST::MST(std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > const&, at::Tensor const&, int)148
bayesnet::MST::maximumSpanningTree()148
bayesnet::insertElement(std::__cxx11::list<int, std::allocator<int> >&, int)828
bayesnet::reorder(std::vector<std::pair<float, std::pair<int, int> >, std::allocator<std::pair<float, std::pair<int, int> > > >, int)148
-
-
- - - -
Generated by: LCOV version 2.0-1
-
- - - diff --git a/html/bayesnet/utils/Mst.cc.gcov.frameset.html b/html/bayesnet/utils/Mst.cc.gcov.frameset.html deleted file mode 100644 index d702859..0000000 --- a/html/bayesnet/utils/Mst.cc.gcov.frameset.html +++ /dev/null @@ -1,19 +0,0 @@ - - - - - - - LCOV - BayesNet Coverage Report - bayesnet/utils/Mst.cc - - - - - - - - <center>Frames not supported by your browser!<br></center> - - - - diff --git a/html/bayesnet/utils/Mst.cc.gcov.html b/html/bayesnet/utils/Mst.cc.gcov.html deleted file mode 100644 index e567440..0000000 --- a/html/bayesnet/utils/Mst.cc.gcov.html +++ /dev/null @@ -1,204 +0,0 @@ - - - - - - - LCOV - BayesNet Coverage Report - bayesnet/utils/Mst.cc - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - bayesnet/utils - Mst.cc (source / functions)CoverageTotalHit
Test:BayesNet Coverage ReportLines:94.1 %6864
Test Date:2024-05-06 17:54:04Functions:100.0 %1010
Legend: Lines: - hit - not hit -
-
- - - - - - - - -

-
            Line data    Source code
-
-       1              : // ***************************************************************
-       2              : // SPDX-FileCopyrightText: Copyright 2024 Ricardo Montañana Gómez
-       3              : // SPDX-FileType: SOURCE
-       4              : // SPDX-License-Identifier: MIT
-       5              : // ***************************************************************
-       6              : 
-       7              : #include <sstream>
-       8              : #include <vector>
-       9              : #include <list>
-      10              : #include "Mst.h"
-      11              : /*
-      12              :     Based on the code from https://www.softwaretestinghelp.com/minimum-spanning-tree-tutorial/
-      13              : 
-      14              : */
-      15              : 
-      16              : namespace bayesnet {
-      17          296 :     Graph::Graph(int V) : V(V), parent(std::vector<int>(V))
-      18              :     {
-      19         1124 :         for (int i = 0; i < V; i++)
-      20          976 :             parent[i] = i;
-      21          148 :         G.clear();
-      22          148 :         T.clear();
-      23          148 :     }
-      24         3032 :     void Graph::addEdge(int u, int v, float wt)
-      25              :     {
-      26         3032 :         G.push_back({ wt, { u, v } });
-      27         3032 :     }
-      28        14076 :     int Graph::find_set(int i)
-      29              :     {
-      30              :         // If i is the parent of itself
-      31        14076 :         if (i == parent[i])
-      32         6064 :             return i;
-      33              :         else
-      34              :             //else recursively find the parent of i
-      35         8012 :             return find_set(parent[i]);
-      36              :     }
-      37          828 :     void Graph::union_set(int u, int v)
-      38              :     {
-      39          828 :         parent[u] = parent[v];
-      40          828 :     }
-      41          148 :     void Graph::kruskal_algorithm()
-      42              :     {
-      43              :         // sort the edges ordered on decreasing weight
-      44        11864 :         stable_sort(G.begin(), G.end(), [](const auto& left, const auto& right) {return left.first > right.first;});
-      45         3180 :         for (int i = 0; i < G.size(); i++) {
-      46              :             int uSt, vEd;
-      47         3032 :             uSt = find_set(G[i].second.first);
-      48         3032 :             vEd = find_set(G[i].second.second);
-      49         3032 :             if (uSt != vEd) {
-      50          828 :                 T.push_back(G[i]); // add to mst std::vector
-      51          828 :                 union_set(uSt, vEd);
-      52              :             }
-      53              :         }
-      54          148 :     }
-      55              : 
-      56          828 :     void insertElement(std::list<int>& variables, int variable)
-      57              :     {
-      58          828 :         if (std::find(variables.begin(), variables.end(), variable) == variables.end()) {
-      59          828 :             variables.push_front(variable);
-      60              :         }
-      61          828 :     }
-      62              : 
-      63          148 :     std::vector<std::pair<int, int>> reorder(std::vector<std::pair<float, std::pair<int, int>>> T, int root_original)
-      64              :     {
-      65              :         // Create the edges of a DAG from the MST
-      66              :         // replacing unordered_set with list because unordered_set cannot guarantee the order of the elements inserted
-      67          148 :         auto result = std::vector<std::pair<int, int>>();
-      68          148 :         auto visited = std::vector<int>();
-      69          148 :         auto nextVariables = std::list<int>();
-      70          148 :         nextVariables.push_front(root_original);
-      71         1124 :         while (nextVariables.size() > 0) {
-      72          976 :             int root = nextVariables.front();
-      73          976 :             nextVariables.pop_front();
-      74         3464 :             for (int i = 0; i < T.size(); ++i) {
-      75         2488 :                 auto [weight, edge] = T[i];
-      76         2488 :                 auto [from, to] = edge;
-      77         2488 :                 if (from == root || to == root) {
-      78          828 :                     visited.insert(visited.begin(), i);
-      79          828 :                     if (from == root) {
-      80          560 :                         result.push_back({ from, to });
-      81          560 :                         insertElement(nextVariables, to);
-      82              :                     } else {
-      83          268 :                         result.push_back({ to, from });
-      84          268 :                         insertElement(nextVariables, from);
-      85              :                     }
-      86              :                 }
-      87              :             }
-      88              :             // Remove visited
-      89         1804 :             for (int i = 0; i < visited.size(); ++i) {
-      90          828 :                 T.erase(T.begin() + visited[i]);
-      91              :             }
-      92          976 :             visited.clear();
-      93              :         }
-      94          148 :         if (T.size() > 0) {
-      95            0 :             for (int i = 0; i < T.size(); ++i) {
-      96            0 :                 auto [weight, edge] = T[i];
-      97            0 :                 auto [from, to] = edge;
-      98            0 :                 result.push_back({ from, to });
-      99              :             }
-     100              :         }
-     101          296 :         return result;
-     102          148 :     }
-     103              : 
-     104          148 :     MST::MST(const std::vector<std::string>& features, const torch::Tensor& weights, const int root) : features(features), weights(weights), root(root) {}
-     105          148 :     std::vector<std::pair<int, int>> MST::maximumSpanningTree()
-     106              :     {
-     107          148 :         auto num_features = features.size();
-     108          148 :         Graph g(num_features);
-     109              :         // Make a complete graph
-     110          976 :         for (int i = 0; i < num_features - 1; ++i) {
-     111         3860 :             for (int j = i + 1; j < num_features; ++j) {
-     112         3032 :                 g.addEdge(i, j, weights[i][j].item<float>());
-     113              :             }
-     114              :         }
-     115          148 :         g.kruskal_algorithm();
-     116          148 :         auto mst = g.get_mst();
-     117          296 :         return reorder(mst, root);
-     118          148 :     }
-     119              : 
-     120              : }
-        
-
-
- - - - -
Generated by: LCOV version 2.0-1
-
- - - diff --git a/html/bayesnet/utils/Mst.cc.gcov.overview.html b/html/bayesnet/utils/Mst.cc.gcov.overview.html deleted file mode 100644 index a8e6cda..0000000 --- a/html/bayesnet/utils/Mst.cc.gcov.overview.html +++ /dev/null @@ -1,50 +0,0 @@ - - - - - - LCOV - BayesNet Coverage Report - bayesnet/utils/Mst.cc - - - - - - - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - - -
- Top

- Overview -
- - diff --git a/html/bayesnet/utils/Mst.cc.gcov.png b/html/bayesnet/utils/Mst.cc.gcov.png deleted file mode 100644 index b6f615a..0000000 Binary files a/html/bayesnet/utils/Mst.cc.gcov.png and /dev/null differ diff --git a/html/bayesnet/utils/Mst.h.func-c.html b/html/bayesnet/utils/Mst.h.func-c.html deleted file mode 100644 index 9f7a122..0000000 --- a/html/bayesnet/utils/Mst.h.func-c.html +++ /dev/null @@ -1,90 +0,0 @@ - - - - - - - LCOV - BayesNet Coverage Report - bayesnet/utils/Mst.h - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - bayesnet/utils - Mst.h (source / functions)CoverageTotalHit
Test:BayesNet Coverage ReportLines:100.0 %11
Test Date:2024-05-06 17:54:04Functions:100.0 %11
Legend: Lines: - hit - not hit -
-
- -
- - - - - - - - - - - - - - - - -

Function Name Sort by function nameHit count Sort by function hit count
bayesnet::Graph::get_mst()148
-
-
- - - -
Generated by: LCOV version 2.0-1
-
- - - diff --git a/html/bayesnet/utils/Mst.h.func.html b/html/bayesnet/utils/Mst.h.func.html deleted file mode 100644 index c1c0139..0000000 --- a/html/bayesnet/utils/Mst.h.func.html +++ /dev/null @@ -1,90 +0,0 @@ - - - - - - - LCOV - BayesNet Coverage Report - bayesnet/utils/Mst.h - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - bayesnet/utils - Mst.h (source / functions)CoverageTotalHit
Test:BayesNet Coverage ReportLines:100.0 %11
Test Date:2024-05-06 17:54:04Functions:100.0 %11
Legend: Lines: - hit - not hit -
-
- -
- - - - - - - - - - - - - - - - -

Function Name Sort by function nameHit count Sort by function hit count
bayesnet::Graph::get_mst()148
-
-
- - - -
Generated by: LCOV version 2.0-1
-
- - - diff --git a/html/bayesnet/utils/Mst.h.gcov.frameset.html b/html/bayesnet/utils/Mst.h.gcov.frameset.html deleted file mode 100644 index 1290886..0000000 --- a/html/bayesnet/utils/Mst.h.gcov.frameset.html +++ /dev/null @@ -1,19 +0,0 @@ - - - - - - - LCOV - BayesNet Coverage Report - bayesnet/utils/Mst.h - - - - - - - - <center>Frames not supported by your browser!<br></center> - - - - diff --git a/html/bayesnet/utils/Mst.h.gcov.html b/html/bayesnet/utils/Mst.h.gcov.html deleted file mode 100644 index de46cc2..0000000 --- a/html/bayesnet/utils/Mst.h.gcov.html +++ /dev/null @@ -1,122 +0,0 @@ - - - - - - - LCOV - BayesNet Coverage Report - bayesnet/utils/Mst.h - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - bayesnet/utils - Mst.h (source / functions)CoverageTotalHit
Test:BayesNet Coverage ReportLines:100.0 %11
Test Date:2024-05-06 17:54:04Functions:100.0 %11
Legend: Lines: - hit - not hit -
-
- - - - - - - - -

-
            Line data    Source code
-
-       1              : // ***************************************************************
-       2              : // SPDX-FileCopyrightText: Copyright 2024 Ricardo Montañana Gómez
-       3              : // SPDX-FileType: SOURCE
-       4              : // SPDX-License-Identifier: MIT
-       5              : // ***************************************************************
-       6              : 
-       7              : #ifndef MST_H
-       8              : #define MST_H
-       9              : #include <vector>
-      10              : #include <string>
-      11              : #include <torch/torch.h>
-      12              : namespace bayesnet {
-      13              :     class MST {
-      14              :     public:
-      15              :         MST() = default;
-      16              :         MST(const std::vector<std::string>& features, const torch::Tensor& weights, const int root);
-      17              :         std::vector<std::pair<int, int>> maximumSpanningTree();
-      18              :     private:
-      19              :         torch::Tensor weights;
-      20              :         std::vector<std::string> features;
-      21              :         int root = 0;
-      22              :     };
-      23              :     class Graph {
-      24              :     public:
-      25              :         explicit Graph(int V);
-      26              :         void addEdge(int u, int v, float wt);
-      27              :         int find_set(int i);
-      28              :         void union_set(int u, int v);
-      29              :         void kruskal_algorithm();
-      30          148 :         std::vector <std::pair<float, std::pair<int, int>>> get_mst() { return T; }
-      31              :     private:
-      32              :         int V;      // number of nodes in graph
-      33              :         std::vector <std::pair<float, std::pair<int, int>>> G; // std::vector for graph
-      34              :         std::vector <std::pair<float, std::pair<int, int>>> T; // std::vector for mst
-      35              :         std::vector<int> parent;
-      36              :     };
-      37              : }
-      38              : #endif
-        
-
-
- - - - -
Generated by: LCOV version 2.0-1
-
- - - diff --git a/html/bayesnet/utils/Mst.h.gcov.overview.html b/html/bayesnet/utils/Mst.h.gcov.overview.html deleted file mode 100644 index 606c327..0000000 --- a/html/bayesnet/utils/Mst.h.gcov.overview.html +++ /dev/null @@ -1,30 +0,0 @@ - - - - - - LCOV - BayesNet Coverage Report - bayesnet/utils/Mst.h - - - - - - - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - - -
- Top

- Overview -
- - diff --git a/html/bayesnet/utils/Mst.h.gcov.png b/html/bayesnet/utils/Mst.h.gcov.png deleted file mode 100644 index 142bae3..0000000 Binary files a/html/bayesnet/utils/Mst.h.gcov.png and /dev/null differ diff --git a/html/bayesnet/utils/bayesnetUtils.cc.func-c.html b/html/bayesnet/utils/bayesnetUtils.cc.func-c.html deleted file mode 100644 index 02e3070..0000000 --- a/html/bayesnet/utils/bayesnetUtils.cc.func-c.html +++ /dev/null @@ -1,111 +0,0 @@ - - - - - - - LCOV - BayesNet Coverage Report - bayesnet/utils/bayesnetUtils.cc - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - bayesnet/utils - bayesnetUtils.cc (source / functions)CoverageTotalHit
Test:BayesNet Coverage ReportLines:100.0 %2525
Test Date:2024-05-06 17:54:04Functions:100.0 %44
Legend: Lines: - hit - not hit -
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Function Name Sort by function nameHit count Sort by function hit count
bayesnet::tensorToVectorDouble(at::Tensor&)32
bayesnet::vectorToTensor(std::vector<std::vector<int, std::allocator<int> >, std::allocator<std::vector<int, std::allocator<int> > > >&, bool)40
bayesnet::argsort(std::vector<double, std::allocator<double> >&)203
bayesnet::argsort(std::vector<double, std::allocator<double> >&)::{lambda(int, int)#1}::operator()(int, int) const4041
-
-
- - - -
Generated by: LCOV version 2.0-1
-
- - - diff --git a/html/bayesnet/utils/bayesnetUtils.cc.func.html b/html/bayesnet/utils/bayesnetUtils.cc.func.html deleted file mode 100644 index c679cbf..0000000 --- a/html/bayesnet/utils/bayesnetUtils.cc.func.html +++ /dev/null @@ -1,111 +0,0 @@ - - - - - - - LCOV - BayesNet Coverage Report - bayesnet/utils/bayesnetUtils.cc - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - bayesnet/utils - bayesnetUtils.cc (source / functions)CoverageTotalHit
Test:BayesNet Coverage ReportLines:100.0 %2525
Test Date:2024-05-06 17:54:04Functions:100.0 %44
Legend: Lines: - hit - not hit -
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Function Name Sort by function nameHit count Sort by function hit count
bayesnet::argsort(std::vector<double, std::allocator<double> >&)203
bayesnet::argsort(std::vector<double, std::allocator<double> >&)::{lambda(int, int)#1}::operator()(int, int) const4041
bayesnet::tensorToVectorDouble(at::Tensor&)32
bayesnet::vectorToTensor(std::vector<std::vector<int, std::allocator<int> >, std::allocator<std::vector<int, std::allocator<int> > > >&, bool)40
-
-
- - - -
Generated by: LCOV version 2.0-1
-
- - - diff --git a/html/bayesnet/utils/bayesnetUtils.cc.gcov.frameset.html b/html/bayesnet/utils/bayesnetUtils.cc.gcov.frameset.html deleted file mode 100644 index 6364c79..0000000 --- a/html/bayesnet/utils/bayesnetUtils.cc.gcov.frameset.html +++ /dev/null @@ -1,19 +0,0 @@ - - - - - - - LCOV - BayesNet Coverage Report - bayesnet/utils/bayesnetUtils.cc - - - - - - - - <center>Frames not supported by your browser!<br></center> - - - - diff --git a/html/bayesnet/utils/bayesnetUtils.cc.gcov.html b/html/bayesnet/utils/bayesnetUtils.cc.gcov.html deleted file mode 100644 index b393109..0000000 --- a/html/bayesnet/utils/bayesnetUtils.cc.gcov.html +++ /dev/null @@ -1,128 +0,0 @@ - - - - - - - LCOV - BayesNet Coverage Report - bayesnet/utils/bayesnetUtils.cc - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - bayesnet/utils - bayesnetUtils.cc (source / functions)CoverageTotalHit
Test:BayesNet Coverage ReportLines:100.0 %2525
Test Date:2024-05-06 17:54:04Functions:100.0 %44
Legend: Lines: - hit - not hit -
-
- - - - - - - - -

-
            Line data    Source code
-
-       1              : // ***************************************************************
-       2              : // SPDX-FileCopyrightText: Copyright 2024 Ricardo Montañana Gómez
-       3              : // SPDX-FileType: SOURCE
-       4              : // SPDX-License-Identifier: MIT
-       5              : // ***************************************************************
-       6              : 
-       7              : 
-       8              : #include "bayesnetUtils.h"
-       9              : namespace bayesnet {
-      10              :     // Return the indices in descending order
-      11          203 :     std::vector<int> argsort(std::vector<double>& nums)
-      12              :     {
-      13          203 :         int n = nums.size();
-      14          203 :         std::vector<int> indices(n);
-      15          203 :         iota(indices.begin(), indices.end(), 0);
-      16         4244 :         sort(indices.begin(), indices.end(), [&nums](int i, int j) {return nums[i] > nums[j];});
-      17          406 :         return indices;
-      18          203 :     }
-      19           32 :     std::vector<std::vector<double>> tensorToVectorDouble(torch::Tensor& dtensor)
-      20              :     {
-      21              :         // convert mxn tensor to mxn std::vector
-      22           32 :         std::vector<std::vector<double>> result;
-      23              :         // Iterate over cols
-      24         8072 :         for (int i = 0; i < dtensor.size(0); ++i) {
-      25        24120 :             auto col_tensor = dtensor.index({ i, "..." });
-      26         8040 :             auto col = std::vector<double>(col_tensor.data_ptr<float>(), col_tensor.data_ptr<float>() + dtensor.size(1));
-      27         8040 :             result.push_back(col);
-      28         8040 :         }
-      29           64 :         return result;
-      30         8072 :     }
-      31           40 :     torch::Tensor vectorToTensor(std::vector<std::vector<int>>& vector, bool transpose)
-      32              :     {
-      33              :         // convert nxm std::vector to mxn tensor if transpose
-      34           40 :         long int m = transpose ? vector[0].size() : vector.size();
-      35           40 :         long int n = transpose ? vector.size() : vector[0].size();
-      36           40 :         auto tensor = torch::zeros({ m, n }, torch::kInt32);
-      37          276 :         for (int i = 0; i < m; ++i) {
-      38        57664 :             for (int j = 0; j < n; ++j) {
-      39        57428 :                 tensor[i][j] = transpose ? vector[j][i] : vector[i][j];
-      40              :             }
-      41              :         }
-      42           80 :         return tensor;
-      43           40 :     }
-      44              : }
-        
-
-
- - - - -
Generated by: LCOV version 2.0-1
-
- - - diff --git a/html/bayesnet/utils/bayesnetUtils.cc.gcov.overview.html b/html/bayesnet/utils/bayesnetUtils.cc.gcov.overview.html deleted file mode 100644 index a1add40..0000000 --- a/html/bayesnet/utils/bayesnetUtils.cc.gcov.overview.html +++ /dev/null @@ -1,31 +0,0 @@ - - - - - - LCOV - BayesNet Coverage Report - bayesnet/utils/bayesnetUtils.cc - - - - - - - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - overview - - -
- Top

- Overview -
- - diff --git a/html/bayesnet/utils/bayesnetUtils.cc.gcov.png b/html/bayesnet/utils/bayesnetUtils.cc.gcov.png deleted file mode 100644 index 297b589..0000000 Binary files a/html/bayesnet/utils/bayesnetUtils.cc.gcov.png and /dev/null differ diff --git a/html/bayesnet/utils/index-detail-sort-f.html b/html/bayesnet/utils/index-detail-sort-f.html deleted file mode 100644 index df7670c..0000000 --- a/html/bayesnet/utils/index-detail-sort-f.html +++ /dev/null @@ -1,162 +0,0 @@ - - - - - - - LCOV - BayesNet Coverage Report - bayesnet/utils - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - bayesnet/utilsCoverageTotalHit
Test:BayesNet Coverage ReportLines:97.3 %221215
Test Date:2024-05-06 17:54:04Functions:100.0 %3030
Legend: Rating: - low: < 75 % - medium: >= 75 % - high: >= 90 % -
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Filename Sort by file nameLine Coverage ( show details ) Sort by line coverageFunction Coverage Sort by function coverage
Rate Total Hit Rate Total Hit
Mst.h -
100.0%
-
100.0 %11100.0 %11
BayesMetrics.h -
100.0%
-
100.0 %1313100.0 %44
bayesnetUtils.cc -
100.0%
-
100.0 %2525100.0 %44
Mst.cc -
94.1%94.1%
-
94.1 %6864100.0 %1010
BayesMetrics.cc -
98.2%98.2%
-
98.2 %114112100.0 %1111
-
-
- - - - -
Generated by: LCOV version 2.0-1
-
- - - diff --git a/html/bayesnet/utils/index-detail-sort-l.html b/html/bayesnet/utils/index-detail-sort-l.html deleted file mode 100644 index aa1a79c..0000000 --- a/html/bayesnet/utils/index-detail-sort-l.html +++ /dev/null @@ -1,162 +0,0 @@ - - - - - - - LCOV - BayesNet Coverage Report - bayesnet/utils - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - bayesnet/utilsCoverageTotalHit
Test:BayesNet Coverage ReportLines:97.3 %221215
Test Date:2024-05-06 17:54:04Functions:100.0 %3030
Legend: Rating: - low: < 75 % - medium: >= 75 % - high: >= 90 % -
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Filename Sort by file nameLine Coverage ( show details ) Sort by line coverageFunction Coverage Sort by function coverage
Rate Total Hit Rate Total Hit
Mst.cc -
94.1%94.1%
-
94.1 %6864100.0 %1010
BayesMetrics.cc -
98.2%98.2%
-
98.2 %114112100.0 %1111
Mst.h -
100.0%
-
100.0 %11100.0 %11
BayesMetrics.h -
100.0%
-
100.0 %1313100.0 %44
bayesnetUtils.cc -
100.0%
-
100.0 %2525100.0 %44
-
-
- - - - -
Generated by: LCOV version 2.0-1
-
- - - diff --git a/html/bayesnet/utils/index-detail.html b/html/bayesnet/utils/index-detail.html deleted file mode 100644 index 1afd44b..0000000 --- a/html/bayesnet/utils/index-detail.html +++ /dev/null @@ -1,162 +0,0 @@ - - - - - - - LCOV - BayesNet Coverage Report - bayesnet/utils - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - bayesnet/utilsCoverageTotalHit
Test:BayesNet Coverage ReportLines:97.3 %221215
Test Date:2024-05-06 17:54:04Functions:100.0 %3030
Legend: Rating: - low: < 75 % - medium: >= 75 % - high: >= 90 % -
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Filename Sort by file nameLine Coverage ( show details ) Sort by line coverageFunction Coverage Sort by function coverage
Rate Total Hit Rate Total Hit
BayesMetrics.cc -
98.2%98.2%
-
98.2 %114112100.0 %1111
BayesMetrics.h -
100.0%
-
100.0 %1313100.0 %44
Mst.cc -
94.1%94.1%
-
94.1 %6864100.0 %1010
Mst.h -
100.0%
-
100.0 %11100.0 %11
bayesnetUtils.cc -
100.0%
-
100.0 %2525100.0 %44
-
-
- - - - -
Generated by: LCOV version 2.0-1
-
- - - diff --git a/html/bayesnet/utils/index-sort-f.html b/html/bayesnet/utils/index-sort-f.html deleted file mode 100644 index df7670c..0000000 --- a/html/bayesnet/utils/index-sort-f.html +++ /dev/null @@ -1,162 +0,0 @@ - - - - - - - LCOV - BayesNet Coverage Report - bayesnet/utils - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - bayesnet/utilsCoverageTotalHit
Test:BayesNet Coverage ReportLines:97.3 %221215
Test Date:2024-05-06 17:54:04Functions:100.0 %3030
Legend: Rating: - low: < 75 % - medium: >= 75 % - high: >= 90 % -
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Filename Sort by file nameLine Coverage ( show details ) Sort by line coverageFunction Coverage Sort by function coverage
Rate Total Hit Rate Total Hit
Mst.h -
100.0%
-
100.0 %11100.0 %11
BayesMetrics.h -
100.0%
-
100.0 %1313100.0 %44
bayesnetUtils.cc -
100.0%
-
100.0 %2525100.0 %44
Mst.cc -
94.1%94.1%
-
94.1 %6864100.0 %1010
BayesMetrics.cc -
98.2%98.2%
-
98.2 %114112100.0 %1111
-
-
- - - - -
Generated by: LCOV version 2.0-1
-
- - - diff --git a/html/bayesnet/utils/index-sort-l.html b/html/bayesnet/utils/index-sort-l.html deleted file mode 100644 index aa1a79c..0000000 --- a/html/bayesnet/utils/index-sort-l.html +++ /dev/null @@ -1,162 +0,0 @@ - - - - - - - LCOV - BayesNet Coverage Report - bayesnet/utils - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - bayesnet/utilsCoverageTotalHit
Test:BayesNet Coverage ReportLines:97.3 %221215
Test Date:2024-05-06 17:54:04Functions:100.0 %3030
Legend: Rating: - low: < 75 % - medium: >= 75 % - high: >= 90 % -
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Filename Sort by file nameLine Coverage ( show details ) Sort by line coverageFunction Coverage Sort by function coverage
Rate Total Hit Rate Total Hit
Mst.cc -
94.1%94.1%
-
94.1 %6864100.0 %1010
BayesMetrics.cc -
98.2%98.2%
-
98.2 %114112100.0 %1111
Mst.h -
100.0%
-
100.0 %11100.0 %11
BayesMetrics.h -
100.0%
-
100.0 %1313100.0 %44
bayesnetUtils.cc -
100.0%
-
100.0 %2525100.0 %44
-
-
- - - - -
Generated by: LCOV version 2.0-1
-
- - - diff --git a/html/bayesnet/utils/index.html b/html/bayesnet/utils/index.html deleted file mode 100644 index 1afd44b..0000000 --- a/html/bayesnet/utils/index.html +++ /dev/null @@ -1,162 +0,0 @@ - - - - - - - LCOV - BayesNet Coverage Report - bayesnet/utils - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - bayesnet/utilsCoverageTotalHit
Test:BayesNet Coverage ReportLines:97.3 %221215
Test Date:2024-05-06 17:54:04Functions:100.0 %3030
Legend: Rating: - low: < 75 % - medium: >= 75 % - high: >= 90 % -
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Filename Sort by file nameLine Coverage ( show details ) Sort by line coverageFunction Coverage Sort by function coverage
Rate Total Hit Rate Total Hit
BayesMetrics.cc -
98.2%98.2%
-
98.2 %114112100.0 %1111
BayesMetrics.h -
100.0%
-
100.0 %1313100.0 %44
Mst.cc -
94.1%94.1%
-
94.1 %6864100.0 %1010
Mst.h -
100.0%
-
100.0 %11100.0 %11
bayesnetUtils.cc -
100.0%
-
100.0 %2525100.0 %44
-
-
- - - - -
Generated by: LCOV version 2.0-1
-
- - - diff --git a/html/cmd_line b/html/cmd_line deleted file mode 100644 index fc7e89b..0000000 --- a/html/cmd_line +++ /dev/null @@ -1 +0,0 @@ -genhtml build_debug/tests/coverage.info --demangle-cpp --output-directory html --title 'BayesNet Coverage Report' -s -k -f --legend diff --git a/html/emerald.png b/html/emerald.png deleted file mode 100644 index 38ad4f4..0000000 Binary files a/html/emerald.png and /dev/null differ diff --git a/html/gcov.css b/html/gcov.css deleted file mode 100644 index f329042..0000000 --- a/html/gcov.css +++ /dev/null @@ -1,1073 +0,0 @@ -/* All views: initial background and text color */ -body -{ - color: #000000; - background-color: #ffffff; -} - -/* All views: standard link format*/ -a:link -{ - color: #284fa8; - text-decoration: underline; -} - -/* All views: standard link - visited format */ -a:visited -{ - color: #00cb40; - text-decoration: underline; -} - -/* All views: standard link - activated format */ -a:active -{ - color: #ff0040; - text-decoration: underline; -} - -/* All views: main title format */ -td.title -{ - text-align: center; - padding-bottom: 10px; - font-family: sans-serif; - font-size: 20pt; - font-style: italic; - font-weight: bold; -} -/* "Line coverage date bins" leader */ -td.subTableHeader -{ - text-align: center; - padding-bottom: 6px; - font-family: sans-serif; - font-weight: bold; - vertical-align: center; -} - -/* All views: header item format */ -td.headerItem -{ - text-align: right; - padding-right: 6px; - font-family: sans-serif; - font-weight: bold; - vertical-align: top; - white-space: nowrap; -} - -/* All views: header item value format */ -td.headerValue -{ - text-align: left; - color: #284fa8; - font-family: sans-serif; - font-weight: bold; - white-space: nowrap; -} - -/* All views: header item coverage table heading */ -td.headerCovTableHead -{ - text-align: center; - padding-right: 6px; - padding-left: 6px; - padding-bottom: 0px; - font-family: sans-serif; - white-space: nowrap; -} - -/* All views: header item coverage table entry */ -td.headerCovTableEntry -{ - text-align: right; - color: #284fa8; - font-family: sans-serif; - font-weight: bold; - white-space: nowrap; - padding-left: 12px; - padding-right: 4px; - background-color: #dae7fe; -} - -/* All views: header item coverage table entry for high coverage rate */ -td.headerCovTableEntryHi -{ - text-align: right; - color: #000000; - font-family: sans-serif; - font-weight: bold; - white-space: nowrap; - padding-left: 12px; - padding-right: 4px; - background-color: #a7fc9d; -} - -/* All views: header item coverage table entry for medium coverage rate */ -td.headerCovTableEntryMed -{ - text-align: right; - color: #000000; - font-family: sans-serif; - font-weight: bold; - white-space: nowrap; - padding-left: 12px; - padding-right: 4px; - background-color: #ffea20; -} - -/* All views: header item coverage table entry for ow coverage rate */ -td.headerCovTableEntryLo -{ - text-align: right; - color: #000000; - font-family: sans-serif; - font-weight: bold; - white-space: nowrap; - padding-left: 12px; - padding-right: 4px; - background-color: #ff0000; -} - -/* All views: header legend value for legend entry */ -td.headerValueLeg -{ - text-align: left; - color: #000000; - font-family: sans-serif; - font-size: 80%; - white-space: nowrap; - padding-top: 4px; -} - -/* All views: color of horizontal ruler */ -td.ruler -{ - background-color: #6688d4; -} - -/* All views: version string format */ -td.versionInfo -{ - text-align: center; - padding-top: 2px; - font-family: sans-serif; - font-style: italic; -} - -/* Directory view/File view (all)/Test case descriptions: - table headline format */ -td.tableHead -{ - text-align: center; - color: #ffffff; - background-color: #6688d4; - font-family: sans-serif; - font-size: 120%; - font-weight: bold; - white-space: nowrap; - padding-left: 4px; - padding-right: 4px; -} - -span.tableHeadSort -{ - padding-right: 4px; -} - -/* Directory view/File view (all): filename entry format */ -td.coverFile -{ - text-align: left; - padding-left: 10px; - padding-right: 20px; - color: #284fa8; - background-color: #dae7fe; - font-family: monospace; -} - -/* Directory view/File view (all): filename entry format */ -td.overallOwner -{ - text-align: center; - font-weight: bold; - font-family: sans-serif; - background-color: #dae7fe; - padding-right: 10px; - padding-left: 10px; -} - -/* Directory view/File view (all): filename entry format */ -td.ownerName -{ - text-align: right; - font-style: italic; - font-family: sans-serif; - background-color: #E5DBDB; - padding-right: 10px; - padding-left: 20px; -} - -/* Directory view/File view (all): bar-graph entry format*/ -td.coverBar -{ - padding-left: 10px; - padding-right: 10px; - background-color: #dae7fe; -} - -/* Directory view/File view (all): bar-graph entry format*/ -td.owner_coverBar -{ - padding-left: 10px; - padding-right: 10px; - background-color: #E5DBDB; -} - -/* Directory view/File view (all): bar-graph outline color */ -td.coverBarOutline -{ - background-color: #000000; -} - -/* Directory view/File view (all): percentage entry for files with - high coverage rate */ -td.coverPerHi -{ - text-align: right; - padding-left: 10px; - padding-right: 10px; - background-color: #a7fc9d; - font-weight: bold; - font-family: sans-serif; -} - -/* 'owner' entry: slightly lighter color than 'coverPerHi' */ -td.owner_coverPerHi -{ - text-align: right; - padding-left: 10px; - padding-right: 10px; - background-color: #82E0AA; - font-weight: bold; - font-family: sans-serif; -} - -/* Directory view/File view (all): line count entry */ -td.coverNumDflt -{ - text-align: right; - padding-left: 10px; - padding-right: 10px; - background-color: #dae7fe; - white-space: nowrap; - font-family: sans-serif; -} - -/* td background color and font for the 'owner' section of the table */ -td.ownerTla -{ - text-align: right; - padding-left: 10px; - padding-right: 10px; - background-color: #E5DBDB; - white-space: nowrap; - font-family: sans-serif; - font-style: italic; -} - -/* Directory view/File view (all): line count entry for files with - high coverage rate */ -td.coverNumHi -{ - text-align: right; - padding-left: 10px; - padding-right: 10px; - background-color: #a7fc9d; - white-space: nowrap; - font-family: sans-serif; -} - -td.owner_coverNumHi -{ - text-align: right; - padding-left: 10px; - padding-right: 10px; - background-color: #82E0AA; - white-space: nowrap; - font-family: sans-serif; -} - -/* Directory view/File view (all): percentage entry for files with - medium coverage rate */ -td.coverPerMed -{ - text-align: right; - padding-left: 10px; - padding-right: 10px; - background-color: #ffea20; - font-weight: bold; - font-family: sans-serif; -} - -td.owner_coverPerMed -{ - text-align: right; - padding-left: 10px; - padding-right: 10px; - background-color: #F9E79F; - font-weight: bold; - font-family: sans-serif; -} - -/* Directory view/File view (all): line count entry for files with - medium coverage rate */ -td.coverNumMed -{ - text-align: right; - padding-left: 10px; - padding-right: 10px; - background-color: #ffea20; - white-space: nowrap; - font-family: sans-serif; -} - -td.owner_coverNumMed -{ - text-align: right; - padding-left: 10px; - padding-right: 10px; - background-color: #F9E79F; - white-space: nowrap; - font-family: sans-serif; -} - -/* Directory view/File view (all): percentage entry for files with - low coverage rate */ -td.coverPerLo -{ - text-align: right; - padding-left: 10px; - padding-right: 10px; - background-color: #ff0000; - font-weight: bold; - font-family: sans-serif; -} - -td.owner_coverPerLo -{ - text-align: right; - padding-left: 10px; - padding-right: 10px; - background-color: #EC7063; - font-weight: bold; - font-family: sans-serif; -} - -/* Directory view/File view (all): line count entry for files with - low coverage rate */ -td.coverNumLo -{ - text-align: right; - padding-left: 10px; - padding-right: 10px; - background-color: #ff0000; - white-space: nowrap; - font-family: sans-serif; -} - -td.owner_coverNumLo -{ - text-align: right; - padding-left: 10px; - padding-right: 10px; - background-color: #EC7063; - white-space: nowrap; - font-family: sans-serif; -} - -/* File view (all): "show/hide details" link format */ -a.detail:link -{ - color: #b8d0ff; - font-size:80%; -} - -/* File view (all): "show/hide details" link - visited format */ -a.detail:visited -{ - color: #b8d0ff; - font-size:80%; -} - -/* File view (all): "show/hide details" link - activated format */ -a.detail:active -{ - color: #ffffff; - font-size:80%; -} - -/* File view (detail): test name entry */ -td.testName -{ - text-align: right; - padding-right: 10px; - background-color: #dae7fe; - font-family: sans-serif; -} - -/* File view (detail): test percentage entry */ -td.testPer -{ - text-align: right; - padding-left: 10px; - padding-right: 10px; - background-color: #dae7fe; - font-family: sans-serif; -} - -/* File view (detail): test lines count entry */ -td.testNum -{ - text-align: right; - padding-left: 10px; - padding-right: 10px; - background-color: #dae7fe; - font-family: sans-serif; -} - -/* Test case descriptions: test name format*/ -dt -{ - font-family: sans-serif; - font-weight: bold; -} - -/* Test case descriptions: description table body */ -td.testDescription -{ - padding-top: 10px; - padding-left: 30px; - padding-bottom: 10px; - padding-right: 30px; - background-color: #dae7fe; -} - -/* Source code view: function entry */ -td.coverFn -{ - text-align: left; - padding-left: 10px; - padding-right: 20px; - color: #284fa8; - background-color: #dae7fe; - font-family: monospace; -} - -/* Source code view: function entry zero count*/ -td.coverFnLo -{ - text-align: right; - padding-left: 10px; - padding-right: 10px; - background-color: #ff0000; - font-weight: bold; - font-family: sans-serif; -} - -/* Source code view: function entry nonzero count*/ -td.coverFnHi -{ - text-align: right; - padding-left: 10px; - padding-right: 10px; - background-color: #dae7fe; - font-weight: bold; - font-family: sans-serif; -} - -td.coverFnAlias -{ - text-align: right; - padding-left: 10px; - padding-right: 20px; - color: #284fa8; - /* make this a slightly different color than the leader - otherwise, - otherwise the alias is hard to distinguish in the table */ - background-color: #E5DBDB; /* very light pale grey/blue */ - font-family: monospace; -} - -/* Source code view: function entry zero count*/ -td.coverFnAliasLo -{ - text-align: right; - padding-left: 10px; - padding-right: 10px; - background-color: #EC7063; /* lighter red */ - font-family: sans-serif; -} - -/* Source code view: function entry nonzero count*/ -td.coverFnAliasHi -{ - text-align: right; - padding-left: 10px; - padding-right: 10px; - background-color: #dae7fe; - font-weight: bold; - font-family: sans-serif; -} - -/* Source code view: source code format */ -pre.source -{ - font-family: monospace; - white-space: pre; - margin-top: 2px; -} - -/* Source code view: line number format */ -span.lineNum -{ - background-color: #efe383; -} - -/* Source code view: format for Cov legend */ -span.coverLegendCov -{ - padding-left: 10px; - padding-right: 10px; - padding-bottom: 2px; - background-color: #cad7fe; -} - -/* Source code view: format for NoCov legend */ -span.coverLegendNoCov -{ - padding-left: 10px; - padding-right: 10px; - padding-bottom: 2px; - background-color: #ff6230; -} - -/* Source code view: format for the source code heading line */ -pre.sourceHeading -{ - white-space: pre; - font-family: monospace; - font-weight: bold; - margin: 0px; -} - -/* All views: header legend value for low rate */ -td.headerValueLegL -{ - font-family: sans-serif; - text-align: center; - white-space: nowrap; - padding-left: 4px; - padding-right: 2px; - background-color: #ff0000; - font-size: 80%; -} - -/* All views: header legend value for med rate */ -td.headerValueLegM -{ - font-family: sans-serif; - text-align: center; - white-space: nowrap; - padding-left: 2px; - padding-right: 2px; - background-color: #ffea20; - font-size: 80%; -} - -/* All views: header legend value for hi rate */ -td.headerValueLegH -{ - font-family: sans-serif; - text-align: center; - white-space: nowrap; - padding-left: 2px; - padding-right: 4px; - background-color: #a7fc9d; - font-size: 80%; -} - -/* All views except source code view: legend format for low coverage */ -span.coverLegendCovLo -{ - padding-left: 10px; - padding-right: 10px; - padding-top: 2px; - background-color: #ff0000; -} - -/* All views except source code view: legend format for med coverage */ -span.coverLegendCovMed -{ - padding-left: 10px; - padding-right: 10px; - padding-top: 2px; - background-color: #ffea20; -} - -/* All views except source code view: legend format for hi coverage */ -span.coverLegendCovHi -{ - padding-left: 10px; - padding-right: 10px; - padding-top: 2px; - background-color: #a7fc9d; -} - -a.branchTla:link -{ - color: #000000; -} - -a.branchTla:visited -{ - color: #000000; -} - -/* Source code view/table entry backround: format for lines classified as "Uncovered New Code (+ => 0): -Newly added code is not tested" */ -td.tlaUNC -{ - text-align: right; - background-color: #FF6230; -} -td.tlaBgUNC { - background-color: #FF6230; -} - -/* Source code view/table entry backround: format for lines classified as "Uncovered New Code (+ => 0): -Newly added code is not tested" */ -span.tlaUNC -{ - text-align: left; - background-color: #FF6230; -} -span.tlaBgUNC { - background-color: #FF6230; -} -a.tlaBgUNC { - background-color: #FF6230; - color: #000000; -} - -td.headerCovTableHeadUNC { - text-align: center; - padding-right: 6px; - padding-left: 6px; - padding-bottom: 0px; - font-family: sans-serif; - white-space: nowrap; - background-color: #FF6230; -} - -/* Source code view/table entry backround: format for lines classified as "Lost Baseline Coverage (1 => 0): -Unchanged code is no longer tested" */ -td.tlaLBC -{ - text-align: right; - background-color: #FF6230; -} -td.tlaBgLBC { - background-color: #FF6230; -} - -/* Source code view/table entry backround: format for lines classified as "Lost Baseline Coverage (1 => 0): -Unchanged code is no longer tested" */ -span.tlaLBC -{ - text-align: left; - background-color: #FF6230; -} -span.tlaBgLBC { - background-color: #FF6230; -} -a.tlaBgLBC { - background-color: #FF6230; - color: #000000; -} - -td.headerCovTableHeadLBC { - text-align: center; - padding-right: 6px; - padding-left: 6px; - padding-bottom: 0px; - font-family: sans-serif; - white-space: nowrap; - background-color: #FF6230; -} - -/* Source code view/table entry backround: format for lines classified as "Uncovered Included Code (# => 0): -Previously unused code is untested" */ -td.tlaUIC -{ - text-align: right; - background-color: #FF6230; -} -td.tlaBgUIC { - background-color: #FF6230; -} - -/* Source code view/table entry backround: format for lines classified as "Uncovered Included Code (# => 0): -Previously unused code is untested" */ -span.tlaUIC -{ - text-align: left; - background-color: #FF6230; -} -span.tlaBgUIC { - background-color: #FF6230; -} -a.tlaBgUIC { - background-color: #FF6230; - color: #000000; -} - -td.headerCovTableHeadUIC { - text-align: center; - padding-right: 6px; - padding-left: 6px; - padding-bottom: 0px; - font-family: sans-serif; - white-space: nowrap; - background-color: #FF6230; -} - -/* Source code view/table entry backround: format for lines classified as "Uncovered Baseline Code (0 => 0): -Unchanged code was untested before, is untested now" */ -td.tlaUBC -{ - text-align: right; - background-color: #FF6230; -} -td.tlaBgUBC { - background-color: #FF6230; -} - -/* Source code view/table entry backround: format for lines classified as "Uncovered Baseline Code (0 => 0): -Unchanged code was untested before, is untested now" */ -span.tlaUBC -{ - text-align: left; - background-color: #FF6230; -} -span.tlaBgUBC { - background-color: #FF6230; -} -a.tlaBgUBC { - background-color: #FF6230; - color: #000000; -} - -td.headerCovTableHeadUBC { - text-align: center; - padding-right: 6px; - padding-left: 6px; - padding-bottom: 0px; - font-family: sans-serif; - white-space: nowrap; - background-color: #FF6230; -} - -/* Source code view/table entry backround: format for lines classified as "Gained Baseline Coverage (0 => 1): -Unchanged code is tested now" */ -td.tlaGBC -{ - text-align: right; - background-color: #CAD7FE; -} -td.tlaBgGBC { - background-color: #CAD7FE; -} - -/* Source code view/table entry backround: format for lines classified as "Gained Baseline Coverage (0 => 1): -Unchanged code is tested now" */ -span.tlaGBC -{ - text-align: left; - background-color: #CAD7FE; -} -span.tlaBgGBC { - background-color: #CAD7FE; -} -a.tlaBgGBC { - background-color: #CAD7FE; - color: #000000; -} - -td.headerCovTableHeadGBC { - text-align: center; - padding-right: 6px; - padding-left: 6px; - padding-bottom: 0px; - font-family: sans-serif; - white-space: nowrap; - background-color: #CAD7FE; -} - -/* Source code view/table entry backround: format for lines classified as "Gained Included Coverage (# => 1): -Previously unused code is tested now" */ -td.tlaGIC -{ - text-align: right; - background-color: #CAD7FE; -} -td.tlaBgGIC { - background-color: #CAD7FE; -} - -/* Source code view/table entry backround: format for lines classified as "Gained Included Coverage (# => 1): -Previously unused code is tested now" */ -span.tlaGIC -{ - text-align: left; - background-color: #CAD7FE; -} -span.tlaBgGIC { - background-color: #CAD7FE; -} -a.tlaBgGIC { - background-color: #CAD7FE; - color: #000000; -} - -td.headerCovTableHeadGIC { - text-align: center; - padding-right: 6px; - padding-left: 6px; - padding-bottom: 0px; - font-family: sans-serif; - white-space: nowrap; - background-color: #CAD7FE; -} - -/* Source code view/table entry backround: format for lines classified as "Gained New Coverage (+ => 1): -Newly added code is tested" */ -td.tlaGNC -{ - text-align: right; - background-color: #CAD7FE; -} -td.tlaBgGNC { - background-color: #CAD7FE; -} - -/* Source code view/table entry backround: format for lines classified as "Gained New Coverage (+ => 1): -Newly added code is tested" */ -span.tlaGNC -{ - text-align: left; - background-color: #CAD7FE; -} -span.tlaBgGNC { - background-color: #CAD7FE; -} -a.tlaBgGNC { - background-color: #CAD7FE; - color: #000000; -} - -td.headerCovTableHeadGNC { - text-align: center; - padding-right: 6px; - padding-left: 6px; - padding-bottom: 0px; - font-family: sans-serif; - white-space: nowrap; - background-color: #CAD7FE; -} - -/* Source code view/table entry backround: format for lines classified as "Covered Baseline Code (1 => 1): -Unchanged code was tested before and is still tested" */ -td.tlaCBC -{ - text-align: right; - background-color: #CAD7FE; -} -td.tlaBgCBC { - background-color: #CAD7FE; -} - -/* Source code view/table entry backround: format for lines classified as "Covered Baseline Code (1 => 1): -Unchanged code was tested before and is still tested" */ -span.tlaCBC -{ - text-align: left; - background-color: #CAD7FE; -} -span.tlaBgCBC { - background-color: #CAD7FE; -} -a.tlaBgCBC { - background-color: #CAD7FE; - color: #000000; -} - -td.headerCovTableHeadCBC { - text-align: center; - padding-right: 6px; - padding-left: 6px; - padding-bottom: 0px; - font-family: sans-serif; - white-space: nowrap; - background-color: #CAD7FE; -} - -/* Source code view/table entry backround: format for lines classified as "Excluded Uncovered Baseline (0 => #): -Previously untested code is unused now" */ -td.tlaEUB -{ - text-align: right; - background-color: #FFFFFF; -} -td.tlaBgEUB { - background-color: #FFFFFF; -} - -/* Source code view/table entry backround: format for lines classified as "Excluded Uncovered Baseline (0 => #): -Previously untested code is unused now" */ -span.tlaEUB -{ - text-align: left; - background-color: #FFFFFF; -} -span.tlaBgEUB { - background-color: #FFFFFF; -} -a.tlaBgEUB { - background-color: #FFFFFF; - color: #000000; -} - -td.headerCovTableHeadEUB { - text-align: center; - padding-right: 6px; - padding-left: 6px; - padding-bottom: 0px; - font-family: sans-serif; - white-space: nowrap; - background-color: #FFFFFF; -} - -/* Source code view/table entry backround: format for lines classified as "Excluded Covered Baseline (1 => #): -Previously tested code is unused now" */ -td.tlaECB -{ - text-align: right; - background-color: #FFFFFF; -} -td.tlaBgECB { - background-color: #FFFFFF; -} - -/* Source code view/table entry backround: format for lines classified as "Excluded Covered Baseline (1 => #): -Previously tested code is unused now" */ -span.tlaECB -{ - text-align: left; - background-color: #FFFFFF; -} -span.tlaBgECB { - background-color: #FFFFFF; -} -a.tlaBgECB { - background-color: #FFFFFF; - color: #000000; -} - -td.headerCovTableHeadECB { - text-align: center; - padding-right: 6px; - padding-left: 6px; - padding-bottom: 0px; - font-family: sans-serif; - white-space: nowrap; - background-color: #FFFFFF; -} - -/* Source code view/table entry backround: format for lines classified as "Deleted Uncovered Baseline (0 => -): -Previously untested code has been deleted" */ -td.tlaDUB -{ - text-align: right; - background-color: #FFFFFF; -} -td.tlaBgDUB { - background-color: #FFFFFF; -} - -/* Source code view/table entry backround: format for lines classified as "Deleted Uncovered Baseline (0 => -): -Previously untested code has been deleted" */ -span.tlaDUB -{ - text-align: left; - background-color: #FFFFFF; -} -span.tlaBgDUB { - background-color: #FFFFFF; -} -a.tlaBgDUB { - background-color: #FFFFFF; - color: #000000; -} - -td.headerCovTableHeadDUB { - text-align: center; - padding-right: 6px; - padding-left: 6px; - padding-bottom: 0px; - font-family: sans-serif; - white-space: nowrap; - background-color: #FFFFFF; -} - -/* Source code view/table entry backround: format for lines classified as "Deleted Covered Baseline (1 => -): -Previously tested code has been deleted" */ -td.tlaDCB -{ - text-align: right; - background-color: #FFFFFF; -} -td.tlaBgDCB { - background-color: #FFFFFF; -} - -/* Source code view/table entry backround: format for lines classified as "Deleted Covered Baseline (1 => -): -Previously tested code has been deleted" */ -span.tlaDCB -{ - text-align: left; - background-color: #FFFFFF; -} -span.tlaBgDCB { - background-color: #FFFFFF; -} -a.tlaBgDCB { - background-color: #FFFFFF; - color: #000000; -} - -td.headerCovTableHeadDCB { - text-align: center; - padding-right: 6px; - padding-left: 6px; - padding-bottom: 0px; - font-family: sans-serif; - white-space: nowrap; - background-color: #FFFFFF; -} - -/* Source code view: format for date/owner bin that is not hit */ -span.missBins -{ - background-color: #ff0000 /* red */ -} diff --git a/html/glass.png b/html/glass.png deleted file mode 100644 index e1abc00..0000000 Binary files a/html/glass.png and /dev/null differ diff --git a/html/index-sort-f.html b/html/index-sort-f.html deleted file mode 100644 index 5c93be8..0000000 --- a/html/index-sort-f.html +++ /dev/null @@ -1,174 +0,0 @@ - - - - - - - LCOV - BayesNet Coverage Report - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top levelCoverageTotalHit
Test:BayesNet Coverage ReportLines:99.0 %16101594
Test Date:2024-05-06 17:54:04Functions:100.0 %237237
Legend: Rating: - low: < 75 % - medium: >= 75 % - high: >= 90 % -
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Directory Sort by file nameLine Coverage Sort by line coverageFunction Coverage Sort by function coverage
Rate Total Hit Rate Total Hit
bayesnet -
100.0%
-
100.0 %11100.0 %11
bayesnet/feature_selection -
98.7%98.7%
-
98.7 %152150100.0 %1919
bayesnet/utils -
97.3%97.3%
-
97.3 %221215100.0 %3030
bayesnet/ensembles -
99.1%99.1%
-
99.1 %468464100.0 %5454
bayesnet/network -
100.0%
-
100.0 %384384100.0 %6161
bayesnet/classifiers -
99.0%99.0%
-
99.0 %384380100.0 %7272
-
-
- - - - -
Generated by: LCOV version 2.0-1
-
- - - diff --git a/html/index-sort-l.html b/html/index-sort-l.html deleted file mode 100644 index 6ae4f1b..0000000 --- a/html/index-sort-l.html +++ /dev/null @@ -1,174 +0,0 @@ - - - - - - - LCOV - BayesNet Coverage Report - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top levelCoverageTotalHit
Test:BayesNet Coverage ReportLines:99.0 %16101594
Test Date:2024-05-06 17:54:04Functions:100.0 %237237
Legend: Rating: - low: < 75 % - medium: >= 75 % - high: >= 90 % -
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Directory Sort by file nameLine Coverage Sort by line coverageFunction Coverage Sort by function coverage
Rate Total Hit Rate Total Hit
bayesnet/utils -
97.3%97.3%
-
97.3 %221215100.0 %3030
bayesnet/feature_selection -
98.7%98.7%
-
98.7 %152150100.0 %1919
bayesnet/classifiers -
99.0%99.0%
-
99.0 %384380100.0 %7272
bayesnet/ensembles -
99.1%99.1%
-
99.1 %468464100.0 %5454
bayesnet -
100.0%
-
100.0 %11100.0 %11
bayesnet/network -
100.0%
-
100.0 %384384100.0 %6161
-
-
- - - - -
Generated by: LCOV version 2.0-1
-
- - - diff --git a/html/index.html b/html/index.html deleted file mode 100644 index cd28fc6..0000000 --- a/html/index.html +++ /dev/null @@ -1,174 +0,0 @@ - - - - - - - LCOV - BayesNet Coverage Report - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top levelCoverageTotalHit
Test:BayesNet Coverage ReportLines:99.0 %16101594
Test Date:2024-05-06 17:54:04Functions:100.0 %237237
Legend: Rating: - low: < 75 % - medium: >= 75 % - high: >= 90 % -
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Directory Sort by file nameLine Coverage Sort by line coverageFunction Coverage Sort by function coverage
Rate Total Hit Rate Total Hit
bayesnet -
100.0%
-
100.0 %11100.0 %11
bayesnet/classifiers -
99.0%99.0%
-
99.0 %384380100.0 %7272
bayesnet/ensembles -
99.1%99.1%
-
99.1 %468464100.0 %5454
bayesnet/feature_selection -
98.7%98.7%
-
98.7 %152150100.0 %1919
bayesnet/network -
100.0%
-
100.0 %384384100.0 %6161
bayesnet/utils -
97.3%97.3%
-
97.3 %221215100.0 %3030
-
-
- - - - -
Generated by: LCOV version 2.0-1
-
- - - diff --git a/html/ruby.png b/html/ruby.png deleted file mode 100644 index 991b6d4..0000000 Binary files a/html/ruby.png and /dev/null differ diff --git a/html/snow.png b/html/snow.png deleted file mode 100644 index 2cdae10..0000000 Binary files a/html/snow.png and /dev/null differ diff --git a/html/updown.png b/html/updown.png deleted file mode 100644 index aa56a23..0000000 Binary files a/html/updown.png and /dev/null differ diff --git a/lib/Files/ArffFiles.cc b/lib/Files/ArffFiles.cc deleted file mode 100644 index 299b60c..0000000 --- a/lib/Files/ArffFiles.cc +++ /dev/null @@ -1,171 +0,0 @@ -#include "ArffFiles.h" -#include -#include -#include -#include - -std::vector ArffFiles::getLines() const -{ - return lines; -} - -unsigned long int ArffFiles::getSize() const -{ - return lines.size(); -} - -std::vector> ArffFiles::getAttributes() const -{ - return attributes; -} - -std::string ArffFiles::getClassName() const -{ - return className; -} - -std::string ArffFiles::getClassType() const -{ - return classType; -} - -std::vector>& ArffFiles::getX() -{ - return X; -} - -std::vector& ArffFiles::getY() -{ - return y; -} - -void ArffFiles::loadCommon(const std::string& fileName) -{ - std::ifstream file(fileName); - if (!file.is_open()) { - throw std::invalid_argument("Unable to open file"); - } - std::string line; - std::string keyword; - std::string attribute; - std::string type; - std::string type_w; - // Read file - while (getline(file, line)) { - if (line.empty() || line[0] == '%' || line == "\r" || line == " ") { - // Skip comments and empty lines - continue; - } - if (line.find("@attribute") != std::string::npos || line.find("@ATTRIBUTE") != std::string::npos) { - // Read attributes - std::stringstream ss(line); - ss >> keyword >> attribute; - type = ""; - while (ss >> type_w) - type += type_w + " "; - attributes.emplace_back(trim(attribute), trim(type)); - continue; - } - if (line[0] == '@') { - continue; - } - // Read data - lines.push_back(line); - } - file.close(); - if (attributes.empty()) - throw std::invalid_argument("No attributes found"); -} - -void ArffFiles::load(const std::string& fileName, bool classLast) -{ - int labelIndex; - loadCommon(fileName); - if (classLast) { - className = std::get<0>(attributes.back()); - classType = std::get<1>(attributes.back()); - attributes.pop_back(); - labelIndex = static_cast(attributes.size()); - } else { - className = std::get<0>(attributes.front()); - classType = std::get<1>(attributes.front()); - attributes.erase(attributes.begin()); - labelIndex = 0; - } - generateDataset(labelIndex); -} -void ArffFiles::load(const std::string& fileName, const std::string& name) -{ - int labelIndex; - loadCommon(fileName); - bool found = false; - for (int i = 0; i < attributes.size(); ++i) { - if (attributes[i].first == name) { - className = std::get<0>(attributes[i]); - classType = std::get<1>(attributes[i]); - attributes.erase(attributes.begin() + i); - labelIndex = i; - found = true; - break; - } - } - if (!found) { - throw std::invalid_argument("Class name not found"); - } - generateDataset(labelIndex); -} - -void ArffFiles::generateDataset(int labelIndex) -{ - X = std::vector>(attributes.size(), std::vector(lines.size())); - auto yy = std::vector(lines.size(), ""); - auto removeLines = std::vector(); // Lines with missing values - size_t numLine = 0; - for (numLine = 0; numLine < lines.size(); numLine++) { - std::stringstream ss(lines[numLine]); - std::string value; - int pos = 0; - int xIndex = 0; - while (getline(ss, value, ',')) { - if (pos++ == labelIndex) { - yy[numLine] = value; - } else { - if (value == "?") { - X[xIndex++][numLine] = -1; - removeLines.push_back(numLine); - } else - X[xIndex++][numLine] = stof(value); - } - } - } - for (auto i : removeLines) { - yy.erase(yy.begin() + i); - for (auto& x : X) { - x.erase(x.begin() + i); - } - } - y = factorize(yy); -} - -std::string ArffFiles::trim(const std::string& source) -{ - std::string s(source); - s.erase(0, s.find_first_not_of(" '\n\r\t")); - s.erase(s.find_last_not_of(" '\n\r\t") + 1); - return s; -} - -std::vector ArffFiles::factorize(const std::vector& labels_t) -{ - std::vector yy; - yy.reserve(labels_t.size()); - std::map labelMap; - int i = 0; - for (const std::string& label : labels_t) { - if (labelMap.find(label) == labelMap.end()) { - labelMap[label] = i++; - } - yy.push_back(labelMap[label]); - } - return yy; -} \ No newline at end of file diff --git a/lib/Files/ArffFiles.h b/lib/Files/ArffFiles.h deleted file mode 100644 index 4602a05..0000000 --- a/lib/Files/ArffFiles.h +++ /dev/null @@ -1,33 +0,0 @@ -#ifndef ARFFFILES_H -#define ARFFFILES_H - -#include -#include - -class ArffFiles { -public: - ArffFiles() = default; - void load(const std::string&, bool = true); - void load(const std::string&, const std::string&); - std::vector getLines() const; - unsigned long int getSize() const; - std::string getClassName() const; - std::string getClassType() const; - static std::string trim(const std::string&); - std::vector>& getX(); - std::vector& getY(); - std::vector> getAttributes() const; - static std::vector factorize(const std::vector& labels_t); -protected: - std::vector lines; - std::vector> attributes; - std::string className; - std::string classType; - std::vector> X; - std::vector y; - int maxLines = 0; - void generateDataset(int); - void loadCommon(const std::string&); -}; - -#endif \ No newline at end of file diff --git a/lib/Files/CMakeLists.txt b/lib/Files/CMakeLists.txt deleted file mode 100644 index fce5b8f..0000000 --- a/lib/Files/CMakeLists.txt +++ /dev/null @@ -1 +0,0 @@ -add_library(ArffFiles ArffFiles.cc) \ No newline at end of file diff --git a/lib/catch2 b/lib/catch2 new file mode 160000 index 0000000..029fe3b --- /dev/null +++ b/lib/catch2 @@ -0,0 +1 @@ +Subproject commit 029fe3b4609dd84cd939b73357f37bbb75bcf82f diff --git a/sample/CMakeLists.txt b/sample/CMakeLists.txt index c95e219..d50030e 100644 --- a/sample/CMakeLists.txt +++ b/sample/CMakeLists.txt @@ -14,7 +14,6 @@ include_directories( /usr/local/include ) -add_subdirectory(lib/Files) add_subdirectory(lib/mdlp) add_executable(bayesnet_sample sample.cc) -target_link_libraries(bayesnet_sample ArffFiles mdlp "${TORCH_LIBRARIES}" "${BayesNet}") \ No newline at end of file +target_link_libraries(bayesnet_sample mdlp "${TORCH_LIBRARIES}" "${BayesNet}") \ No newline at end of file diff --git a/sample/lib/Files/ArffFiles.cc b/sample/lib/Files/ArffFiles.cc deleted file mode 100644 index d333d1e..0000000 --- a/sample/lib/Files/ArffFiles.cc +++ /dev/null @@ -1,174 +0,0 @@ -// *************************************************************** -// SPDX-FileCopyrightText: Copyright 2024 Ricardo Montañana Gómez -// SPDX-FileType: SOURCE -// SPDX-License-Identifier: MIT -// *************************************************************** - -#include "ArffFiles.h" -#include -#include -#include -#include - -ArffFiles::ArffFiles() = default; - -std::vector ArffFiles::getLines() const -{ - return lines; -} - -unsigned long int ArffFiles::getSize() const -{ - return lines.size(); -} - -std::vector> ArffFiles::getAttributes() const -{ - return attributes; -} - -std::string ArffFiles::getClassName() const -{ - return className; -} - -std::string ArffFiles::getClassType() const -{ - return classType; -} - -std::vector>& ArffFiles::getX() -{ - return X; -} - -std::vector& ArffFiles::getY() -{ - return y; -} - -void ArffFiles::loadCommon(std::string fileName) -{ - std::ifstream file(fileName); - if (!file.is_open()) { - throw std::invalid_argument("Unable to open file"); - } - std::string line; - std::string keyword; - std::string attribute; - std::string type; - std::string type_w; - while (getline(file, line)) { - if (line.empty() || line[0] == '%' || line == "\r" || line == " ") { - continue; - } - if (line.find("@attribute") != std::string::npos || line.find("@ATTRIBUTE") != std::string::npos) { - std::stringstream ss(line); - ss >> keyword >> attribute; - type = ""; - while (ss >> type_w) - type += type_w + " "; - attributes.emplace_back(trim(attribute), trim(type)); - continue; - } - if (line[0] == '@') { - continue; - } - lines.push_back(line); - } - file.close(); - if (attributes.empty()) - throw std::invalid_argument("No attributes found"); -} - -void ArffFiles::load(const std::string& fileName, bool classLast) -{ - int labelIndex; - loadCommon(fileName); - if (classLast) { - className = std::get<0>(attributes.back()); - classType = std::get<1>(attributes.back()); - attributes.pop_back(); - labelIndex = static_cast(attributes.size()); - } else { - className = std::get<0>(attributes.front()); - classType = std::get<1>(attributes.front()); - attributes.erase(attributes.begin()); - labelIndex = 0; - } - generateDataset(labelIndex); -} -void ArffFiles::load(const std::string& fileName, const std::string& name) -{ - int labelIndex; - loadCommon(fileName); - bool found = false; - for (int i = 0; i < attributes.size(); ++i) { - if (attributes[i].first == name) { - className = std::get<0>(attributes[i]); - classType = std::get<1>(attributes[i]); - attributes.erase(attributes.begin() + i); - labelIndex = i; - found = true; - break; - } - } - if (!found) { - throw std::invalid_argument("Class name not found"); - } - generateDataset(labelIndex); -} - -void ArffFiles::generateDataset(int labelIndex) -{ - X = std::vector>(attributes.size(), std::vector(lines.size())); - auto yy = std::vector(lines.size(), ""); - auto removeLines = std::vector(); // Lines with missing values - for (size_t i = 0; i < lines.size(); i++) { - std::stringstream ss(lines[i]); - std::string value; - int pos = 0; - int xIndex = 0; - while (getline(ss, value, ',')) { - if (pos++ == labelIndex) { - yy[i] = value; - } else { - if (value == "?") { - X[xIndex++][i] = -1; - removeLines.push_back(i); - } else - X[xIndex++][i] = stof(value); - } - } - } - for (auto i : removeLines) { - yy.erase(yy.begin() + i); - for (auto& x : X) { - x.erase(x.begin() + i); - } - } - y = factorize(yy); -} - -std::string ArffFiles::trim(const std::string& source) -{ - std::string s(source); - s.erase(0, s.find_first_not_of(" '\n\r\t")); - s.erase(s.find_last_not_of(" '\n\r\t") + 1); - return s; -} - -std::vector ArffFiles::factorize(const std::vector& labels_t) -{ - std::vector yy; - yy.reserve(labels_t.size()); - std::map labelMap; - int i = 0; - for (const std::string& label : labels_t) { - if (labelMap.find(label) == labelMap.end()) { - labelMap[label] = i++; - } - yy.push_back(labelMap[label]); - } - return yy; -} \ No newline at end of file diff --git a/sample/lib/Files/ArffFiles.h b/sample/lib/Files/ArffFiles.h deleted file mode 100644 index 12206c5..0000000 --- a/sample/lib/Files/ArffFiles.h +++ /dev/null @@ -1,38 +0,0 @@ -// *************************************************************** -// SPDX-FileCopyrightText: Copyright 2024 Ricardo Montañana Gómez -// SPDX-FileType: SOURCE -// SPDX-License-Identifier: MIT -// *************************************************************** - -#ifndef ARFFFILES_H -#define ARFFFILES_H - -#include -#include - -class ArffFiles { -private: - std::vector lines; - std::vector> attributes; - std::string className; - std::string classType; - std::vector> X; - std::vector y; - void generateDataset(int); - void loadCommon(std::string); -public: - ArffFiles(); - void load(const std::string&, bool = true); - void load(const std::string&, const std::string&); - std::vector getLines() const; - unsigned long int getSize() const; - std::string getClassName() const; - std::string getClassType() const; - static std::string trim(const std::string&); - std::vector>& getX(); - std::vector& getY(); - std::vector> getAttributes() const; - static std::vector factorize(const std::vector& labels_t); -}; - -#endif \ No newline at end of file diff --git a/sample/lib/Files/CMakeLists.txt b/sample/lib/Files/CMakeLists.txt deleted file mode 100644 index fce5b8f..0000000 --- a/sample/lib/Files/CMakeLists.txt +++ /dev/null @@ -1 +0,0 @@ -add_library(ArffFiles ArffFiles.cc) \ No newline at end of file diff --git a/sample/sample.cc b/sample/sample.cc index e58dab7..511230f 100644 --- a/sample/sample.cc +++ b/sample/sample.cc @@ -4,7 +4,7 @@ // SPDX-License-Identifier: MIT // *************************************************************** -#include +#include #include #include diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index a878442..1ff33ee 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -1,6 +1,6 @@ if(ENABLE_TESTING) include_directories( - ${BayesNet_SOURCE_DIR}/lib/Files + ${BayesNet_SOURCE_DIR}/tests/lib/Files ${BayesNet_SOURCE_DIR}/lib/folding ${BayesNet_SOURCE_DIR}/lib/mdlp ${BayesNet_SOURCE_DIR}/lib/json/include @@ -10,17 +10,18 @@ if(ENABLE_TESTING) file(GLOB_RECURSE BayesNet_SOURCES "${BayesNet_SOURCE_DIR}/bayesnet/*.cc") add_executable(TestBayesNet TestBayesNetwork.cc TestBayesNode.cc TestBayesClassifier.cc TestBayesModels.cc TestBayesMetrics.cc TestFeatureSelection.cc TestBoostAODE.cc TestA2DE.cc - TestUtils.cc TestBayesEnsemble.cc TestModulesVersions.cc ${BayesNet_SOURCES}) - target_link_libraries(TestBayesNet PUBLIC "${TORCH_LIBRARIES}" ArffFiles mdlp PRIVATE Catch2::Catch2WithMain) + TestUtils.cc TestBayesEnsemble.cc TestModulesVersions.cc TestBoostA2DE.cc ${BayesNet_SOURCES}) + target_link_libraries(TestBayesNet PUBLIC "${TORCH_LIBRARIES}" mdlp PRIVATE Catch2::Catch2WithMain) add_test(NAME BayesNetworkTest COMMAND TestBayesNet) - add_test(NAME Network COMMAND TestBayesNet "[Network]") - add_test(NAME Node COMMAND TestBayesNet "[Node]") - add_test(NAME Metrics COMMAND TestBayesNet "[Metrics]") - add_test(NAME FeatureSelection COMMAND TestBayesNet "[FeatureSelection]") + add_test(NAME A2DE COMMAND TestBayesNet "[A2DE]") + add_test(NAME BoostA2DE COMMAND TestBayesNet "[BoostA2DE]") + add_test(NAME BoostAODE COMMAND TestBayesNet "[BoostAODE]") add_test(NAME Classifier COMMAND TestBayesNet "[Classifier]") add_test(NAME Ensemble COMMAND TestBayesNet "[Ensemble]") + add_test(NAME FeatureSelection COMMAND TestBayesNet "[FeatureSelection]") + add_test(NAME Metrics COMMAND TestBayesNet "[Metrics]") add_test(NAME Models COMMAND TestBayesNet "[Models]") - add_test(NAME BoostAODE COMMAND TestBayesNet "[BoostAODE]") - add_test(NAME A2DE COMMAND TestBayesNet "[A2DE]") add_test(NAME Modules COMMAND TestBayesNet "[Modules]") + add_test(NAME Network COMMAND TestBayesNet "[Network]") + add_test(NAME Node COMMAND TestBayesNet "[Node]") endif(ENABLE_TESTING) diff --git a/tests/TestBayesMetrics.cc b/tests/TestBayesMetrics.cc index b7d5c76..f2eeebf 100644 --- a/tests/TestBayesMetrics.cc +++ b/tests/TestBayesMetrics.cc @@ -11,7 +11,6 @@ #include "TestUtils.h" #include "Timer.h" - TEST_CASE("Metrics Test", "[Metrics]") { std::string file_name = GENERATE("glass", "iris", "ecoli", "diabetes"); @@ -28,8 +27,8 @@ TEST_CASE("Metrics Test", "[Metrics]") {"diabetes", 0.0345470614} }; map, std::vector>> resultsMST = { - { {"glass", 0}, { {0, 6}, {0, 5}, {0, 3}, {5, 1}, {5, 8}, {5, 4}, {6, 2}, {6, 7} } }, - { {"glass", 1}, { {1, 5}, {5, 0}, {5, 8}, {5, 4}, {0, 6}, {0, 3}, {6, 2}, {6, 7} } }, + { {"glass", 0}, { {0, 6}, {0, 5}, {0, 3}, {3, 4}, {5, 1}, {5, 8}, {6, 2}, {6, 7} } }, + { {"glass", 1}, { {1, 5}, {5, 0}, {5, 8}, {0, 6}, {0, 3}, {3, 4}, {6, 2}, {6, 7} } }, { {"iris", 0}, { {0, 1}, {0, 2}, {1, 3} } }, { {"iris", 1}, { {1, 0}, {1, 3}, {0, 2} } }, { {"ecoli", 0}, { {0, 1}, {0, 2}, {1, 5}, {1, 3}, {5, 6}, {5, 4} } }, @@ -100,6 +99,25 @@ TEST_CASE("Entropy Test", "[Metrics]") REQUIRE(result == Catch::Approx(0.693147180559945).epsilon(raw.epsilon)); } TEST_CASE("Conditional Entropy", "[Metrics]") +{ + auto raw = RawDatasets("iris", true); + bayesnet::Metrics metrics(raw.dataset, raw.features, raw.className, raw.classNumStates); + auto expected = std::map, double>{ + { { 0, 1 }, 1.32674 }, + { { 0, 2 }, 0.236253 }, + { { 0, 3 }, 0.1202 }, + { { 1, 2 }, 0.252551 }, + { { 1, 3 }, 0.10515 }, + { { 2, 3 }, 0.108323 }, + }; + for (int i = 0; i < raw.features.size() - 1; ++i) { + for (int j = i + 1; j < raw.features.size(); ++j) { + double result = metrics.conditionalEntropy(raw.dataset.index({ i, "..." }), raw.dataset.index({ j, "..." }), raw.yt, raw.weights); + REQUIRE(result == Catch::Approx(expected.at({ i, j })).epsilon(raw.epsilon)); + } + } +} +TEST_CASE("Conditional Mutual Information", "[Metrics]") { auto raw = RawDatasets("iris", true); bayesnet::Metrics metrics(raw.dataset, raw.features, raw.className, raw.classNumStates); @@ -117,4 +135,133 @@ TEST_CASE("Conditional Entropy", "[Metrics]") REQUIRE(result == Catch::Approx(expected.at({ i, j })).epsilon(raw.epsilon)); } } +} +TEST_CASE("Select K Pairs descending", "[Metrics]") +{ + auto raw = RawDatasets("iris", true); + bayesnet::Metrics metrics(raw.dataset, raw.features, raw.className, raw.classNumStates); + std::vector empty; + auto results = metrics.SelectKPairs(raw.weights, empty, false); + auto expected = std::vector, double>>{ + { { 1, 3 }, 1.31852 }, + { { 1, 2 }, 1.17112 }, + { { 0, 3 }, 0.403749 }, + { { 0, 2 }, 0.287696 }, + { { 2, 3 }, 0.210068 }, + { { 0, 1 }, 0.0 }, + }; + auto scores = metrics.getScoresKPairs(); + for (int i = 0; i < results.size(); ++i) { + auto result = results[i]; + auto expect = expected[i]; + auto score = scores[i]; + REQUIRE(result.first == expect.first.first); + REQUIRE(result.second == expect.first.second); + REQUIRE(score.first.first == expect.first.first); + REQUIRE(score.first.second == expect.first.second); + REQUIRE(score.second == Catch::Approx(expect.second).epsilon(raw.epsilon)); + } + REQUIRE(results.size() == 6); + REQUIRE(scores.size() == 6); +} +TEST_CASE("Select K Pairs ascending", "[Metrics]") +{ + auto raw = RawDatasets("iris", true); + bayesnet::Metrics metrics(raw.dataset, raw.features, raw.className, raw.classNumStates); + std::vector empty; + auto results = metrics.SelectKPairs(raw.weights, empty, true); + auto expected = std::vector, double>>{ + { { 0, 1 }, 0.0 }, + { { 2, 3 }, 0.210068 }, + { { 0, 2 }, 0.287696 }, + { { 0, 3 }, 0.403749 }, + { { 1, 2 }, 1.17112 }, + { { 1, 3 }, 1.31852 }, + }; + auto scores = metrics.getScoresKPairs(); + for (int i = 0; i < results.size(); ++i) { + auto result = results[i]; + auto expect = expected[i]; + auto score = scores[i]; + REQUIRE(result.first == expect.first.first); + REQUIRE(result.second == expect.first.second); + REQUIRE(score.first.first == expect.first.first); + REQUIRE(score.first.second == expect.first.second); + REQUIRE(score.second == Catch::Approx(expect.second).epsilon(raw.epsilon)); + } + REQUIRE(results.size() == 6); + REQUIRE(scores.size() == 6); +} +TEST_CASE("Select K Pairs with features excluded", "[Metrics]") +{ + auto raw = RawDatasets("iris", true); + bayesnet::Metrics metrics(raw.dataset, raw.features, raw.className, raw.classNumStates); + std::vector excluded = { 0, 3 }; + auto results = metrics.SelectKPairs(raw.weights, excluded, true); + auto expected = std::vector, double>>{ + { { 1, 2 }, 1.17112 }, + }; + auto scores = metrics.getScoresKPairs(); + for (int i = 0; i < results.size(); ++i) { + auto result = results[i]; + auto expect = expected[i]; + auto score = scores[i]; + REQUIRE(result.first == expect.first.first); + REQUIRE(result.second == expect.first.second); + REQUIRE(score.first.first == expect.first.first); + REQUIRE(score.first.second == expect.first.second); + REQUIRE(score.second == Catch::Approx(expect.second).epsilon(raw.epsilon)); + } + REQUIRE(results.size() == 1); + REQUIRE(scores.size() == 1); +} +TEST_CASE("Select K Pairs with number of pairs descending", "[Metrics]") +{ + auto raw = RawDatasets("iris", true); + bayesnet::Metrics metrics(raw.dataset, raw.features, raw.className, raw.classNumStates); + std::vector empty; + auto results = metrics.SelectKPairs(raw.weights, empty, false, 3); + auto expected = std::vector, double>>{ + { { 1, 3 }, 1.31852 }, + { { 1, 2 }, 1.17112 }, + { { 0, 3 }, 0.403749 } + }; + auto scores = metrics.getScoresKPairs(); + REQUIRE(results.size() == 3); + REQUIRE(scores.size() == 3); + for (int i = 0; i < results.size(); ++i) { + auto result = results[i]; + auto expect = expected[i]; + auto score = scores[i]; + REQUIRE(result.first == expect.first.first); + REQUIRE(result.second == expect.first.second); + REQUIRE(score.first.first == expect.first.first); + REQUIRE(score.first.second == expect.first.second); + REQUIRE(score.second == Catch::Approx(expect.second).epsilon(raw.epsilon)); + } +} +TEST_CASE("Select K Pairs with number of pairs ascending", "[Metrics]") +{ + auto raw = RawDatasets("iris", true); + bayesnet::Metrics metrics(raw.dataset, raw.features, raw.className, raw.classNumStates); + std::vector empty; + auto results = metrics.SelectKPairs(raw.weights, empty, true, 3); + auto expected = std::vector, double>>{ + { { 0, 3 }, 0.403749 }, + { { 1, 2 }, 1.17112 }, + { { 1, 3 }, 1.31852 } + }; + auto scores = metrics.getScoresKPairs(); + REQUIRE(results.size() == 3); + REQUIRE(scores.size() == 3); + for (int i = 0; i < results.size(); ++i) { + auto result = results[i]; + auto expect = expected[i]; + auto score = scores[i]; + REQUIRE(result.first == expect.first.first); + REQUIRE(result.second == expect.first.second); + REQUIRE(score.first.first == expect.first.first); + REQUIRE(score.first.second == expect.first.second); + REQUIRE(score.second == Catch::Approx(expect.second).epsilon(raw.epsilon)); + } } \ No newline at end of file diff --git a/tests/TestBayesModels.cc b/tests/TestBayesModels.cc index 5c97f60..b5ee426 100644 --- a/tests/TestBayesModels.cc +++ b/tests/TestBayesModels.cc @@ -56,14 +56,14 @@ TEST_CASE("Test Bayesian Classifiers score & version", "[Models]") auto raw = RawDatasets(file_name, discretize); clf->fit(raw.Xt, raw.yt, raw.features, raw.className, raw.states); auto score = clf->score(raw.Xt, raw.yt); - INFO("Classifier: " + name + " File: " + file_name); + INFO("Classifier: " << name << " File: " << file_name); REQUIRE(score == Catch::Approx(scores[{file_name, name}]).epsilon(raw.epsilon)); REQUIRE(clf->getStatus() == bayesnet::NORMAL); } } SECTION("Library check version") { - INFO("Checking version of " + name + " classifier"); + INFO("Checking version of " << name << " classifier"); REQUIRE(clf->getVersion() == ACTUAL_VERSION); } delete clf; diff --git a/tests/TestBoostA2DE.cc b/tests/TestBoostA2DE.cc new file mode 100644 index 0000000..b841bc3 --- /dev/null +++ b/tests/TestBoostA2DE.cc @@ -0,0 +1,215 @@ +// *************************************************************** +// SPDX-FileCopyrightText: Copyright 2024 Ricardo Montañana Gómez +// SPDX-FileType: SOURCE +// SPDX-License-Identifier: MIT +// *************************************************************** + +#include +#include +#include +#include +#include "bayesnet/utils/BayesMetrics.h" +#include "bayesnet/ensembles/BoostA2DE.h" +#include "TestUtils.h" + + +TEST_CASE("Build basic model", "[BoostA2DE]") +{ + auto raw = RawDatasets("diabetes", true); + auto clf = bayesnet::BoostA2DE(); + clf.fit(raw.Xv, raw.yv, raw.features, raw.className, raw.states); + REQUIRE(clf.getNumberOfNodes() == 342); + REQUIRE(clf.getNumberOfEdges() == 684); + REQUIRE(clf.getNotes().size() == 3); + REQUIRE(clf.getNotes()[0] == "Convergence threshold reached & 15 models eliminated"); + REQUIRE(clf.getNotes()[1] == "Pairs not used in train: 20"); + REQUIRE(clf.getNotes()[2] == "Number of models: 38"); + auto score = clf.score(raw.Xv, raw.yv); + REQUIRE(score == Catch::Approx(0.919271).epsilon(raw.epsilon)); +} +// TEST_CASE("Feature_select IWSS", "[BoostAODE]") +// { +// auto raw = RawDatasets("glass", true); +// auto clf = bayesnet::BoostAODE(); +// clf.setHyperparameters({ {"select_features", "IWSS"}, {"threshold", 0.5 } }); +// clf.fit(raw.Xv, raw.yv, raw.features, raw.className, raw.states); +// REQUIRE(clf.getNumberOfNodes() == 90); +// REQUIRE(clf.getNumberOfEdges() == 153); +// REQUIRE(clf.getNotes().size() == 2); +// REQUIRE(clf.getNotes()[0] == "Used features in initialization: 4 of 9 with IWSS"); +// REQUIRE(clf.getNotes()[1] == "Number of models: 9"); +// } +// TEST_CASE("Feature_select FCBF", "[BoostAODE]") +// { +// auto raw = RawDatasets("glass", true); +// auto clf = bayesnet::BoostAODE(); +// clf.setHyperparameters({ {"select_features", "FCBF"}, {"threshold", 1e-7 } }); +// clf.fit(raw.Xv, raw.yv, raw.features, raw.className, raw.states); +// REQUIRE(clf.getNumberOfNodes() == 90); +// REQUIRE(clf.getNumberOfEdges() == 153); +// REQUIRE(clf.getNotes().size() == 2); +// REQUIRE(clf.getNotes()[0] == "Used features in initialization: 4 of 9 with FCBF"); +// REQUIRE(clf.getNotes()[1] == "Number of models: 9"); +// } +// TEST_CASE("Test used features in train note and score", "[BoostAODE]") +// { +// auto raw = RawDatasets("diabetes", true); +// auto clf = bayesnet::BoostAODE(true); +// clf.setHyperparameters({ +// {"order", "asc"}, +// {"convergence", true}, +// {"select_features","CFS"}, +// }); +// clf.fit(raw.Xv, raw.yv, raw.features, raw.className, raw.states); +// REQUIRE(clf.getNumberOfNodes() == 72); +// REQUIRE(clf.getNumberOfEdges() == 120); +// REQUIRE(clf.getNotes().size() == 2); +// REQUIRE(clf.getNotes()[0] == "Used features in initialization: 6 of 8 with CFS"); +// REQUIRE(clf.getNotes()[1] == "Number of models: 8"); +// auto score = clf.score(raw.Xv, raw.yv); +// auto scoret = clf.score(raw.Xt, raw.yt); +// REQUIRE(score == Catch::Approx(0.809895813).epsilon(raw.epsilon)); +// REQUIRE(scoret == Catch::Approx(0.809895813).epsilon(raw.epsilon)); +// } +// TEST_CASE("Voting vs proba", "[BoostAODE]") +// { +// auto raw = RawDatasets("iris", true); +// auto clf = bayesnet::BoostAODE(false); +// clf.fit(raw.Xv, raw.yv, raw.features, raw.className, raw.states); +// auto score_proba = clf.score(raw.Xv, raw.yv); +// auto pred_proba = clf.predict_proba(raw.Xv); +// clf.setHyperparameters({ +// {"predict_voting",true}, +// }); +// auto score_voting = clf.score(raw.Xv, raw.yv); +// auto pred_voting = clf.predict_proba(raw.Xv); +// REQUIRE(score_proba == Catch::Approx(0.97333).epsilon(raw.epsilon)); +// REQUIRE(score_voting == Catch::Approx(0.98).epsilon(raw.epsilon)); +// REQUIRE(pred_voting[83][2] == Catch::Approx(1.0).epsilon(raw.epsilon)); +// REQUIRE(pred_proba[83][2] == Catch::Approx(0.86121525).epsilon(raw.epsilon)); +// REQUIRE(clf.dump_cpt() == ""); +// REQUIRE(clf.topological_order() == std::vector()); +// } +// TEST_CASE("Order asc, desc & random", "[BoostAODE]") +// { +// auto raw = RawDatasets("glass", true); +// std::map scores{ +// {"asc", 0.83645f }, { "desc", 0.84579f }, { "rand", 0.84112 } +// }; +// for (const std::string& order : { "asc", "desc", "rand" }) { +// auto clf = bayesnet::BoostAODE(); +// clf.setHyperparameters({ +// {"order", order}, +// {"bisection", false}, +// {"maxTolerance", 1}, +// {"convergence", false}, +// }); +// clf.fit(raw.Xv, raw.yv, raw.features, raw.className, raw.states); +// auto score = clf.score(raw.Xv, raw.yv); +// auto scoret = clf.score(raw.Xt, raw.yt); +// INFO("BoostAODE order: " + order); +// REQUIRE(score == Catch::Approx(scores[order]).epsilon(raw.epsilon)); +// REQUIRE(scoret == Catch::Approx(scores[order]).epsilon(raw.epsilon)); +// } +// } +// TEST_CASE("Oddities", "[BoostAODE]") +// { +// auto clf = bayesnet::BoostAODE(); +// auto raw = RawDatasets("iris", true); +// auto bad_hyper = nlohmann::json{ +// { { "order", "duck" } }, +// { { "select_features", "duck" } }, +// { { "maxTolerance", 0 } }, +// { { "maxTolerance", 5 } }, +// }; +// for (const auto& hyper : bad_hyper.items()) { +// INFO("BoostAODE hyper: " + hyper.value().dump()); +// REQUIRE_THROWS_AS(clf.setHyperparameters(hyper.value()), std::invalid_argument); +// } +// REQUIRE_THROWS_AS(clf.setHyperparameters({ {"maxTolerance", 0 } }), std::invalid_argument); +// auto bad_hyper_fit = nlohmann::json{ +// { { "select_features","IWSS" }, { "threshold", -0.01 } }, +// { { "select_features","IWSS" }, { "threshold", 0.51 } }, +// { { "select_features","FCBF" }, { "threshold", 1e-8 } }, +// { { "select_features","FCBF" }, { "threshold", 1.01 } }, +// }; +// for (const auto& hyper : bad_hyper_fit.items()) { +// INFO("BoostAODE hyper: " + hyper.value().dump()); +// clf.setHyperparameters(hyper.value()); +// REQUIRE_THROWS_AS(clf.fit(raw.Xv, raw.yv, raw.features, raw.className, raw.states), std::invalid_argument); +// } +// } + +// TEST_CASE("Bisection Best", "[BoostAODE]") +// { +// auto clf = bayesnet::BoostAODE(); +// auto raw = RawDatasets("kdd_JapaneseVowels", true, 1200, true, false); +// clf.setHyperparameters({ +// {"bisection", true}, +// {"maxTolerance", 3}, +// {"convergence", true}, +// {"block_update", false}, +// {"convergence_best", false}, +// }); +// clf.fit(raw.X_train, raw.y_train, raw.features, raw.className, raw.states); +// REQUIRE(clf.getNumberOfNodes() == 210); +// REQUIRE(clf.getNumberOfEdges() == 378); +// REQUIRE(clf.getNotes().size() == 1); +// REQUIRE(clf.getNotes().at(0) == "Number of models: 14"); +// auto score = clf.score(raw.X_test, raw.y_test); +// auto scoret = clf.score(raw.X_test, raw.y_test); +// REQUIRE(score == Catch::Approx(0.991666675f).epsilon(raw.epsilon)); +// REQUIRE(scoret == Catch::Approx(0.991666675f).epsilon(raw.epsilon)); +// } +// TEST_CASE("Bisection Best vs Last", "[BoostAODE]") +// { +// auto raw = RawDatasets("kdd_JapaneseVowels", true, 1500, true, false); +// auto clf = bayesnet::BoostAODE(true); +// auto hyperparameters = nlohmann::json{ +// {"bisection", true}, +// {"maxTolerance", 3}, +// {"convergence", true}, +// {"convergence_best", true}, +// }; +// clf.setHyperparameters(hyperparameters); +// clf.fit(raw.X_train, raw.y_train, raw.features, raw.className, raw.states); +// auto score_best = clf.score(raw.X_test, raw.y_test); +// REQUIRE(score_best == Catch::Approx(0.980000019f).epsilon(raw.epsilon)); +// // Now we will set the hyperparameter to use the last accuracy +// hyperparameters["convergence_best"] = false; +// clf.setHyperparameters(hyperparameters); +// clf.fit(raw.X_train, raw.y_train, raw.features, raw.className, raw.states); +// auto score_last = clf.score(raw.X_test, raw.y_test); +// REQUIRE(score_last == Catch::Approx(0.976666689f).epsilon(raw.epsilon)); +// } + +// TEST_CASE("Block Update", "[BoostAODE]") +// { +// auto clf = bayesnet::BoostAODE(); +// auto raw = RawDatasets("mfeat-factors", true, 500); +// clf.setHyperparameters({ +// {"bisection", true}, +// {"block_update", true}, +// {"maxTolerance", 3}, +// {"convergence", true}, +// }); +// clf.fit(raw.X_train, raw.y_train, raw.features, raw.className, raw.states); +// REQUIRE(clf.getNumberOfNodes() == 868); +// REQUIRE(clf.getNumberOfEdges() == 1724); +// REQUIRE(clf.getNotes().size() == 3); +// REQUIRE(clf.getNotes()[0] == "Convergence threshold reached & 15 models eliminated"); +// REQUIRE(clf.getNotes()[1] == "Used features in train: 19 of 216"); +// REQUIRE(clf.getNotes()[2] == "Number of models: 4"); +// auto score = clf.score(raw.X_test, raw.y_test); +// auto scoret = clf.score(raw.X_test, raw.y_test); +// REQUIRE(score == Catch::Approx(0.99f).epsilon(raw.epsilon)); +// REQUIRE(scoret == Catch::Approx(0.99f).epsilon(raw.epsilon)); +// // +// // std::cout << "Number of nodes " << clf.getNumberOfNodes() << std::endl; +// // std::cout << "Number of edges " << clf.getNumberOfEdges() << std::endl; +// // std::cout << "Notes size " << clf.getNotes().size() << std::endl; +// // for (auto note : clf.getNotes()) { +// // std::cout << note << std::endl; +// // } +// // std::cout << "Score " << score << std::endl; +// } \ No newline at end of file diff --git a/tests/TestBoostAODE.cc b/tests/TestBoostAODE.cc index 4f92110..66fa7fb 100644 --- a/tests/TestBoostAODE.cc +++ b/tests/TestBoostAODE.cc @@ -8,6 +8,7 @@ #include #include #include +#include #include "bayesnet/ensembles/BoostAODE.h" #include "TestUtils.h" @@ -104,7 +105,7 @@ TEST_CASE("Order asc, desc & random", "[BoostAODE]") clf.fit(raw.Xv, raw.yv, raw.features, raw.className, raw.states); auto score = clf.score(raw.Xv, raw.yv); auto scoret = clf.score(raw.Xt, raw.yt); - INFO("BoostAODE order: " + order); + INFO("BoostAODE order: " << order); REQUIRE(score == Catch::Approx(scores[order]).epsilon(raw.epsilon)); REQUIRE(scoret == Catch::Approx(scores[order]).epsilon(raw.epsilon)); } @@ -120,7 +121,7 @@ TEST_CASE("Oddities", "[BoostAODE]") { { "maxTolerance", 5 } }, }; for (const auto& hyper : bad_hyper.items()) { - INFO("BoostAODE hyper: " + hyper.value().dump()); + INFO("BoostAODE hyper: " << hyper.value().dump()); REQUIRE_THROWS_AS(clf.setHyperparameters(hyper.value()), std::invalid_argument); } REQUIRE_THROWS_AS(clf.setHyperparameters({ {"maxTolerance", 0 } }), std::invalid_argument); @@ -131,7 +132,7 @@ TEST_CASE("Oddities", "[BoostAODE]") { { "select_features","FCBF" }, { "threshold", 1.01 } }, }; for (const auto& hyper : bad_hyper_fit.items()) { - INFO("BoostAODE hyper: " + hyper.value().dump()); + INFO("BoostAODE hyper: " << hyper.value().dump()); clf.setHyperparameters(hyper.value()); REQUIRE_THROWS_AS(clf.fit(raw.Xv, raw.yv, raw.features, raw.className, raw.states), std::invalid_argument); } diff --git a/tests/TestModulesVersions.cc b/tests/TestModulesVersions.cc index c9a44e0..a8b2ce2 100644 --- a/tests/TestModulesVersions.cc +++ b/tests/TestModulesVersions.cc @@ -18,7 +18,8 @@ std::map modules = { { "mdlp", "1.1.2" }, { "Folding", "1.1.0" }, - { "json", "3.11" } + { "json", "3.11" }, + { "ArffFiles", "1.0.0" } }; TEST_CASE("MDLP", "[Modules]") @@ -35,3 +36,8 @@ TEST_CASE("NLOHMANN_JSON", "[Modules]") { REQUIRE(JSON_VERSION == modules["json"]); } +TEST_CASE("ArffFiles", "[Modules]") +{ + auto handler = ArffFiles(); + REQUIRE(handler.version() == modules["ArffFiles"]); +} diff --git a/tests/TestUtils.h b/tests/TestUtils.h index 09ea305..96b6775 100644 --- a/tests/TestUtils.h +++ b/tests/TestUtils.h @@ -11,7 +11,7 @@ #include #include #include -#include +#include #include #include diff --git a/tests/lib/Files b/tests/lib/Files new file mode 160000 index 0000000..40ac380 --- /dev/null +++ b/tests/lib/Files @@ -0,0 +1 @@ +Subproject commit 40ac38011a2445e00df8a18048c67abaff16fa59