BoostA2DE #29

Merged
rmontanana merged 21 commits from BoostA2DE into main 2024-06-09 10:02:48 +00:00
349 changed files with 3975 additions and 29353 deletions

4
.gitignore vendored
View File

@ -40,4 +40,8 @@ puml/**
.vscode/settings.json
sample/build
**/.DS_Store
docs/manual
docs/man3
docs/man
docs/Doxyfile

3
.gitmodules vendored
View File

@ -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

View File

@ -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

View File

@ -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)
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})

View File

@ -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"><a href="https:\/\/rmontanana.github.io\/bayesnet">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/##/:/'`); \

View File

@ -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)

View File

@ -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}

View File

@ -4,7 +4,6 @@
// SPDX-License-Identifier: MIT
// ***************************************************************
#include <ArffFiles.h>
#include "Proposal.h"
namespace bayesnet {
@ -54,8 +53,7 @@ namespace bayesnet {
yJoinParents[i] += to_string(pDataset.index({ idx, i }).item<int>());
}
}
auto arff = ArffFiles();
auto yxv = arff.factorize(yJoinParents);
auto yxv = factorize(yJoinParents);
auto xvf_ptr = Xf.index({ index }).data_ptr<float>();
auto xvf = std::vector<mdlp::precision_t>(xvf_ptr, xvf_ptr + Xf.size(1));
discretizers[feature]->fit(xvf, yxv);
@ -113,4 +111,19 @@ namespace bayesnet {
}
return Xtd;
}
std::vector<int> Proposal::factorize(const std::vector<std::string>& labels_t)
{
std::vector<int> yy;
yy.reserve(labels_t.size());
std::map<std::string, int> 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;
}
}

View File

@ -27,6 +27,7 @@ namespace bayesnet {
torch::Tensor y; // y discrete nx1 tensor
map<std::string, mdlp::CPPFImdlp*> discretizers;
private:
std::vector<int> factorize(const std::vector<std::string>& labels_t);
torch::Tensor& pDataset; // (n+1)xm tensor
std::vector<std::string>& pFeatures;
std::string& pClassName;

246
bayesnet/ensembles/Boost.cc Normal file
View File

@ -0,0 +1,246 @@
// ***************************************************************
// SPDX-FileCopyrightText: Copyright 2024 Ricardo Montañana Gómez
// SPDX-FileType: SOURCE
// SPDX-License-Identifier: MIT
// ***************************************************************
#include <folding.hpp>
#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<std::string> 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<std::string> 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<int> 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<torch::Tensor&, double, bool> 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<double>();
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<double>();
weights = weights / totalWeights;
}
return { weights, alpha_t, terminate };
}
std::tuple<torch::Tensor&, double, bool> 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. Dont move any classifiers out of models
5. n_models <- k
6. Make prediction, compute alpha, update weights
7. Dont 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<Classifier> model;
std::vector<std::unique_ptr<Classifier>> 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<double>(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 };
}
}

View File

@ -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 <string>
#include <tuple>
#include <vector>
#include <nlohmann/json.hpp>
#include <torch/torch.h>
#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<int> featureSelection(torch::Tensor& weights_);
void buildModel(const torch::Tensor& weights) override;
std::tuple<torch::Tensor&, double, bool> update_weights(torch::Tensor& ytrain, torch::Tensor& ypred, torch::Tensor& weights);
std::tuple<torch::Tensor&, double, bool> 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

View File

@ -0,0 +1,167 @@
// ***************************************************************
// SPDX-FileCopyrightText: Copyright 2024 Ricardo Montañana Gómez
// SPDX-FileType: SOURCE
// SPDX-License-Identifier: MIT
// ***************************************************************
#include <set>
#include <functional>
#include <limits.h>
#include <tuple>
#include <folding.hpp>
#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<int> BoostA2DE::initializeModels()
{
torch::Tensor weights_ = torch::full({ m }, 1.0 / m, torch::kFloat64);
std::vector<int> featuresSelected = featureSelection(weights_);
if (featuresSelected.size() < 2) {
notes.push_back("No features selected in initialization");
status = ERROR;
return std::vector<int>();
}
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<Classifier> model = std::make_unique<SPnDE>(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<int> 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<std::pair<int, int>> 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<Classifier> model;
model = std::make_unique<SPnDE>(std::vector<int>({ 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>() / (double)y_test.size(0);
if (priorAccuracy == 0) {
priorAccuracy = accuracy;
} else {
improvement = accuracy - priorAccuracy;
}
if (improvement < convergence_threshold) {
// VLOG_SCOPE_F(3, " (improvement<threshold) tolerance: %d numItemsPack: %d improvement: %f prior: %f current: %f", tolerance, numItemsPack, improvement, priorAccuracy, accuracy);
tolerance++;
} else {
// 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<std::string> BoostA2DE::graph(const std::string& title) const
{
return Ensemble::graph(title);
}
}

View File

@ -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 <string>
#include <vector>
#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<std::string> graph(const std::string& title = "BoostA2DE") const override;
protected:
void trainModel(const torch::Tensor& weights) override;
private:
std::vector<int> initializeModels();
};
}
#endif

View File

@ -4,275 +4,40 @@
// SPDX-License-Identifier: MIT
// ***************************************************************
#include <random>
#include <set>
#include <functional>
#include <limits.h>
#include <tuple>
#include <folding.hpp>
#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<std::string> 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<std::string> 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<torch::Tensor&, double, bool> 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<double>();
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<double>();
weights = weights / totalWeights;
}
return { weights, alpha_t, terminate };
}
std::tuple<torch::Tensor&, double, bool> 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. Dont move any classifiers out of models
5. n_models <- k
6. Make prediction, compute alpha, update weights
7. Dont 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<Classifier> model;
std::vector<std::unique_ptr<Classifier>> 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<double>(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<int> BoostAODE::initializeModels()
{
std::vector<int> 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<int> featuresSelected = featureSelection(weights_);
for (const int& feature : featuresSelected) {
std::unique_ptr<Classifier> model = std::make_unique<SPODE>(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) tolerance: %d numItemsPack: %d improvement: %f prior: %f current: %f", tolerance, numItemsPack, improvement, priorAccuracy, accuracy);
// VLOG_SCOPE_F(3, " (improvement<threshold) tolerance: %d numItemsPack: %d improvement: %f prior: %f current: %f", tolerance, numItemsPack, improvement, priorAccuracy, accuracy);
tolerance++;
} else {
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()) {

View File

@ -6,45 +6,21 @@
#ifndef BOOSTAODE_H
#define BOOSTAODE_H
#include <map>
#include <string>
#include <vector>
#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<std::string> 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<torch::Tensor&, double, bool> update_weights_block(int k, torch::Tensor& ytrain, torch::Tensor& weights);
std::vector<int> 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

View File

@ -30,6 +30,53 @@ namespace bayesnet {
}
samples.index_put_({ -1, "..." }, torch::tensor(labels, torch::kInt32));
}
std::vector<std::pair<int, int>> Metrics::SelectKPairs(const torch::Tensor& weights, std::vector<int>& 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<int> 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<std::pair<std::pair<int, int>, double>> Metrics::getScoresKPairs() const
{
return scoresKPairs;
}
torch::Tensor Metrics::conditionalEdge(const torch::Tensor& weights)
{
auto result = std::vector<double>();
@ -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<int, 1>();
auto secondFeatureData = secondFeature.accessor<int, 1>();
auto labelsData = labels.accessor<int, 1>();
auto weightsData = weights.accessor<double, 1>();
int numSamples = firstFeature.size(0);
// Maps for joint and marginal probabilities
std::map<std::tuple<int, int, int>, double> jointCount;
std::map<std::tuple<int, int>, 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<double>();
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);

View File

@ -16,7 +16,9 @@ namespace bayesnet {
Metrics(const torch::Tensor& samples, const std::vector<std::string>& features, const std::string& className, const int classNumStates);
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);
std::vector<int> SelectKBestWeighted(const torch::Tensor& weights, bool ascending = false, unsigned k = 0);
std::vector<std::pair<int, int>> SelectKPairs(const torch::Tensor& weights, std::vector<int>& featuresExcluded, bool ascending = false, unsigned k = 0);
std::vector<double> getScoresKBest() const;
std::vector<std::pair<std::pair<int, int>, 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<std::pair<T, T>> doCombinations(const std::vector<T>& source)
{
std::vector<std::pair<T, T>> 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<double> scoresKBest;
std::vector<int> featuresKBest; // sorted indices of the features
std::vector<std::pair<int, int>> pairsKBest; // sorted indices of the pairs
std::vector<std::pair<std::pair<int, int>, double>> scoresKPairs;
double conditionalEntropy(const torch::Tensor& firstFeature, const torch::Tensor& secondFeature, const torch::Tensor& weights);
};
}

View File

@ -27,4 +27,4 @@ The hyperparameters defined in the algorithm are:
## Operation
### [Algorithm](./algorithm.md)
### [Base Algorithm](./algorithm.md)

2912
docs/Doxyfile.in Normal file

File diff suppressed because it is too large Load Diff

Binary file not shown.

BIN
docs/logo_small.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 141 B

View File

@ -1,90 +0,0 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>LCOV - BayesNet Coverage Report - bayesnet/BaseClassifier.h - functions</title>
<link rel="stylesheet" type="text/css" href="../gcov.css">
</head>
<body>
<table width="100%" border=0 cellspacing=0 cellpadding=0>
<tr><td class="title">LCOV - code coverage report</td></tr>
<tr><td class="ruler"><img src="../glass.png" width=3 height=3 alt=""></td></tr>
<tr>
<td width="100%">
<table cellpadding=1 border=0 width="100%">
<tr>
<td width="10%" class="headerItem">Current view:</td>
<td width="10%" class="headerValue"><a href="../index.html" target="_parent">top level</a> - <a href="index.html" target="_parent">bayesnet</a> - BaseClassifier.h<span style="font-size: 80%;"> (<a href="BaseClassifier.h.gcov.html">source</a> / functions)</span></td>
<td width="5%"></td>
<td width="5%"></td>
<td width="5%" class="headerCovTableHead">Coverage</td>
<td width="5%" class="headerCovTableHead" title="Covered + Uncovered code">Total</td>
<td width="5%" class="headerCovTableHead" title="Exercised code only">Hit</td>
</tr>
<tr>
<td class="headerItem">Test:</td>
<td class="headerValue">BayesNet Coverage Report</td>
<td></td>
<td class="headerItem">Lines:</td>
<td class="headerCovTableEntryHi">100.0&nbsp;%</td>
<td class="headerCovTableEntry">1</td>
<td class="headerCovTableEntry">1</td>
</tr>
<tr>
<td class="headerItem">Test Date:</td>
<td class="headerValue">2024-05-06 17:54:04</td>
<td></td>
<td class="headerItem">Functions:</td>
<td class="headerCovTableEntryHi">100.0&nbsp;%</td>
<td class="headerCovTableEntry">1</td>
<td class="headerCovTableEntry">1</td>
</tr>
<tr>
<td class="headerItem">Legend:</td>
<td class="headerValueLeg"> Lines:
<span class="coverLegendCov">hit</span>
<span class="coverLegendNoCov">not hit</span>
</td>
<td></td>
</tr>
<tr><td><img src="../glass.png" width=3 height=3 alt=""></td></tr>
</table>
</td>
</tr>
<tr><td class="ruler"><img src="../glass.png" width=3 height=3 alt=""></td></tr>
</table>
<center>
<table cellpadding=1 cellspacing=1 border=0>
<tr><td><br></td></tr>
<tr>
<td class="tableHead">Function Name <span title="Click to sort table by function name" class="tableHeadSort"><a href="BaseClassifier.h.func.html"><img src="../updown.png" width=10 height=14 alt="Sort by function name" title="Click to sort table by function name" border=0></a></span></td>
<td class="tableHead">Hit count <span title="Click to sort table by function hit count" class="tableHeadSort"><img src="../glass.png" width=10 height=14 alt="Sort by function hit count" title="Click to sort table by function hit count" border=0></span></td>
</tr>
<tr>
<td class="coverFn"><a href="BaseClassifier.h.gcov.html#L19">bayesnet::BaseClassifier::~BaseClassifier()</a></td>
<td class="coverFnHi">1680</td>
</tr>
</table>
<br>
</center>
<table width="100%" border=0 cellspacing=0 cellpadding=0>
<tr><td class="ruler"><img src="../glass.png" width=3 height=3 alt=""></td></tr>
<tr><td class="versionInfo">Generated by: <a href="https://github.com//linux-test-project/lcov" target="_parent">LCOV version 2.0-1</a></td></tr>
</table>
<br>
</body>
</html>

View File

@ -1,90 +0,0 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>LCOV - BayesNet Coverage Report - bayesnet/BaseClassifier.h - functions</title>
<link rel="stylesheet" type="text/css" href="../gcov.css">
</head>
<body>
<table width="100%" border=0 cellspacing=0 cellpadding=0>
<tr><td class="title">LCOV - code coverage report</td></tr>
<tr><td class="ruler"><img src="../glass.png" width=3 height=3 alt=""></td></tr>
<tr>
<td width="100%">
<table cellpadding=1 border=0 width="100%">
<tr>
<td width="10%" class="headerItem">Current view:</td>
<td width="10%" class="headerValue"><a href="../index.html" target="_parent">top level</a> - <a href="index.html" target="_parent">bayesnet</a> - BaseClassifier.h<span style="font-size: 80%;"> (<a href="BaseClassifier.h.gcov.html">source</a> / functions)</span></td>
<td width="5%"></td>
<td width="5%"></td>
<td width="5%" class="headerCovTableHead">Coverage</td>
<td width="5%" class="headerCovTableHead" title="Covered + Uncovered code">Total</td>
<td width="5%" class="headerCovTableHead" title="Exercised code only">Hit</td>
</tr>
<tr>
<td class="headerItem">Test:</td>
<td class="headerValue">BayesNet Coverage Report</td>
<td></td>
<td class="headerItem">Lines:</td>
<td class="headerCovTableEntryHi">100.0&nbsp;%</td>
<td class="headerCovTableEntry">1</td>
<td class="headerCovTableEntry">1</td>
</tr>
<tr>
<td class="headerItem">Test Date:</td>
<td class="headerValue">2024-05-06 17:54:04</td>
<td></td>
<td class="headerItem">Functions:</td>
<td class="headerCovTableEntryHi">100.0&nbsp;%</td>
<td class="headerCovTableEntry">1</td>
<td class="headerCovTableEntry">1</td>
</tr>
<tr>
<td class="headerItem">Legend:</td>
<td class="headerValueLeg"> Lines:
<span class="coverLegendCov">hit</span>
<span class="coverLegendNoCov">not hit</span>
</td>
<td></td>
</tr>
<tr><td><img src="../glass.png" width=3 height=3 alt=""></td></tr>
</table>
</td>
</tr>
<tr><td class="ruler"><img src="../glass.png" width=3 height=3 alt=""></td></tr>
</table>
<center>
<table cellpadding=1 cellspacing=1 border=0>
<tr><td><br></td></tr>
<tr>
<td class="tableHead">Function Name <span title="Click to sort table by function name" class="tableHeadSort"><img src="../glass.png" width=10 height=14 alt="Sort by function name" title="Click to sort table by function name" border=0></span></td>
<td class="tableHead">Hit count <span title="Click to sort table by function hit count" class="tableHeadSort"><a href="BaseClassifier.h.func-c.html"><img src="../updown.png" width=10 height=14 alt="Sort by function hit count" title="Click to sort table by function hit count" border=0></a></span></td>
</tr>
<tr>
<td class="coverFn"><a href="BaseClassifier.h.gcov.html#L19">bayesnet::BaseClassifier::~BaseClassifier()</a></td>
<td class="coverFnHi">1680</td>
</tr>
</table>
<br>
</center>
<table width="100%" border=0 cellspacing=0 cellpadding=0>
<tr><td class="ruler"><img src="../glass.png" width=3 height=3 alt=""></td></tr>
<tr><td class="versionInfo">Generated by: <a href="https://github.com//linux-test-project/lcov" target="_parent">LCOV version 2.0-1</a></td></tr>
</table>
<br>
</body>
</html>

View File

@ -1,19 +0,0 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN">
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>LCOV - BayesNet Coverage Report - bayesnet/BaseClassifier.h</title>
<link rel="stylesheet" type="text/css" href="../gcov.css">
</head>
<frameset cols="120,*">
<frame src="BaseClassifier.h.gcov.overview.html" name="overview">
<frame src="BaseClassifier.h.gcov.html" name="source">
<noframes>
<center>Frames not supported by your browser!<br></center>
</noframes>
</frameset>
</html>

View File

@ -1,129 +0,0 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>LCOV - BayesNet Coverage Report - bayesnet/BaseClassifier.h</title>
<link rel="stylesheet" type="text/css" href="../gcov.css">
</head>
<body>
<table width="100%" border=0 cellspacing=0 cellpadding=0>
<tr><td class="title">LCOV - code coverage report</td></tr>
<tr><td class="ruler"><img src="../glass.png" width=3 height=3 alt=""></td></tr>
<tr>
<td width="100%">
<table cellpadding=1 border=0 width="100%">
<tr>
<td width="10%" class="headerItem">Current view:</td>
<td width="10%" class="headerValue"><a href="../index.html" target="_parent">top level</a> - <a href="index.html" target="_parent">bayesnet</a> - BaseClassifier.h<span style="font-size: 80%;"> (source / <a href="BaseClassifier.h.func-c.html">functions</a>)</span></td>
<td width="5%"></td>
<td width="5%"></td>
<td width="5%" class="headerCovTableHead">Coverage</td>
<td width="5%" class="headerCovTableHead" title="Covered + Uncovered code">Total</td>
<td width="5%" class="headerCovTableHead" title="Exercised code only">Hit</td>
</tr>
<tr>
<td class="headerItem">Test:</td>
<td class="headerValue">BayesNet Coverage Report</td>
<td></td>
<td class="headerItem">Lines:</td>
<td class="headerCovTableEntryHi">100.0&nbsp;%</td>
<td class="headerCovTableEntry">1</td>
<td class="headerCovTableEntry">1</td>
</tr>
<tr>
<td class="headerItem">Test Date:</td>
<td class="headerValue">2024-05-06 17:54:04</td>
<td></td>
<td class="headerItem">Functions:</td>
<td class="headerCovTableEntryHi">100.0&nbsp;%</td>
<td class="headerCovTableEntry">1</td>
<td class="headerCovTableEntry">1</td>
</tr>
<tr>
<td class="headerItem">Legend:</td>
<td class="headerValueLeg"> Lines:
<span class="coverLegendCov">hit</span>
<span class="coverLegendNoCov">not hit</span>
</td>
<td></td>
</tr>
<tr><td><img src="../glass.png" width=3 height=3 alt=""></td></tr>
</table>
</td>
</tr>
<tr><td class="ruler"><img src="../glass.png" width=3 height=3 alt=""></td></tr>
</table>
<table cellpadding=0 cellspacing=0 border=0>
<tr>
<td><br></td>
</tr>
<tr>
<td>
<pre class="sourceHeading"> Line data Source code</pre>
<pre class="source">
<span id="L1"><span class="lineNum"> 1</span> : // ***************************************************************</span>
<span id="L2"><span class="lineNum"> 2</span> : // SPDX-FileCopyrightText: Copyright 2024 Ricardo Montañana Gómez</span>
<span id="L3"><span class="lineNum"> 3</span> : // SPDX-FileType: SOURCE</span>
<span id="L4"><span class="lineNum"> 4</span> : // SPDX-License-Identifier: MIT</span>
<span id="L5"><span class="lineNum"> 5</span> : // ***************************************************************</span>
<span id="L6"><span class="lineNum"> 6</span> : </span>
<span id="L7"><span class="lineNum"> 7</span> : #pragma once</span>
<span id="L8"><span class="lineNum"> 8</span> : #include &lt;vector&gt;</span>
<span id="L9"><span class="lineNum"> 9</span> : #include &lt;torch/torch.h&gt;</span>
<span id="L10"><span class="lineNum"> 10</span> : #include &lt;nlohmann/json.hpp&gt;</span>
<span id="L11"><span class="lineNum"> 11</span> : namespace bayesnet {</span>
<span id="L12"><span class="lineNum"> 12</span> : enum status_t { NORMAL, WARNING, ERROR };</span>
<span id="L13"><span class="lineNum"> 13</span> : class BaseClassifier {</span>
<span id="L14"><span class="lineNum"> 14</span> : public:</span>
<span id="L15"><span class="lineNum"> 15</span> : // X is nxm std::vector, y is nx1 std::vector</span>
<span id="L16"><span class="lineNum"> 16</span> : virtual BaseClassifier&amp; fit(std::vector&lt;std::vector&lt;int&gt;&gt;&amp; X, std::vector&lt;int&gt;&amp; y, const std::vector&lt;std::string&gt;&amp; features, const std::string&amp; className, std::map&lt;std::string, std::vector&lt;int&gt;&gt;&amp; states) = 0;</span>
<span id="L17"><span class="lineNum"> 17</span> : // X is nxm tensor, y is nx1 tensor</span>
<span id="L18"><span class="lineNum"> 18</span> : virtual BaseClassifier&amp; fit(torch::Tensor&amp; X, torch::Tensor&amp; y, const std::vector&lt;std::string&gt;&amp; features, const std::string&amp; className, std::map&lt;std::string, std::vector&lt;int&gt;&gt;&amp; states) = 0;</span>
<span id="L19"><span class="lineNum"> 19</span> : virtual BaseClassifier&amp; fit(torch::Tensor&amp; dataset, const std::vector&lt;std::string&gt;&amp; features, const std::string&amp; className, std::map&lt;std::string, std::vector&lt;int&gt;&gt;&amp; states) = 0;</span>
<span id="L20"><span class="lineNum"> 20</span> : virtual BaseClassifier&amp; fit(torch::Tensor&amp; dataset, const std::vector&lt;std::string&gt;&amp; features, const std::string&amp; className, std::map&lt;std::string, std::vector&lt;int&gt;&gt;&amp; states, const torch::Tensor&amp; weights) = 0;</span>
<span id="L21"><span class="lineNum"> 21</span> <span class="tlaGNC tlaBgGNC"> 1680 : virtual ~BaseClassifier() = default;</span></span>
<span id="L22"><span class="lineNum"> 22</span> : torch::Tensor virtual predict(torch::Tensor&amp; X) = 0;</span>
<span id="L23"><span class="lineNum"> 23</span> : std::vector&lt;int&gt; virtual predict(std::vector&lt;std::vector&lt;int &gt;&gt;&amp; X) = 0;</span>
<span id="L24"><span class="lineNum"> 24</span> : torch::Tensor virtual predict_proba(torch::Tensor&amp; X) = 0;</span>
<span id="L25"><span class="lineNum"> 25</span> : std::vector&lt;std::vector&lt;double&gt;&gt; virtual predict_proba(std::vector&lt;std::vector&lt;int &gt;&gt;&amp; X) = 0;</span>
<span id="L26"><span class="lineNum"> 26</span> : status_t virtual getStatus() const = 0;</span>
<span id="L27"><span class="lineNum"> 27</span> : float virtual score(std::vector&lt;std::vector&lt;int&gt;&gt;&amp; X, std::vector&lt;int&gt;&amp; y) = 0;</span>
<span id="L28"><span class="lineNum"> 28</span> : float virtual score(torch::Tensor&amp; X, torch::Tensor&amp; y) = 0;</span>
<span id="L29"><span class="lineNum"> 29</span> : int virtual getNumberOfNodes()const = 0;</span>
<span id="L30"><span class="lineNum"> 30</span> : int virtual getNumberOfEdges()const = 0;</span>
<span id="L31"><span class="lineNum"> 31</span> : int virtual getNumberOfStates() const = 0;</span>
<span id="L32"><span class="lineNum"> 32</span> : int virtual getClassNumStates() const = 0;</span>
<span id="L33"><span class="lineNum"> 33</span> : std::vector&lt;std::string&gt; virtual show() const = 0;</span>
<span id="L34"><span class="lineNum"> 34</span> : std::vector&lt;std::string&gt; virtual graph(const std::string&amp; title = &quot;&quot;) const = 0;</span>
<span id="L35"><span class="lineNum"> 35</span> : virtual std::string getVersion() = 0;</span>
<span id="L36"><span class="lineNum"> 36</span> : std::vector&lt;std::string&gt; virtual topological_order() = 0;</span>
<span id="L37"><span class="lineNum"> 37</span> : std::vector&lt;std::string&gt; virtual getNotes() const = 0;</span>
<span id="L38"><span class="lineNum"> 38</span> : std::string virtual dump_cpt()const = 0;</span>
<span id="L39"><span class="lineNum"> 39</span> : virtual void setHyperparameters(const nlohmann::json&amp; hyperparameters) = 0;</span>
<span id="L40"><span class="lineNum"> 40</span> : std::vector&lt;std::string&gt;&amp; getValidHyperparameters() { return validHyperparameters; }</span>
<span id="L41"><span class="lineNum"> 41</span> : protected:</span>
<span id="L42"><span class="lineNum"> 42</span> : virtual void trainModel(const torch::Tensor&amp; weights) = 0;</span>
<span id="L43"><span class="lineNum"> 43</span> : std::vector&lt;std::string&gt; validHyperparameters;</span>
<span id="L44"><span class="lineNum"> 44</span> : };</span>
<span id="L45"><span class="lineNum"> 45</span> : }</span>
</pre>
</td>
</tr>
</table>
<br>
<table width="100%" border=0 cellspacing=0 cellpadding=0>
<tr><td class="ruler"><img src="../glass.png" width=3 height=3 alt=""></td></tr>
<tr><td class="versionInfo">Generated by: <a href="https://github.com//linux-test-project/lcov" target="_parent">LCOV version 2.0-1</a></td></tr>
</table>
<br>
</body>
</html>

View File

@ -1,32 +0,0 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html lang="en">
<head>
<title>LCOV - BayesNet Coverage Report - bayesnet/BaseClassifier.h</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" type="text/css" href="../gcov.css">
</head>
<body>
<map name="overview">
<area shape="rect" coords="0,0,79,3" href="BaseClassifier.h.gcov.html#L1" target="source" alt="overview">
<area shape="rect" coords="0,4,79,7" href="BaseClassifier.h.gcov.html#L1" target="source" alt="overview">
<area shape="rect" coords="0,8,79,11" href="BaseClassifier.h.gcov.html#L1" target="source" alt="overview">
<area shape="rect" coords="0,12,79,15" href="BaseClassifier.h.gcov.html#L1" target="source" alt="overview">
<area shape="rect" coords="0,16,79,19" href="BaseClassifier.h.gcov.html#L5" target="source" alt="overview">
<area shape="rect" coords="0,20,79,23" href="BaseClassifier.h.gcov.html#L9" target="source" alt="overview">
<area shape="rect" coords="0,24,79,27" href="BaseClassifier.h.gcov.html#L13" target="source" alt="overview">
<area shape="rect" coords="0,28,79,31" href="BaseClassifier.h.gcov.html#L17" target="source" alt="overview">
<area shape="rect" coords="0,32,79,35" href="BaseClassifier.h.gcov.html#L21" target="source" alt="overview">
<area shape="rect" coords="0,36,79,39" href="BaseClassifier.h.gcov.html#L25" target="source" alt="overview">
<area shape="rect" coords="0,40,79,43" href="BaseClassifier.h.gcov.html#L29" target="source" alt="overview">
<area shape="rect" coords="0,44,79,47" href="BaseClassifier.h.gcov.html#L33" target="source" alt="overview">
</map>
<center>
<a href="BaseClassifier.h.gcov.html#top" target="source">Top</a><br><br>
<img src="BaseClassifier.h.gcov.png" width=80 height=44 alt="Overview" border=0 usemap="#overview">
</center>
</body>
</html>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 372 B

View File

@ -1,251 +0,0 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>LCOV - BayesNet Coverage Report - bayesnet/classifiers/Classifier.cc - functions</title>
<link rel="stylesheet" type="text/css" href="../../gcov.css">
</head>
<body>
<table width="100%" border=0 cellspacing=0 cellpadding=0>
<tr><td class="title">LCOV - code coverage report</td></tr>
<tr><td class="ruler"><img src="../../glass.png" width=3 height=3 alt=""></td></tr>
<tr>
<td width="100%">
<table cellpadding=1 border=0 width="100%">
<tr>
<td width="10%" class="headerItem">Current view:</td>
<td width="10%" class="headerValue"><a href="../../index.html" target="_parent">top level</a> - <a href="index.html" target="_parent">bayesnet/classifiers</a> - Classifier.cc<span style="font-size: 80%;"> (<a href="Classifier.cc.gcov.html">source</a> / functions)</span></td>
<td width="5%"></td>
<td width="5%"></td>
<td width="5%" class="headerCovTableHead">Coverage</td>
<td width="5%" class="headerCovTableHead" title="Covered + Uncovered code">Total</td>
<td width="5%" class="headerCovTableHead" title="Exercised code only">Hit</td>
</tr>
<tr>
<td class="headerItem">Test:</td>
<td class="headerValue">BayesNet Coverage Report</td>
<td></td>
<td class="headerItem">Lines:</td>
<td class="headerCovTableEntryHi">100.0&nbsp;%</td>
<td class="headerCovTableEntry">126</td>
<td class="headerCovTableEntry">126</td>
</tr>
<tr>
<td class="headerItem">Test Date:</td>
<td class="headerValue">2024-05-06 17:54:04</td>
<td></td>
<td class="headerItem">Functions:</td>
<td class="headerCovTableEntryHi">100.0&nbsp;%</td>
<td class="headerCovTableEntry">24</td>
<td class="headerCovTableEntry">24</td>
</tr>
<tr>
<td class="headerItem">Legend:</td>
<td class="headerValueLeg"> Lines:
<span class="coverLegendCov">hit</span>
<span class="coverLegendNoCov">not hit</span>
</td>
<td></td>
</tr>
<tr><td><img src="../../glass.png" width=3 height=3 alt=""></td></tr>
</table>
</td>
</tr>
<tr><td class="ruler"><img src="../../glass.png" width=3 height=3 alt=""></td></tr>
</table>
<center>
<table cellpadding=1 cellspacing=1 border=0>
<tr><td><br></td></tr>
<tr>
<td class="tableHead">Function Name <span title="Click to sort table by function name" class="tableHeadSort"><a href="Classifier.cc.func.html"><img src="../../updown.png" width=10 height=14 alt="Sort by function name" title="Click to sort table by function name" border=0></a></span></td>
<td class="tableHead">Hit count <span title="Click to sort table by function hit count" class="tableHeadSort"><img src="../../glass.png" width=10 height=14 alt="Sort by function hit count" title="Click to sort table by function hit count" border=0></span></td>
</tr>
<tr>
<td class="coverFn"><a href="Classifier.cc.gcov.html#L182">bayesnet::Classifier::dump_cpt[abi:cxx11]() const</a></td>
<td class="coverFnHi">4</td>
</tr>
<tr>
<td class="coverFn"><a href="Classifier.cc.gcov.html#L178">bayesnet::Classifier::topological_order[abi:cxx11]()</a></td>
<td class="coverFnHi">4</td>
</tr>
<tr>
<td class="coverFn"><a href="Classifier.cc.gcov.html#L101">bayesnet::Classifier::predict(std::vector&lt;std::vector&lt;int, std::allocator&lt;int&gt; &gt;, std::allocator&lt;std::vector&lt;int, std::allocator&lt;int&gt; &gt; &gt; &gt;&amp;)</a></td>
<td class="coverFnHi">16</td>
</tr>
<tr>
<td class="coverFn"><a href="Classifier.cc.gcov.html#L142">bayesnet::Classifier::score(std::vector&lt;std::vector&lt;int, std::allocator&lt;int&gt; &gt;, std::allocator&lt;std::vector&lt;int, std::allocator&lt;int&gt; &gt; &gt; &gt;&amp;, std::vector&lt;int, std::allocator&lt;int&gt; &gt;&amp;)</a></td>
<td class="coverFnHi">16</td>
</tr>
<tr>
<td class="coverFn"><a href="Classifier.cc.gcov.html#L170">bayesnet::Classifier::getNumberOfStates() const</a></td>
<td class="coverFnHi">24</td>
</tr>
<tr>
<td class="coverFn"><a href="Classifier.cc.gcov.html#L149">bayesnet::Classifier::show[abi:cxx11]() const</a></td>
<td class="coverFnHi">24</td>
</tr>
<tr>
<td class="coverFn"><a href="Classifier.cc.gcov.html#L186">bayesnet::Classifier::setHyperparameters(nlohmann::json_abi_v3_11_3::basic_json&lt;std::map, std::vector, std::__cxx11::basic_string&lt;char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt;, bool, long, unsigned long, double, std::allocator, nlohmann::json_abi_v3_11_3::adl_serializer, std::vector&lt;unsigned char, std::allocator&lt;unsigned char&gt; &gt;, void&gt; const&amp;)</a></td>
<td class="coverFnHi">92</td>
</tr>
<tr>
<td class="coverFn"><a href="Classifier.cc.gcov.html#L137">bayesnet::Classifier::score(at::Tensor&amp;, at::Tensor&amp;)</a></td>
<td class="coverFnHi">112</td>
</tr>
<tr>
<td class="coverFn"><a href="Classifier.cc.gcov.html#L47">bayesnet::Classifier::fit(at::Tensor&amp;, at::Tensor&amp;, std::vector&lt;std::__cxx11::basic_string&lt;char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt;, std::allocator&lt;std::__cxx11::basic_string&lt;char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt; &gt; &gt; const&amp;, std::__cxx11::basic_string&lt;char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt; const&amp;, std::map&lt;std::__cxx11::basic_string&lt;char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt;, std::vector&lt;int, std::allocator&lt;int&gt; &gt;, std::less&lt;std::__cxx11::basic_string&lt;char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt; &gt;, std::allocator&lt;std::pair&lt;std::__cxx11::basic_string&lt;char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt; const, std::vector&lt;int, std::allocator&lt;int&gt; &gt; &gt; &gt; &gt;&amp;)</a></td>
<td class="coverFnHi">128</td>
</tr>
<tr>
<td class="coverFn"><a href="Classifier.cc.gcov.html#L55">bayesnet::Classifier::fit(std::vector&lt;std::vector&lt;int, std::allocator&lt;int&gt; &gt;, std::allocator&lt;std::vector&lt;int, std::allocator&lt;int&gt; &gt; &gt; &gt;&amp;, std::vector&lt;int, std::allocator&lt;int&gt; &gt;&amp;, std::vector&lt;std::__cxx11::basic_string&lt;char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt;, std::allocator&lt;std::__cxx11::basic_string&lt;char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt; &gt; &gt; const&amp;, std::__cxx11::basic_string&lt;char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt; const&amp;, std::map&lt;std::__cxx11::basic_string&lt;char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt;, std::vector&lt;int, std::allocator&lt;int&gt; &gt;, std::less&lt;std::__cxx11::basic_string&lt;char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt; &gt;, std::allocator&lt;std::pair&lt;std::__cxx11::basic_string&lt;char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt; const, std::vector&lt;int, std::allocator&lt;int&gt; &gt; &gt; &gt; &gt;&amp;)</a></td>
<td class="coverFnHi">136</td>
</tr>
<tr>
<td class="coverFn"><a href="Classifier.cc.gcov.html#L166">bayesnet::Classifier::getNumberOfEdges() const</a></td>
<td class="coverFnHi">332</td>
</tr>
<tr>
<td class="coverFn"><a href="Classifier.cc.gcov.html#L161">bayesnet::Classifier::getNumberOfNodes() const</a></td>
<td class="coverFnHi">332</td>
</tr>
<tr>
<td class="coverFn"><a href="Classifier.cc.gcov.html#L28">bayesnet::Classifier::buildDataset(at::Tensor&amp;)</a></td>
<td class="coverFnHi">340</td>
</tr>
<tr>
<td class="coverFn"><a href="Classifier.cc.gcov.html#L174">bayesnet::Classifier::getClassNumStates() const</a></td>
<td class="coverFnHi">348</td>
</tr>
<tr>
<td class="coverFn"><a href="Classifier.cc.gcov.html#L122">bayesnet::Classifier::predict_proba(std::vector&lt;std::vector&lt;int, std::allocator&lt;int&gt; &gt;, std::allocator&lt;std::vector&lt;int, std::allocator&lt;int&gt; &gt; &gt; &gt;&amp;)</a></td>
<td class="coverFnHi">548</td>
</tr>
<tr>
<td class="coverFn"><a href="Classifier.cc.gcov.html#L72">bayesnet::Classifier::fit(at::Tensor&amp;, std::vector&lt;std::__cxx11::basic_string&lt;char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt;, std::allocator&lt;std::__cxx11::basic_string&lt;char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt; &gt; &gt; const&amp;, std::__cxx11::basic_string&lt;char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt; const&amp;, std::map&lt;std::__cxx11::basic_string&lt;char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt;, std::vector&lt;int, std::allocator&lt;int&gt; &gt;, std::less&lt;std::__cxx11::basic_string&lt;char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt; &gt;, std::allocator&lt;std::pair&lt;std::__cxx11::basic_string&lt;char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt; const, std::vector&lt;int, std::allocator&lt;int&gt; &gt; &gt; &gt; &gt;&amp;, at::Tensor const&amp;)</a></td>
<td class="coverFnHi">660</td>
</tr>
<tr>
<td class="coverFn"><a href="Classifier.cc.gcov.html#L66">bayesnet::Classifier::fit(at::Tensor&amp;, std::vector&lt;std::__cxx11::basic_string&lt;char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt;, std::allocator&lt;std::__cxx11::basic_string&lt;char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt; &gt; &gt; const&amp;, std::__cxx11::basic_string&lt;char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt; const&amp;, std::map&lt;std::__cxx11::basic_string&lt;char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt;, std::vector&lt;int, std::allocator&lt;int&gt; &gt;, std::less&lt;std::__cxx11::basic_string&lt;char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt; &gt;, std::allocator&lt;std::pair&lt;std::__cxx11::basic_string&lt;char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt; const, std::vector&lt;int, std::allocator&lt;int&gt; &gt; &gt; &gt; &gt;&amp;)</a></td>
<td class="coverFnHi">852</td>
</tr>
<tr>
<td class="coverFn"><a href="Classifier.cc.gcov.html#L115">bayesnet::Classifier::predict_proba(at::Tensor&amp;)</a></td>
<td class="coverFnHi">1484</td>
</tr>
<tr>
<td class="coverFn"><a href="Classifier.cc.gcov.html#L153">bayesnet::Classifier::addNodes()</a></td>
<td class="coverFnHi">1576</td>
</tr>
<tr>
<td class="coverFn"><a href="Classifier.cc.gcov.html#L42">bayesnet::Classifier::trainModel(at::Tensor const&amp;)</a></td>
<td class="coverFnHi">1576</td>
</tr>
<tr>
<td class="coverFn"><a href="Classifier.cc.gcov.html#L12">bayesnet::Classifier::build(std::vector&lt;std::__cxx11::basic_string&lt;char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt;, std::allocator&lt;std::__cxx11::basic_string&lt;char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt; &gt; &gt; const&amp;, std::__cxx11::basic_string&lt;char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt; const&amp;, std::map&lt;std::__cxx11::basic_string&lt;char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt;, std::vector&lt;int, std::allocator&lt;int&gt; &gt;, std::less&lt;std::__cxx11::basic_string&lt;char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt; &gt;, std::allocator&lt;std::pair&lt;std::__cxx11::basic_string&lt;char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt; const, std::vector&lt;int, std::allocator&lt;int&gt; &gt; &gt; &gt; &gt;&amp;, at::Tensor const&amp;)</a></td>
<td class="coverFnHi">1760</td>
</tr>
<tr>
<td class="coverFn"><a href="Classifier.cc.gcov.html#L77">bayesnet::Classifier::checkFitParameters()</a></td>
<td class="coverFnHi">1760</td>
</tr>
<tr>
<td class="coverFn"><a href="Classifier.cc.gcov.html#L94">bayesnet::Classifier::predict(at::Tensor&amp;)</a></td>
<td class="coverFnHi">1844</td>
</tr>
<tr>
<td class="coverFn"><a href="Classifier.cc.gcov.html#L10">bayesnet::Classifier::Classifier(bayesnet::Network)</a></td>
<td class="coverFnHi">2240</td>
</tr>
</table>
<br>
</center>
<table width="100%" border=0 cellspacing=0 cellpadding=0>
<tr><td class="ruler"><img src="../../glass.png" width=3 height=3 alt=""></td></tr>
<tr><td class="versionInfo">Generated by: <a href="https://github.com//linux-test-project/lcov" target="_parent">LCOV version 2.0-1</a></td></tr>
</table>
<br>
</body>
</html>

View File

@ -1,251 +0,0 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>LCOV - BayesNet Coverage Report - bayesnet/classifiers/Classifier.cc - functions</title>
<link rel="stylesheet" type="text/css" href="../../gcov.css">
</head>
<body>
<table width="100%" border=0 cellspacing=0 cellpadding=0>
<tr><td class="title">LCOV - code coverage report</td></tr>
<tr><td class="ruler"><img src="../../glass.png" width=3 height=3 alt=""></td></tr>
<tr>
<td width="100%">
<table cellpadding=1 border=0 width="100%">
<tr>
<td width="10%" class="headerItem">Current view:</td>
<td width="10%" class="headerValue"><a href="../../index.html" target="_parent">top level</a> - <a href="index.html" target="_parent">bayesnet/classifiers</a> - Classifier.cc<span style="font-size: 80%;"> (<a href="Classifier.cc.gcov.html">source</a> / functions)</span></td>
<td width="5%"></td>
<td width="5%"></td>
<td width="5%" class="headerCovTableHead">Coverage</td>
<td width="5%" class="headerCovTableHead" title="Covered + Uncovered code">Total</td>
<td width="5%" class="headerCovTableHead" title="Exercised code only">Hit</td>
</tr>
<tr>
<td class="headerItem">Test:</td>
<td class="headerValue">BayesNet Coverage Report</td>
<td></td>
<td class="headerItem">Lines:</td>
<td class="headerCovTableEntryHi">100.0&nbsp;%</td>
<td class="headerCovTableEntry">126</td>
<td class="headerCovTableEntry">126</td>
</tr>
<tr>
<td class="headerItem">Test Date:</td>
<td class="headerValue">2024-05-06 17:54:04</td>
<td></td>
<td class="headerItem">Functions:</td>
<td class="headerCovTableEntryHi">100.0&nbsp;%</td>
<td class="headerCovTableEntry">24</td>
<td class="headerCovTableEntry">24</td>
</tr>
<tr>
<td class="headerItem">Legend:</td>
<td class="headerValueLeg"> Lines:
<span class="coverLegendCov">hit</span>
<span class="coverLegendNoCov">not hit</span>
</td>
<td></td>
</tr>
<tr><td><img src="../../glass.png" width=3 height=3 alt=""></td></tr>
</table>
</td>
</tr>
<tr><td class="ruler"><img src="../../glass.png" width=3 height=3 alt=""></td></tr>
</table>
<center>
<table cellpadding=1 cellspacing=1 border=0>
<tr><td><br></td></tr>
<tr>
<td class="tableHead">Function Name <span title="Click to sort table by function name" class="tableHeadSort"><img src="../../glass.png" width=10 height=14 alt="Sort by function name" title="Click to sort table by function name" border=0></span></td>
<td class="tableHead">Hit count <span title="Click to sort table by function hit count" class="tableHeadSort"><a href="Classifier.cc.func-c.html"><img src="../../updown.png" width=10 height=14 alt="Sort by function hit count" title="Click to sort table by function hit count" border=0></a></span></td>
</tr>
<tr>
<td class="coverFn"><a href="Classifier.cc.gcov.html#L10">bayesnet::Classifier::Classifier(bayesnet::Network)</a></td>
<td class="coverFnHi">2240</td>
</tr>
<tr>
<td class="coverFn"><a href="Classifier.cc.gcov.html#L153">bayesnet::Classifier::addNodes()</a></td>
<td class="coverFnHi">1576</td>
</tr>
<tr>
<td class="coverFn"><a href="Classifier.cc.gcov.html#L12">bayesnet::Classifier::build(std::vector&lt;std::__cxx11::basic_string&lt;char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt;, std::allocator&lt;std::__cxx11::basic_string&lt;char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt; &gt; &gt; const&amp;, std::__cxx11::basic_string&lt;char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt; const&amp;, std::map&lt;std::__cxx11::basic_string&lt;char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt;, std::vector&lt;int, std::allocator&lt;int&gt; &gt;, std::less&lt;std::__cxx11::basic_string&lt;char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt; &gt;, std::allocator&lt;std::pair&lt;std::__cxx11::basic_string&lt;char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt; const, std::vector&lt;int, std::allocator&lt;int&gt; &gt; &gt; &gt; &gt;&amp;, at::Tensor const&amp;)</a></td>
<td class="coverFnHi">1760</td>
</tr>
<tr>
<td class="coverFn"><a href="Classifier.cc.gcov.html#L28">bayesnet::Classifier::buildDataset(at::Tensor&amp;)</a></td>
<td class="coverFnHi">340</td>
</tr>
<tr>
<td class="coverFn"><a href="Classifier.cc.gcov.html#L77">bayesnet::Classifier::checkFitParameters()</a></td>
<td class="coverFnHi">1760</td>
</tr>
<tr>
<td class="coverFn"><a href="Classifier.cc.gcov.html#L182">bayesnet::Classifier::dump_cpt[abi:cxx11]() const</a></td>
<td class="coverFnHi">4</td>
</tr>
<tr>
<td class="coverFn"><a href="Classifier.cc.gcov.html#L47">bayesnet::Classifier::fit(at::Tensor&amp;, at::Tensor&amp;, std::vector&lt;std::__cxx11::basic_string&lt;char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt;, std::allocator&lt;std::__cxx11::basic_string&lt;char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt; &gt; &gt; const&amp;, std::__cxx11::basic_string&lt;char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt; const&amp;, std::map&lt;std::__cxx11::basic_string&lt;char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt;, std::vector&lt;int, std::allocator&lt;int&gt; &gt;, std::less&lt;std::__cxx11::basic_string&lt;char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt; &gt;, std::allocator&lt;std::pair&lt;std::__cxx11::basic_string&lt;char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt; const, std::vector&lt;int, std::allocator&lt;int&gt; &gt; &gt; &gt; &gt;&amp;)</a></td>
<td class="coverFnHi">128</td>
</tr>
<tr>
<td class="coverFn"><a href="Classifier.cc.gcov.html#L66">bayesnet::Classifier::fit(at::Tensor&amp;, std::vector&lt;std::__cxx11::basic_string&lt;char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt;, std::allocator&lt;std::__cxx11::basic_string&lt;char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt; &gt; &gt; const&amp;, std::__cxx11::basic_string&lt;char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt; const&amp;, std::map&lt;std::__cxx11::basic_string&lt;char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt;, std::vector&lt;int, std::allocator&lt;int&gt; &gt;, std::less&lt;std::__cxx11::basic_string&lt;char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt; &gt;, std::allocator&lt;std::pair&lt;std::__cxx11::basic_string&lt;char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt; const, std::vector&lt;int, std::allocator&lt;int&gt; &gt; &gt; &gt; &gt;&amp;)</a></td>
<td class="coverFnHi">852</td>
</tr>
<tr>
<td class="coverFn"><a href="Classifier.cc.gcov.html#L72">bayesnet::Classifier::fit(at::Tensor&amp;, std::vector&lt;std::__cxx11::basic_string&lt;char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt;, std::allocator&lt;std::__cxx11::basic_string&lt;char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt; &gt; &gt; const&amp;, std::__cxx11::basic_string&lt;char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt; const&amp;, std::map&lt;std::__cxx11::basic_string&lt;char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt;, std::vector&lt;int, std::allocator&lt;int&gt; &gt;, std::less&lt;std::__cxx11::basic_string&lt;char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt; &gt;, std::allocator&lt;std::pair&lt;std::__cxx11::basic_string&lt;char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt; const, std::vector&lt;int, std::allocator&lt;int&gt; &gt; &gt; &gt; &gt;&amp;, at::Tensor const&amp;)</a></td>
<td class="coverFnHi">660</td>
</tr>
<tr>
<td class="coverFn"><a href="Classifier.cc.gcov.html#L55">bayesnet::Classifier::fit(std::vector&lt;std::vector&lt;int, std::allocator&lt;int&gt; &gt;, std::allocator&lt;std::vector&lt;int, std::allocator&lt;int&gt; &gt; &gt; &gt;&amp;, std::vector&lt;int, std::allocator&lt;int&gt; &gt;&amp;, std::vector&lt;std::__cxx11::basic_string&lt;char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt;, std::allocator&lt;std::__cxx11::basic_string&lt;char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt; &gt; &gt; const&amp;, std::__cxx11::basic_string&lt;char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt; const&amp;, std::map&lt;std::__cxx11::basic_string&lt;char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt;, std::vector&lt;int, std::allocator&lt;int&gt; &gt;, std::less&lt;std::__cxx11::basic_string&lt;char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt; &gt;, std::allocator&lt;std::pair&lt;std::__cxx11::basic_string&lt;char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt; const, std::vector&lt;int, std::allocator&lt;int&gt; &gt; &gt; &gt; &gt;&amp;)</a></td>
<td class="coverFnHi">136</td>
</tr>
<tr>
<td class="coverFn"><a href="Classifier.cc.gcov.html#L174">bayesnet::Classifier::getClassNumStates() const</a></td>
<td class="coverFnHi">348</td>
</tr>
<tr>
<td class="coverFn"><a href="Classifier.cc.gcov.html#L166">bayesnet::Classifier::getNumberOfEdges() const</a></td>
<td class="coverFnHi">332</td>
</tr>
<tr>
<td class="coverFn"><a href="Classifier.cc.gcov.html#L161">bayesnet::Classifier::getNumberOfNodes() const</a></td>
<td class="coverFnHi">332</td>
</tr>
<tr>
<td class="coverFn"><a href="Classifier.cc.gcov.html#L170">bayesnet::Classifier::getNumberOfStates() const</a></td>
<td class="coverFnHi">24</td>
</tr>
<tr>
<td class="coverFn"><a href="Classifier.cc.gcov.html#L94">bayesnet::Classifier::predict(at::Tensor&amp;)</a></td>
<td class="coverFnHi">1844</td>
</tr>
<tr>
<td class="coverFn"><a href="Classifier.cc.gcov.html#L101">bayesnet::Classifier::predict(std::vector&lt;std::vector&lt;int, std::allocator&lt;int&gt; &gt;, std::allocator&lt;std::vector&lt;int, std::allocator&lt;int&gt; &gt; &gt; &gt;&amp;)</a></td>
<td class="coverFnHi">16</td>
</tr>
<tr>
<td class="coverFn"><a href="Classifier.cc.gcov.html#L115">bayesnet::Classifier::predict_proba(at::Tensor&amp;)</a></td>
<td class="coverFnHi">1484</td>
</tr>
<tr>
<td class="coverFn"><a href="Classifier.cc.gcov.html#L122">bayesnet::Classifier::predict_proba(std::vector&lt;std::vector&lt;int, std::allocator&lt;int&gt; &gt;, std::allocator&lt;std::vector&lt;int, std::allocator&lt;int&gt; &gt; &gt; &gt;&amp;)</a></td>
<td class="coverFnHi">548</td>
</tr>
<tr>
<td class="coverFn"><a href="Classifier.cc.gcov.html#L137">bayesnet::Classifier::score(at::Tensor&amp;, at::Tensor&amp;)</a></td>
<td class="coverFnHi">112</td>
</tr>
<tr>
<td class="coverFn"><a href="Classifier.cc.gcov.html#L142">bayesnet::Classifier::score(std::vector&lt;std::vector&lt;int, std::allocator&lt;int&gt; &gt;, std::allocator&lt;std::vector&lt;int, std::allocator&lt;int&gt; &gt; &gt; &gt;&amp;, std::vector&lt;int, std::allocator&lt;int&gt; &gt;&amp;)</a></td>
<td class="coverFnHi">16</td>
</tr>
<tr>
<td class="coverFn"><a href="Classifier.cc.gcov.html#L186">bayesnet::Classifier::setHyperparameters(nlohmann::json_abi_v3_11_3::basic_json&lt;std::map, std::vector, std::__cxx11::basic_string&lt;char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt;, bool, long, unsigned long, double, std::allocator, nlohmann::json_abi_v3_11_3::adl_serializer, std::vector&lt;unsigned char, std::allocator&lt;unsigned char&gt; &gt;, void&gt; const&amp;)</a></td>
<td class="coverFnHi">92</td>
</tr>
<tr>
<td class="coverFn"><a href="Classifier.cc.gcov.html#L149">bayesnet::Classifier::show[abi:cxx11]() const</a></td>
<td class="coverFnHi">24</td>
</tr>
<tr>
<td class="coverFn"><a href="Classifier.cc.gcov.html#L178">bayesnet::Classifier::topological_order[abi:cxx11]()</a></td>
<td class="coverFnHi">4</td>
</tr>
<tr>
<td class="coverFn"><a href="Classifier.cc.gcov.html#L42">bayesnet::Classifier::trainModel(at::Tensor const&amp;)</a></td>
<td class="coverFnHi">1576</td>
</tr>
</table>
<br>
</center>
<table width="100%" border=0 cellspacing=0 cellpadding=0>
<tr><td class="ruler"><img src="../../glass.png" width=3 height=3 alt=""></td></tr>
<tr><td class="versionInfo">Generated by: <a href="https://github.com//linux-test-project/lcov" target="_parent">LCOV version 2.0-1</a></td></tr>
</table>
<br>
</body>
</html>

View File

@ -1,19 +0,0 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN">
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>LCOV - BayesNet Coverage Report - bayesnet/classifiers/Classifier.cc</title>
<link rel="stylesheet" type="text/css" href="../../gcov.css">
</head>
<frameset cols="120,*">
<frame src="Classifier.cc.gcov.overview.html" name="overview">
<frame src="Classifier.cc.gcov.html" name="source">
<noframes>
<center>Frames not supported by your browser!<br></center>
</noframes>
</frameset>
</html>

View File

@ -1,278 +0,0 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>LCOV - BayesNet Coverage Report - bayesnet/classifiers/Classifier.cc</title>
<link rel="stylesheet" type="text/css" href="../../gcov.css">
</head>
<body>
<table width="100%" border=0 cellspacing=0 cellpadding=0>
<tr><td class="title">LCOV - code coverage report</td></tr>
<tr><td class="ruler"><img src="../../glass.png" width=3 height=3 alt=""></td></tr>
<tr>
<td width="100%">
<table cellpadding=1 border=0 width="100%">
<tr>
<td width="10%" class="headerItem">Current view:</td>
<td width="10%" class="headerValue"><a href="../../index.html" target="_parent">top level</a> - <a href="index.html" target="_parent">bayesnet/classifiers</a> - Classifier.cc<span style="font-size: 80%;"> (source / <a href="Classifier.cc.func-c.html">functions</a>)</span></td>
<td width="5%"></td>
<td width="5%"></td>
<td width="5%" class="headerCovTableHead">Coverage</td>
<td width="5%" class="headerCovTableHead" title="Covered + Uncovered code">Total</td>
<td width="5%" class="headerCovTableHead" title="Exercised code only">Hit</td>
</tr>
<tr>
<td class="headerItem">Test:</td>
<td class="headerValue">BayesNet Coverage Report</td>
<td></td>
<td class="headerItem">Lines:</td>
<td class="headerCovTableEntryHi">100.0&nbsp;%</td>
<td class="headerCovTableEntry">126</td>
<td class="headerCovTableEntry">126</td>
</tr>
<tr>
<td class="headerItem">Test Date:</td>
<td class="headerValue">2024-05-06 17:54:04</td>
<td></td>
<td class="headerItem">Functions:</td>
<td class="headerCovTableEntryHi">100.0&nbsp;%</td>
<td class="headerCovTableEntry">24</td>
<td class="headerCovTableEntry">24</td>
</tr>
<tr>
<td class="headerItem">Legend:</td>
<td class="headerValueLeg"> Lines:
<span class="coverLegendCov">hit</span>
<span class="coverLegendNoCov">not hit</span>
</td>
<td></td>
</tr>
<tr><td><img src="../../glass.png" width=3 height=3 alt=""></td></tr>
</table>
</td>
</tr>
<tr><td class="ruler"><img src="../../glass.png" width=3 height=3 alt=""></td></tr>
</table>
<table cellpadding=0 cellspacing=0 border=0>
<tr>
<td><br></td>
</tr>
<tr>
<td>
<pre class="sourceHeading"> Line data Source code</pre>
<pre class="source">
<span id="L1"><span class="lineNum"> 1</span> : // ***************************************************************</span>
<span id="L2"><span class="lineNum"> 2</span> : // SPDX-FileCopyrightText: Copyright 2024 Ricardo Montañana Gómez</span>
<span id="L3"><span class="lineNum"> 3</span> : // SPDX-FileType: SOURCE</span>
<span id="L4"><span class="lineNum"> 4</span> : // SPDX-License-Identifier: MIT</span>
<span id="L5"><span class="lineNum"> 5</span> : // ***************************************************************</span>
<span id="L6"><span class="lineNum"> 6</span> : </span>
<span id="L7"><span class="lineNum"> 7</span> : #include &lt;sstream&gt;</span>
<span id="L8"><span class="lineNum"> 8</span> : #include &quot;bayesnet/utils/bayesnetUtils.h&quot;</span>
<span id="L9"><span class="lineNum"> 9</span> : #include &quot;Classifier.h&quot;</span>
<span id="L10"><span class="lineNum"> 10</span> : </span>
<span id="L11"><span class="lineNum"> 11</span> : namespace bayesnet {</span>
<span id="L12"><span class="lineNum"> 12</span> <span class="tlaGNC tlaBgGNC"> 2240 : Classifier::Classifier(Network model) : model(model), m(0), n(0), metrics(Metrics()), fitted(false) {}</span></span>
<span id="L13"><span class="lineNum"> 13</span> : const std::string CLASSIFIER_NOT_FITTED = &quot;Classifier has not been fitted&quot;;</span>
<span id="L14"><span class="lineNum"> 14</span> <span class="tlaGNC"> 1760 : Classifier&amp; Classifier::build(const std::vector&lt;std::string&gt;&amp; features, const std::string&amp; className, std::map&lt;std::string, std::vector&lt;int&gt;&gt;&amp; states, const torch::Tensor&amp; weights)</span></span>
<span id="L15"><span class="lineNum"> 15</span> : {</span>
<span id="L16"><span class="lineNum"> 16</span> <span class="tlaGNC"> 1760 : this-&gt;features = features;</span></span>
<span id="L17"><span class="lineNum"> 17</span> <span class="tlaGNC"> 1760 : this-&gt;className = className;</span></span>
<span id="L18"><span class="lineNum"> 18</span> <span class="tlaGNC"> 1760 : this-&gt;states = states;</span></span>
<span id="L19"><span class="lineNum"> 19</span> <span class="tlaGNC"> 1760 : m = dataset.size(1);</span></span>
<span id="L20"><span class="lineNum"> 20</span> <span class="tlaGNC"> 1760 : n = features.size();</span></span>
<span id="L21"><span class="lineNum"> 21</span> <span class="tlaGNC"> 1760 : checkFitParameters();</span></span>
<span id="L22"><span class="lineNum"> 22</span> <span class="tlaGNC"> 1728 : auto n_classes = states.at(className).size();</span></span>
<span id="L23"><span class="lineNum"> 23</span> <span class="tlaGNC"> 1728 : metrics = Metrics(dataset, features, className, n_classes);</span></span>
<span id="L24"><span class="lineNum"> 24</span> <span class="tlaGNC"> 1728 : model.initialize();</span></span>
<span id="L25"><span class="lineNum"> 25</span> <span class="tlaGNC"> 1728 : buildModel(weights);</span></span>
<span id="L26"><span class="lineNum"> 26</span> <span class="tlaGNC"> 1728 : trainModel(weights);</span></span>
<span id="L27"><span class="lineNum"> 27</span> <span class="tlaGNC"> 1712 : fitted = true;</span></span>
<span id="L28"><span class="lineNum"> 28</span> <span class="tlaGNC"> 1712 : return *this;</span></span>
<span id="L29"><span class="lineNum"> 29</span> : }</span>
<span id="L30"><span class="lineNum"> 30</span> <span class="tlaGNC"> 340 : void Classifier::buildDataset(torch::Tensor&amp; ytmp)</span></span>
<span id="L31"><span class="lineNum"> 31</span> : {</span>
<span id="L32"><span class="lineNum"> 32</span> : try {</span>
<span id="L33"><span class="lineNum"> 33</span> <span class="tlaGNC"> 340 : auto yresized = torch::transpose(ytmp.view({ ytmp.size(0), 1 }), 0, 1);</span></span>
<span id="L34"><span class="lineNum"> 34</span> <span class="tlaGNC"> 1052 : dataset = torch::cat({ dataset, yresized }, 0);</span></span>
<span id="L35"><span class="lineNum"> 35</span> <span class="tlaGNC"> 340 : }</span></span>
<span id="L36"><span class="lineNum"> 36</span> <span class="tlaGNC"> 16 : catch (const std::exception&amp; e) {</span></span>
<span id="L37"><span class="lineNum"> 37</span> <span class="tlaGNC"> 16 : std::stringstream oss;</span></span>
<span id="L38"><span class="lineNum"> 38</span> <span class="tlaGNC"> 16 : oss &lt;&lt; &quot;* Error in X and y dimensions *\n&quot;;</span></span>
<span id="L39"><span class="lineNum"> 39</span> <span class="tlaGNC"> 16 : oss &lt;&lt; &quot;X dimensions: &quot; &lt;&lt; dataset.sizes() &lt;&lt; &quot;\n&quot;;</span></span>
<span id="L40"><span class="lineNum"> 40</span> <span class="tlaGNC"> 16 : oss &lt;&lt; &quot;y dimensions: &quot; &lt;&lt; ytmp.sizes();</span></span>
<span id="L41"><span class="lineNum"> 41</span> <span class="tlaGNC"> 16 : throw std::runtime_error(oss.str());</span></span>
<span id="L42"><span class="lineNum"> 42</span> <span class="tlaGNC"> 32 : }</span></span>
<span id="L43"><span class="lineNum"> 43</span> <span class="tlaGNC"> 680 : }</span></span>
<span id="L44"><span class="lineNum"> 44</span> <span class="tlaGNC"> 1576 : void Classifier::trainModel(const torch::Tensor&amp; weights)</span></span>
<span id="L45"><span class="lineNum"> 45</span> : {</span>
<span id="L46"><span class="lineNum"> 46</span> <span class="tlaGNC"> 1576 : model.fit(dataset, weights, features, className, states);</span></span>
<span id="L47"><span class="lineNum"> 47</span> <span class="tlaGNC"> 1576 : }</span></span>
<span id="L48"><span class="lineNum"> 48</span> : // X is nxm where n is the number of features and m the number of samples</span>
<span id="L49"><span class="lineNum"> 49</span> <span class="tlaGNC"> 128 : Classifier&amp; Classifier::fit(torch::Tensor&amp; X, torch::Tensor&amp; y, const std::vector&lt;std::string&gt;&amp; features, const std::string&amp; className, std::map&lt;std::string, std::vector&lt;int&gt;&gt;&amp; states)</span></span>
<span id="L50"><span class="lineNum"> 50</span> : {</span>
<span id="L51"><span class="lineNum"> 51</span> <span class="tlaGNC"> 128 : dataset = X;</span></span>
<span id="L52"><span class="lineNum"> 52</span> <span class="tlaGNC"> 128 : buildDataset(y);</span></span>
<span id="L53"><span class="lineNum"> 53</span> <span class="tlaGNC"> 120 : const torch::Tensor weights = torch::full({ dataset.size(1) }, 1.0 / dataset.size(1), torch::kDouble);</span></span>
<span id="L54"><span class="lineNum"> 54</span> <span class="tlaGNC"> 208 : return build(features, className, states, weights);</span></span>
<span id="L55"><span class="lineNum"> 55</span> <span class="tlaGNC"> 120 : }</span></span>
<span id="L56"><span class="lineNum"> 56</span> : // X is nxm where n is the number of features and m the number of samples</span>
<span id="L57"><span class="lineNum"> 57</span> <span class="tlaGNC"> 136 : Classifier&amp; Classifier::fit(std::vector&lt;std::vector&lt;int&gt;&gt;&amp; X, std::vector&lt;int&gt;&amp; y, const std::vector&lt;std::string&gt;&amp; features, const std::string&amp; className, std::map&lt;std::string, std::vector&lt;int&gt;&gt;&amp; states)</span></span>
<span id="L58"><span class="lineNum"> 58</span> : {</span>
<span id="L59"><span class="lineNum"> 59</span> <span class="tlaGNC"> 136 : dataset = torch::zeros({ static_cast&lt;int&gt;(X.size()), static_cast&lt;int&gt;(X[0].size()) }, torch::kInt32);</span></span>
<span id="L60"><span class="lineNum"> 60</span> <span class="tlaGNC"> 976 : for (int i = 0; i &lt; X.size(); ++i) {</span></span>
<span id="L61"><span class="lineNum"> 61</span> <span class="tlaGNC"> 3360 : dataset.index_put_({ i, &quot;...&quot; }, torch::tensor(X[i], torch::kInt32));</span></span>
<span id="L62"><span class="lineNum"> 62</span> : }</span>
<span id="L63"><span class="lineNum"> 63</span> <span class="tlaGNC"> 136 : auto ytmp = torch::tensor(y, torch::kInt32);</span></span>
<span id="L64"><span class="lineNum"> 64</span> <span class="tlaGNC"> 136 : buildDataset(ytmp);</span></span>
<span id="L65"><span class="lineNum"> 65</span> <span class="tlaGNC"> 128 : const torch::Tensor weights = torch::full({ dataset.size(1) }, 1.0 / dataset.size(1), torch::kDouble);</span></span>
<span id="L66"><span class="lineNum"> 66</span> <span class="tlaGNC"> 240 : return build(features, className, states, weights);</span></span>
<span id="L67"><span class="lineNum"> 67</span> <span class="tlaGNC"> 992 : }</span></span>
<span id="L68"><span class="lineNum"> 68</span> <span class="tlaGNC"> 852 : Classifier&amp; Classifier::fit(torch::Tensor&amp; dataset, const std::vector&lt;std::string&gt;&amp; features, const std::string&amp; className, std::map&lt;std::string, std::vector&lt;int&gt;&gt;&amp; states)</span></span>
<span id="L69"><span class="lineNum"> 69</span> : {</span>
<span id="L70"><span class="lineNum"> 70</span> <span class="tlaGNC"> 852 : this-&gt;dataset = dataset;</span></span>
<span id="L71"><span class="lineNum"> 71</span> <span class="tlaGNC"> 852 : const torch::Tensor weights = torch::full({ dataset.size(1) }, 1.0 / dataset.size(1), torch::kDouble);</span></span>
<span id="L72"><span class="lineNum"> 72</span> <span class="tlaGNC"> 1704 : return build(features, className, states, weights);</span></span>
<span id="L73"><span class="lineNum"> 73</span> <span class="tlaGNC"> 852 : }</span></span>
<span id="L74"><span class="lineNum"> 74</span> <span class="tlaGNC"> 660 : Classifier&amp; Classifier::fit(torch::Tensor&amp; dataset, const std::vector&lt;std::string&gt;&amp; features, const std::string&amp; className, std::map&lt;std::string, std::vector&lt;int&gt;&gt;&amp; states, const torch::Tensor&amp; weights)</span></span>
<span id="L75"><span class="lineNum"> 75</span> : {</span>
<span id="L76"><span class="lineNum"> 76</span> <span class="tlaGNC"> 660 : this-&gt;dataset = dataset;</span></span>
<span id="L77"><span class="lineNum"> 77</span> <span class="tlaGNC"> 660 : return build(features, className, states, weights);</span></span>
<span id="L78"><span class="lineNum"> 78</span> : }</span>
<span id="L79"><span class="lineNum"> 79</span> <span class="tlaGNC"> 1760 : void Classifier::checkFitParameters()</span></span>
<span id="L80"><span class="lineNum"> 80</span> : {</span>
<span id="L81"><span class="lineNum"> 81</span> <span class="tlaGNC"> 1760 : if (torch::is_floating_point(dataset)) {</span></span>
<span id="L82"><span class="lineNum"> 82</span> <span class="tlaGNC"> 8 : throw std::invalid_argument(&quot;dataset (X, y) must be of type Integer&quot;);</span></span>
<span id="L83"><span class="lineNum"> 83</span> : }</span>
<span id="L84"><span class="lineNum"> 84</span> <span class="tlaGNC"> 1752 : if (dataset.size(0) - 1 != features.size()) {</span></span>
<span id="L85"><span class="lineNum"> 85</span> <span class="tlaGNC"> 8 : throw std::invalid_argument(&quot;Classifier: X &quot; + std::to_string(dataset.size(0) - 1) + &quot; and features &quot; + std::to_string(features.size()) + &quot; must have the same number of features&quot;);</span></span>
<span id="L86"><span class="lineNum"> 86</span> : }</span>
<span id="L87"><span class="lineNum"> 87</span> <span class="tlaGNC"> 1744 : if (states.find(className) == states.end()) {</span></span>
<span id="L88"><span class="lineNum"> 88</span> <span class="tlaGNC"> 8 : throw std::invalid_argument(&quot;class name not found in states&quot;);</span></span>
<span id="L89"><span class="lineNum"> 89</span> : }</span>
<span id="L90"><span class="lineNum"> 90</span> <span class="tlaGNC"> 32996 : for (auto feature : features) {</span></span>
<span id="L91"><span class="lineNum"> 91</span> <span class="tlaGNC"> 31268 : if (states.find(feature) == states.end()) {</span></span>
<span id="L92"><span class="lineNum"> 92</span> <span class="tlaGNC"> 8 : throw std::invalid_argument(&quot;feature [&quot; + feature + &quot;] not found in states&quot;);</span></span>
<span id="L93"><span class="lineNum"> 93</span> : }</span>
<span id="L94"><span class="lineNum"> 94</span> <span class="tlaGNC"> 31268 : }</span></span>
<span id="L95"><span class="lineNum"> 95</span> <span class="tlaGNC"> 1728 : }</span></span>
<span id="L96"><span class="lineNum"> 96</span> <span class="tlaGNC"> 1844 : torch::Tensor Classifier::predict(torch::Tensor&amp; X)</span></span>
<span id="L97"><span class="lineNum"> 97</span> : {</span>
<span id="L98"><span class="lineNum"> 98</span> <span class="tlaGNC"> 1844 : if (!fitted) {</span></span>
<span id="L99"><span class="lineNum"> 99</span> <span class="tlaGNC"> 16 : throw std::logic_error(CLASSIFIER_NOT_FITTED);</span></span>
<span id="L100"><span class="lineNum"> 100</span> : }</span>
<span id="L101"><span class="lineNum"> 101</span> <span class="tlaGNC"> 1828 : return model.predict(X);</span></span>
<span id="L102"><span class="lineNum"> 102</span> : }</span>
<span id="L103"><span class="lineNum"> 103</span> <span class="tlaGNC"> 16 : std::vector&lt;int&gt; Classifier::predict(std::vector&lt;std::vector&lt;int&gt;&gt;&amp; X)</span></span>
<span id="L104"><span class="lineNum"> 104</span> : {</span>
<span id="L105"><span class="lineNum"> 105</span> <span class="tlaGNC"> 16 : if (!fitted) {</span></span>
<span id="L106"><span class="lineNum"> 106</span> <span class="tlaGNC"> 8 : throw std::logic_error(CLASSIFIER_NOT_FITTED);</span></span>
<span id="L107"><span class="lineNum"> 107</span> : }</span>
<span id="L108"><span class="lineNum"> 108</span> <span class="tlaGNC"> 8 : auto m_ = X[0].size();</span></span>
<span id="L109"><span class="lineNum"> 109</span> <span class="tlaGNC"> 8 : auto n_ = X.size();</span></span>
<span id="L110"><span class="lineNum"> 110</span> <span class="tlaGNC"> 8 : std::vector&lt;std::vector&lt;int&gt;&gt; Xd(n_, std::vector&lt;int&gt;(m_, 0));</span></span>
<span id="L111"><span class="lineNum"> 111</span> <span class="tlaGNC"> 40 : for (auto i = 0; i &lt; n_; i++) {</span></span>
<span id="L112"><span class="lineNum"> 112</span> <span class="tlaGNC"> 64 : Xd[i] = std::vector&lt;int&gt;(X[i].begin(), X[i].end());</span></span>
<span id="L113"><span class="lineNum"> 113</span> : }</span>
<span id="L114"><span class="lineNum"> 114</span> <span class="tlaGNC"> 8 : auto yp = model.predict(Xd);</span></span>
<span id="L115"><span class="lineNum"> 115</span> <span class="tlaGNC"> 16 : return yp;</span></span>
<span id="L116"><span class="lineNum"> 116</span> <span class="tlaGNC"> 8 : }</span></span>
<span id="L117"><span class="lineNum"> 117</span> <span class="tlaGNC"> 1484 : torch::Tensor Classifier::predict_proba(torch::Tensor&amp; X)</span></span>
<span id="L118"><span class="lineNum"> 118</span> : {</span>
<span id="L119"><span class="lineNum"> 119</span> <span class="tlaGNC"> 1484 : if (!fitted) {</span></span>
<span id="L120"><span class="lineNum"> 120</span> <span class="tlaGNC"> 8 : throw std::logic_error(CLASSIFIER_NOT_FITTED);</span></span>
<span id="L121"><span class="lineNum"> 121</span> : }</span>
<span id="L122"><span class="lineNum"> 122</span> <span class="tlaGNC"> 1476 : return model.predict_proba(X);</span></span>
<span id="L123"><span class="lineNum"> 123</span> : }</span>
<span id="L124"><span class="lineNum"> 124</span> <span class="tlaGNC"> 548 : std::vector&lt;std::vector&lt;double&gt;&gt; Classifier::predict_proba(std::vector&lt;std::vector&lt;int&gt;&gt;&amp; X)</span></span>
<span id="L125"><span class="lineNum"> 125</span> : {</span>
<span id="L126"><span class="lineNum"> 126</span> <span class="tlaGNC"> 548 : if (!fitted) {</span></span>
<span id="L127"><span class="lineNum"> 127</span> <span class="tlaGNC"> 8 : throw std::logic_error(CLASSIFIER_NOT_FITTED);</span></span>
<span id="L128"><span class="lineNum"> 128</span> : }</span>
<span id="L129"><span class="lineNum"> 129</span> <span class="tlaGNC"> 540 : auto m_ = X[0].size();</span></span>
<span id="L130"><span class="lineNum"> 130</span> <span class="tlaGNC"> 540 : auto n_ = X.size();</span></span>
<span id="L131"><span class="lineNum"> 131</span> <span class="tlaGNC"> 540 : std::vector&lt;std::vector&lt;int&gt;&gt; Xd(n_, std::vector&lt;int&gt;(m_, 0));</span></span>
<span id="L132"><span class="lineNum"> 132</span> : // Convert to nxm vector</span>
<span id="L133"><span class="lineNum"> 133</span> <span class="tlaGNC"> 5040 : for (auto i = 0; i &lt; n_; i++) {</span></span>
<span id="L134"><span class="lineNum"> 134</span> <span class="tlaGNC"> 9000 : Xd[i] = std::vector&lt;int&gt;(X[i].begin(), X[i].end());</span></span>
<span id="L135"><span class="lineNum"> 135</span> : }</span>
<span id="L136"><span class="lineNum"> 136</span> <span class="tlaGNC"> 540 : auto yp = model.predict_proba(Xd);</span></span>
<span id="L137"><span class="lineNum"> 137</span> <span class="tlaGNC"> 1080 : return yp;</span></span>
<span id="L138"><span class="lineNum"> 138</span> <span class="tlaGNC"> 540 : }</span></span>
<span id="L139"><span class="lineNum"> 139</span> <span class="tlaGNC"> 112 : float Classifier::score(torch::Tensor&amp; X, torch::Tensor&amp; y)</span></span>
<span id="L140"><span class="lineNum"> 140</span> : {</span>
<span id="L141"><span class="lineNum"> 141</span> <span class="tlaGNC"> 112 : torch::Tensor y_pred = predict(X);</span></span>
<span id="L142"><span class="lineNum"> 142</span> <span class="tlaGNC"> 208 : return (y_pred == y).sum().item&lt;float&gt;() / y.size(0);</span></span>
<span id="L143"><span class="lineNum"> 143</span> <span class="tlaGNC"> 104 : }</span></span>
<span id="L144"><span class="lineNum"> 144</span> <span class="tlaGNC"> 16 : float Classifier::score(std::vector&lt;std::vector&lt;int&gt;&gt;&amp; X, std::vector&lt;int&gt;&amp; y)</span></span>
<span id="L145"><span class="lineNum"> 145</span> : {</span>
<span id="L146"><span class="lineNum"> 146</span> <span class="tlaGNC"> 16 : if (!fitted) {</span></span>
<span id="L147"><span class="lineNum"> 147</span> <span class="tlaGNC"> 8 : throw std::logic_error(CLASSIFIER_NOT_FITTED);</span></span>
<span id="L148"><span class="lineNum"> 148</span> : }</span>
<span id="L149"><span class="lineNum"> 149</span> <span class="tlaGNC"> 8 : return model.score(X, y);</span></span>
<span id="L150"><span class="lineNum"> 150</span> : }</span>
<span id="L151"><span class="lineNum"> 151</span> <span class="tlaGNC"> 24 : std::vector&lt;std::string&gt; Classifier::show() const</span></span>
<span id="L152"><span class="lineNum"> 152</span> : {</span>
<span id="L153"><span class="lineNum"> 153</span> <span class="tlaGNC"> 24 : return model.show();</span></span>
<span id="L154"><span class="lineNum"> 154</span> : }</span>
<span id="L155"><span class="lineNum"> 155</span> <span class="tlaGNC"> 1576 : void Classifier::addNodes()</span></span>
<span id="L156"><span class="lineNum"> 156</span> : {</span>
<span id="L157"><span class="lineNum"> 157</span> : // Add all nodes to the network</span>
<span id="L158"><span class="lineNum"> 158</span> <span class="tlaGNC"> 30872 : for (const auto&amp; feature : features) {</span></span>
<span id="L159"><span class="lineNum"> 159</span> <span class="tlaGNC"> 29296 : model.addNode(feature);</span></span>
<span id="L160"><span class="lineNum"> 160</span> : }</span>
<span id="L161"><span class="lineNum"> 161</span> <span class="tlaGNC"> 1576 : model.addNode(className);</span></span>
<span id="L162"><span class="lineNum"> 162</span> <span class="tlaGNC"> 1576 : }</span></span>
<span id="L163"><span class="lineNum"> 163</span> <span class="tlaGNC"> 332 : int Classifier::getNumberOfNodes() const</span></span>
<span id="L164"><span class="lineNum"> 164</span> : {</span>
<span id="L165"><span class="lineNum"> 165</span> : // Features does not include class</span>
<span id="L166"><span class="lineNum"> 166</span> <span class="tlaGNC"> 332 : return fitted ? model.getFeatures().size() : 0;</span></span>
<span id="L167"><span class="lineNum"> 167</span> : }</span>
<span id="L168"><span class="lineNum"> 168</span> <span class="tlaGNC"> 332 : int Classifier::getNumberOfEdges() const</span></span>
<span id="L169"><span class="lineNum"> 169</span> : {</span>
<span id="L170"><span class="lineNum"> 170</span> <span class="tlaGNC"> 332 : return fitted ? model.getNumEdges() : 0;</span></span>
<span id="L171"><span class="lineNum"> 171</span> : }</span>
<span id="L172"><span class="lineNum"> 172</span> <span class="tlaGNC"> 24 : int Classifier::getNumberOfStates() const</span></span>
<span id="L173"><span class="lineNum"> 173</span> : {</span>
<span id="L174"><span class="lineNum"> 174</span> <span class="tlaGNC"> 24 : return fitted ? model.getStates() : 0;</span></span>
<span id="L175"><span class="lineNum"> 175</span> : }</span>
<span id="L176"><span class="lineNum"> 176</span> <span class="tlaGNC"> 348 : int Classifier::getClassNumStates() const</span></span>
<span id="L177"><span class="lineNum"> 177</span> : {</span>
<span id="L178"><span class="lineNum"> 178</span> <span class="tlaGNC"> 348 : return fitted ? model.getClassNumStates() : 0;</span></span>
<span id="L179"><span class="lineNum"> 179</span> : }</span>
<span id="L180"><span class="lineNum"> 180</span> <span class="tlaGNC"> 4 : std::vector&lt;std::string&gt; Classifier::topological_order()</span></span>
<span id="L181"><span class="lineNum"> 181</span> : {</span>
<span id="L182"><span class="lineNum"> 182</span> <span class="tlaGNC"> 4 : return model.topological_sort();</span></span>
<span id="L183"><span class="lineNum"> 183</span> : }</span>
<span id="L184"><span class="lineNum"> 184</span> <span class="tlaGNC"> 4 : std::string Classifier::dump_cpt() const</span></span>
<span id="L185"><span class="lineNum"> 185</span> : {</span>
<span id="L186"><span class="lineNum"> 186</span> <span class="tlaGNC"> 4 : return model.dump_cpt();</span></span>
<span id="L187"><span class="lineNum"> 187</span> : }</span>
<span id="L188"><span class="lineNum"> 188</span> <span class="tlaGNC"> 92 : void Classifier::setHyperparameters(const nlohmann::json&amp; hyperparameters)</span></span>
<span id="L189"><span class="lineNum"> 189</span> : {</span>
<span id="L190"><span class="lineNum"> 190</span> <span class="tlaGNC"> 92 : if (!hyperparameters.empty()) {</span></span>
<span id="L191"><span class="lineNum"> 191</span> <span class="tlaGNC"> 8 : throw std::invalid_argument(&quot;Invalid hyperparameters&quot; + hyperparameters.dump());</span></span>
<span id="L192"><span class="lineNum"> 192</span> : }</span>
<span id="L193"><span class="lineNum"> 193</span> <span class="tlaGNC"> 84 : }</span></span>
<span id="L194"><span class="lineNum"> 194</span> : }</span>
</pre>
</td>
</tr>
</table>
<br>
<table width="100%" border=0 cellspacing=0 cellpadding=0>
<tr><td class="ruler"><img src="../../glass.png" width=3 height=3 alt=""></td></tr>
<tr><td class="versionInfo">Generated by: <a href="https://github.com//linux-test-project/lcov" target="_parent">LCOV version 2.0-1</a></td></tr>
</table>
<br>
</body>
</html>

View File

@ -1,69 +0,0 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html lang="en">
<head>
<title>LCOV - BayesNet Coverage Report - bayesnet/classifiers/Classifier.cc</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" type="text/css" href="../../gcov.css">
</head>
<body>
<map name="overview">
<area shape="rect" coords="0,0,79,3" href="Classifier.cc.gcov.html#L1" target="source" alt="overview">
<area shape="rect" coords="0,4,79,7" href="Classifier.cc.gcov.html#L1" target="source" alt="overview">
<area shape="rect" coords="0,8,79,11" href="Classifier.cc.gcov.html#L1" target="source" alt="overview">
<area shape="rect" coords="0,12,79,15" href="Classifier.cc.gcov.html#L1" target="source" alt="overview">
<area shape="rect" coords="0,16,79,19" href="Classifier.cc.gcov.html#L5" target="source" alt="overview">
<area shape="rect" coords="0,20,79,23" href="Classifier.cc.gcov.html#L9" target="source" alt="overview">
<area shape="rect" coords="0,24,79,27" href="Classifier.cc.gcov.html#L13" target="source" alt="overview">
<area shape="rect" coords="0,28,79,31" href="Classifier.cc.gcov.html#L17" target="source" alt="overview">
<area shape="rect" coords="0,32,79,35" href="Classifier.cc.gcov.html#L21" target="source" alt="overview">
<area shape="rect" coords="0,36,79,39" href="Classifier.cc.gcov.html#L25" target="source" alt="overview">
<area shape="rect" coords="0,40,79,43" href="Classifier.cc.gcov.html#L29" target="source" alt="overview">
<area shape="rect" coords="0,44,79,47" href="Classifier.cc.gcov.html#L33" target="source" alt="overview">
<area shape="rect" coords="0,48,79,51" href="Classifier.cc.gcov.html#L37" target="source" alt="overview">
<area shape="rect" coords="0,52,79,55" href="Classifier.cc.gcov.html#L41" target="source" alt="overview">
<area shape="rect" coords="0,56,79,59" href="Classifier.cc.gcov.html#L45" target="source" alt="overview">
<area shape="rect" coords="0,60,79,63" href="Classifier.cc.gcov.html#L49" target="source" alt="overview">
<area shape="rect" coords="0,64,79,67" href="Classifier.cc.gcov.html#L53" target="source" alt="overview">
<area shape="rect" coords="0,68,79,71" href="Classifier.cc.gcov.html#L57" target="source" alt="overview">
<area shape="rect" coords="0,72,79,75" href="Classifier.cc.gcov.html#L61" target="source" alt="overview">
<area shape="rect" coords="0,76,79,79" href="Classifier.cc.gcov.html#L65" target="source" alt="overview">
<area shape="rect" coords="0,80,79,83" href="Classifier.cc.gcov.html#L69" target="source" alt="overview">
<area shape="rect" coords="0,84,79,87" href="Classifier.cc.gcov.html#L73" target="source" alt="overview">
<area shape="rect" coords="0,88,79,91" href="Classifier.cc.gcov.html#L77" target="source" alt="overview">
<area shape="rect" coords="0,92,79,95" href="Classifier.cc.gcov.html#L81" target="source" alt="overview">
<area shape="rect" coords="0,96,79,99" href="Classifier.cc.gcov.html#L85" target="source" alt="overview">
<area shape="rect" coords="0,100,79,103" href="Classifier.cc.gcov.html#L89" target="source" alt="overview">
<area shape="rect" coords="0,104,79,107" href="Classifier.cc.gcov.html#L93" target="source" alt="overview">
<area shape="rect" coords="0,108,79,111" href="Classifier.cc.gcov.html#L97" target="source" alt="overview">
<area shape="rect" coords="0,112,79,115" href="Classifier.cc.gcov.html#L101" target="source" alt="overview">
<area shape="rect" coords="0,116,79,119" href="Classifier.cc.gcov.html#L105" target="source" alt="overview">
<area shape="rect" coords="0,120,79,123" href="Classifier.cc.gcov.html#L109" target="source" alt="overview">
<area shape="rect" coords="0,124,79,127" href="Classifier.cc.gcov.html#L113" target="source" alt="overview">
<area shape="rect" coords="0,128,79,131" href="Classifier.cc.gcov.html#L117" target="source" alt="overview">
<area shape="rect" coords="0,132,79,135" href="Classifier.cc.gcov.html#L121" target="source" alt="overview">
<area shape="rect" coords="0,136,79,139" href="Classifier.cc.gcov.html#L125" target="source" alt="overview">
<area shape="rect" coords="0,140,79,143" href="Classifier.cc.gcov.html#L129" target="source" alt="overview">
<area shape="rect" coords="0,144,79,147" href="Classifier.cc.gcov.html#L133" target="source" alt="overview">
<area shape="rect" coords="0,148,79,151" href="Classifier.cc.gcov.html#L137" target="source" alt="overview">
<area shape="rect" coords="0,152,79,155" href="Classifier.cc.gcov.html#L141" target="source" alt="overview">
<area shape="rect" coords="0,156,79,159" href="Classifier.cc.gcov.html#L145" target="source" alt="overview">
<area shape="rect" coords="0,160,79,163" href="Classifier.cc.gcov.html#L149" target="source" alt="overview">
<area shape="rect" coords="0,164,79,167" href="Classifier.cc.gcov.html#L153" target="source" alt="overview">
<area shape="rect" coords="0,168,79,171" href="Classifier.cc.gcov.html#L157" target="source" alt="overview">
<area shape="rect" coords="0,172,79,175" href="Classifier.cc.gcov.html#L161" target="source" alt="overview">
<area shape="rect" coords="0,176,79,179" href="Classifier.cc.gcov.html#L165" target="source" alt="overview">
<area shape="rect" coords="0,180,79,183" href="Classifier.cc.gcov.html#L169" target="source" alt="overview">
<area shape="rect" coords="0,184,79,187" href="Classifier.cc.gcov.html#L173" target="source" alt="overview">
<area shape="rect" coords="0,188,79,191" href="Classifier.cc.gcov.html#L177" target="source" alt="overview">
<area shape="rect" coords="0,192,79,195" href="Classifier.cc.gcov.html#L181" target="source" alt="overview">
</map>
<center>
<a href="Classifier.cc.gcov.html#top" target="source">Top</a><br><br>
<img src="Classifier.cc.gcov.png" width=80 height=193 alt="Overview" border=0 usemap="#overview">
</center>
</body>
</html>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 852 B

View File

@ -1,111 +0,0 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>LCOV - BayesNet Coverage Report - bayesnet/classifiers/Classifier.h - functions</title>
<link rel="stylesheet" type="text/css" href="../../gcov.css">
</head>
<body>
<table width="100%" border=0 cellspacing=0 cellpadding=0>
<tr><td class="title">LCOV - code coverage report</td></tr>
<tr><td class="ruler"><img src="../../glass.png" width=3 height=3 alt=""></td></tr>
<tr>
<td width="100%">
<table cellpadding=1 border=0 width="100%">
<tr>
<td width="10%" class="headerItem">Current view:</td>
<td width="10%" class="headerValue"><a href="../../index.html" target="_parent">top level</a> - <a href="index.html" target="_parent">bayesnet/classifiers</a> - Classifier.h<span style="font-size: 80%;"> (<a href="Classifier.h.gcov.html">source</a> / functions)</span></td>
<td width="5%"></td>
<td width="5%"></td>
<td width="5%" class="headerCovTableHead">Coverage</td>
<td width="5%" class="headerCovTableHead" title="Covered + Uncovered code">Total</td>
<td width="5%" class="headerCovTableHead" title="Exercised code only">Hit</td>
</tr>
<tr>
<td class="headerItem">Test:</td>
<td class="headerValue">BayesNet Coverage Report</td>
<td></td>
<td class="headerItem">Lines:</td>
<td class="headerCovTableEntryHi">100.0&nbsp;%</td>
<td class="headerCovTableEntry">4</td>
<td class="headerCovTableEntry">4</td>
</tr>
<tr>
<td class="headerItem">Test Date:</td>
<td class="headerValue">2024-05-06 17:54:04</td>
<td></td>
<td class="headerItem">Functions:</td>
<td class="headerCovTableEntryHi">100.0&nbsp;%</td>
<td class="headerCovTableEntry">4</td>
<td class="headerCovTableEntry">4</td>
</tr>
<tr>
<td class="headerItem">Legend:</td>
<td class="headerValueLeg"> Lines:
<span class="coverLegendCov">hit</span>
<span class="coverLegendNoCov">not hit</span>
</td>
<td></td>
</tr>
<tr><td><img src="../../glass.png" width=3 height=3 alt=""></td></tr>
</table>
</td>
</tr>
<tr><td class="ruler"><img src="../../glass.png" width=3 height=3 alt=""></td></tr>
</table>
<center>
<table cellpadding=1 cellspacing=1 border=0>
<tr><td><br></td></tr>
<tr>
<td class="tableHead">Function Name <span title="Click to sort table by function name" class="tableHeadSort"><a href="Classifier.h.func.html"><img src="../../updown.png" width=10 height=14 alt="Sort by function name" title="Click to sort table by function name" border=0></a></span></td>
<td class="tableHead">Hit count <span title="Click to sort table by function hit count" class="tableHeadSort"><img src="../../glass.png" width=10 height=14 alt="Sort by function hit count" title="Click to sort table by function hit count" border=0></span></td>
</tr>
<tr>
<td class="coverFn"><a href="Classifier.h.gcov.html#L31">bayesnet::Classifier::getVersion[abi:cxx11]()</a></td>
<td class="coverFnHi">32</td>
</tr>
<tr>
<td class="coverFn"><a href="Classifier.h.gcov.html#L36">bayesnet::Classifier::getNotes[abi:cxx11]() const</a></td>
<td class="coverFnHi">80</td>
</tr>
<tr>
<td class="coverFn"><a href="Classifier.h.gcov.html#L30">bayesnet::Classifier::getStatus() const</a></td>
<td class="coverFnHi">128</td>
</tr>
<tr>
<td class="coverFn"><a href="Classifier.h.gcov.html#L16">bayesnet::Classifier::~Classifier()</a></td>
<td class="coverFnHi">1680</td>
</tr>
</table>
<br>
</center>
<table width="100%" border=0 cellspacing=0 cellpadding=0>
<tr><td class="ruler"><img src="../../glass.png" width=3 height=3 alt=""></td></tr>
<tr><td class="versionInfo">Generated by: <a href="https://github.com//linux-test-project/lcov" target="_parent">LCOV version 2.0-1</a></td></tr>
</table>
<br>
</body>
</html>

View File

@ -1,111 +0,0 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>LCOV - BayesNet Coverage Report - bayesnet/classifiers/Classifier.h - functions</title>
<link rel="stylesheet" type="text/css" href="../../gcov.css">
</head>
<body>
<table width="100%" border=0 cellspacing=0 cellpadding=0>
<tr><td class="title">LCOV - code coverage report</td></tr>
<tr><td class="ruler"><img src="../../glass.png" width=3 height=3 alt=""></td></tr>
<tr>
<td width="100%">
<table cellpadding=1 border=0 width="100%">
<tr>
<td width="10%" class="headerItem">Current view:</td>
<td width="10%" class="headerValue"><a href="../../index.html" target="_parent">top level</a> - <a href="index.html" target="_parent">bayesnet/classifiers</a> - Classifier.h<span style="font-size: 80%;"> (<a href="Classifier.h.gcov.html">source</a> / functions)</span></td>
<td width="5%"></td>
<td width="5%"></td>
<td width="5%" class="headerCovTableHead">Coverage</td>
<td width="5%" class="headerCovTableHead" title="Covered + Uncovered code">Total</td>
<td width="5%" class="headerCovTableHead" title="Exercised code only">Hit</td>
</tr>
<tr>
<td class="headerItem">Test:</td>
<td class="headerValue">BayesNet Coverage Report</td>
<td></td>
<td class="headerItem">Lines:</td>
<td class="headerCovTableEntryHi">100.0&nbsp;%</td>
<td class="headerCovTableEntry">4</td>
<td class="headerCovTableEntry">4</td>
</tr>
<tr>
<td class="headerItem">Test Date:</td>
<td class="headerValue">2024-05-06 17:54:04</td>
<td></td>
<td class="headerItem">Functions:</td>
<td class="headerCovTableEntryHi">100.0&nbsp;%</td>
<td class="headerCovTableEntry">4</td>
<td class="headerCovTableEntry">4</td>
</tr>
<tr>
<td class="headerItem">Legend:</td>
<td class="headerValueLeg"> Lines:
<span class="coverLegendCov">hit</span>
<span class="coverLegendNoCov">not hit</span>
</td>
<td></td>
</tr>
<tr><td><img src="../../glass.png" width=3 height=3 alt=""></td></tr>
</table>
</td>
</tr>
<tr><td class="ruler"><img src="../../glass.png" width=3 height=3 alt=""></td></tr>
</table>
<center>
<table cellpadding=1 cellspacing=1 border=0>
<tr><td><br></td></tr>
<tr>
<td class="tableHead">Function Name <span title="Click to sort table by function name" class="tableHeadSort"><img src="../../glass.png" width=10 height=14 alt="Sort by function name" title="Click to sort table by function name" border=0></span></td>
<td class="tableHead">Hit count <span title="Click to sort table by function hit count" class="tableHeadSort"><a href="Classifier.h.func-c.html"><img src="../../updown.png" width=10 height=14 alt="Sort by function hit count" title="Click to sort table by function hit count" border=0></a></span></td>
</tr>
<tr>
<td class="coverFn"><a href="Classifier.h.gcov.html#L36">bayesnet::Classifier::getNotes[abi:cxx11]() const</a></td>
<td class="coverFnHi">80</td>
</tr>
<tr>
<td class="coverFn"><a href="Classifier.h.gcov.html#L30">bayesnet::Classifier::getStatus() const</a></td>
<td class="coverFnHi">128</td>
</tr>
<tr>
<td class="coverFn"><a href="Classifier.h.gcov.html#L31">bayesnet::Classifier::getVersion[abi:cxx11]()</a></td>
<td class="coverFnHi">32</td>
</tr>
<tr>
<td class="coverFn"><a href="Classifier.h.gcov.html#L16">bayesnet::Classifier::~Classifier()</a></td>
<td class="coverFnHi">1680</td>
</tr>
</table>
<br>
</center>
<table width="100%" border=0 cellspacing=0 cellpadding=0>
<tr><td class="ruler"><img src="../../glass.png" width=3 height=3 alt=""></td></tr>
<tr><td class="versionInfo">Generated by: <a href="https://github.com//linux-test-project/lcov" target="_parent">LCOV version 2.0-1</a></td></tr>
</table>
<br>
</body>
</html>

View File

@ -1,19 +0,0 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN">
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>LCOV - BayesNet Coverage Report - bayesnet/classifiers/Classifier.h</title>
<link rel="stylesheet" type="text/css" href="../../gcov.css">
</head>
<frameset cols="120,*">
<frame src="Classifier.h.gcov.overview.html" name="overview">
<frame src="Classifier.h.gcov.html" name="source">
<noframes>
<center>Frames not supported by your browser!<br></center>
</noframes>
</frameset>
</html>

View File

@ -1,149 +0,0 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>LCOV - BayesNet Coverage Report - bayesnet/classifiers/Classifier.h</title>
<link rel="stylesheet" type="text/css" href="../../gcov.css">
</head>
<body>
<table width="100%" border=0 cellspacing=0 cellpadding=0>
<tr><td class="title">LCOV - code coverage report</td></tr>
<tr><td class="ruler"><img src="../../glass.png" width=3 height=3 alt=""></td></tr>
<tr>
<td width="100%">
<table cellpadding=1 border=0 width="100%">
<tr>
<td width="10%" class="headerItem">Current view:</td>
<td width="10%" class="headerValue"><a href="../../index.html" target="_parent">top level</a> - <a href="index.html" target="_parent">bayesnet/classifiers</a> - Classifier.h<span style="font-size: 80%;"> (source / <a href="Classifier.h.func-c.html">functions</a>)</span></td>
<td width="5%"></td>
<td width="5%"></td>
<td width="5%" class="headerCovTableHead">Coverage</td>
<td width="5%" class="headerCovTableHead" title="Covered + Uncovered code">Total</td>
<td width="5%" class="headerCovTableHead" title="Exercised code only">Hit</td>
</tr>
<tr>
<td class="headerItem">Test:</td>
<td class="headerValue">BayesNet Coverage Report</td>
<td></td>
<td class="headerItem">Lines:</td>
<td class="headerCovTableEntryHi">100.0&nbsp;%</td>
<td class="headerCovTableEntry">4</td>
<td class="headerCovTableEntry">4</td>
</tr>
<tr>
<td class="headerItem">Test Date:</td>
<td class="headerValue">2024-05-06 17:54:04</td>
<td></td>
<td class="headerItem">Functions:</td>
<td class="headerCovTableEntryHi">100.0&nbsp;%</td>
<td class="headerCovTableEntry">4</td>
<td class="headerCovTableEntry">4</td>
</tr>
<tr>
<td class="headerItem">Legend:</td>
<td class="headerValueLeg"> Lines:
<span class="coverLegendCov">hit</span>
<span class="coverLegendNoCov">not hit</span>
</td>
<td></td>
</tr>
<tr><td><img src="../../glass.png" width=3 height=3 alt=""></td></tr>
</table>
</td>
</tr>
<tr><td class="ruler"><img src="../../glass.png" width=3 height=3 alt=""></td></tr>
</table>
<table cellpadding=0 cellspacing=0 border=0>
<tr>
<td><br></td>
</tr>
<tr>
<td>
<pre class="sourceHeading"> Line data Source code</pre>
<pre class="source">
<span id="L1"><span class="lineNum"> 1</span> : // ***************************************************************</span>
<span id="L2"><span class="lineNum"> 2</span> : // SPDX-FileCopyrightText: Copyright 2024 Ricardo Montañana Gómez</span>
<span id="L3"><span class="lineNum"> 3</span> : // SPDX-FileType: SOURCE</span>
<span id="L4"><span class="lineNum"> 4</span> : // SPDX-License-Identifier: MIT</span>
<span id="L5"><span class="lineNum"> 5</span> : // ***************************************************************</span>
<span id="L6"><span class="lineNum"> 6</span> : </span>
<span id="L7"><span class="lineNum"> 7</span> : #ifndef CLASSIFIER_H</span>
<span id="L8"><span class="lineNum"> 8</span> : #define CLASSIFIER_H</span>
<span id="L9"><span class="lineNum"> 9</span> : #include &lt;torch/torch.h&gt;</span>
<span id="L10"><span class="lineNum"> 10</span> : #include &quot;bayesnet/utils/BayesMetrics.h&quot;</span>
<span id="L11"><span class="lineNum"> 11</span> : #include &quot;bayesnet/network/Network.h&quot;</span>
<span id="L12"><span class="lineNum"> 12</span> : #include &quot;bayesnet/BaseClassifier.h&quot;</span>
<span id="L13"><span class="lineNum"> 13</span> : </span>
<span id="L14"><span class="lineNum"> 14</span> : namespace bayesnet {</span>
<span id="L15"><span class="lineNum"> 15</span> : class Classifier : public BaseClassifier {</span>
<span id="L16"><span class="lineNum"> 16</span> : public:</span>
<span id="L17"><span class="lineNum"> 17</span> : Classifier(Network model);</span>
<span id="L18"><span class="lineNum"> 18</span> <span class="tlaGNC tlaBgGNC"> 1680 : virtual ~Classifier() = default;</span></span>
<span id="L19"><span class="lineNum"> 19</span> : Classifier&amp; fit(std::vector&lt;std::vector&lt;int&gt;&gt;&amp; X, std::vector&lt;int&gt;&amp; y, const std::vector&lt;std::string&gt;&amp; features, const std::string&amp; className, std::map&lt;std::string, std::vector&lt;int&gt;&gt;&amp; states) override;</span>
<span id="L20"><span class="lineNum"> 20</span> : Classifier&amp; fit(torch::Tensor&amp; X, torch::Tensor&amp; y, const std::vector&lt;std::string&gt;&amp; features, const std::string&amp; className, std::map&lt;std::string, std::vector&lt;int&gt;&gt;&amp; states) override;</span>
<span id="L21"><span class="lineNum"> 21</span> : Classifier&amp; fit(torch::Tensor&amp; dataset, const std::vector&lt;std::string&gt;&amp; features, const std::string&amp; className, std::map&lt;std::string, std::vector&lt;int&gt;&gt;&amp; states) override;</span>
<span id="L22"><span class="lineNum"> 22</span> : Classifier&amp; fit(torch::Tensor&amp; dataset, const std::vector&lt;std::string&gt;&amp; features, const std::string&amp; className, std::map&lt;std::string, std::vector&lt;int&gt;&gt;&amp; states, const torch::Tensor&amp; weights) override;</span>
<span id="L23"><span class="lineNum"> 23</span> : void addNodes();</span>
<span id="L24"><span class="lineNum"> 24</span> : int getNumberOfNodes() const override;</span>
<span id="L25"><span class="lineNum"> 25</span> : int getNumberOfEdges() const override;</span>
<span id="L26"><span class="lineNum"> 26</span> : int getNumberOfStates() const override;</span>
<span id="L27"><span class="lineNum"> 27</span> : int getClassNumStates() const override;</span>
<span id="L28"><span class="lineNum"> 28</span> : torch::Tensor predict(torch::Tensor&amp; X) override;</span>
<span id="L29"><span class="lineNum"> 29</span> : std::vector&lt;int&gt; predict(std::vector&lt;std::vector&lt;int&gt;&gt;&amp; X) override;</span>
<span id="L30"><span class="lineNum"> 30</span> : torch::Tensor predict_proba(torch::Tensor&amp; X) override;</span>
<span id="L31"><span class="lineNum"> 31</span> : std::vector&lt;std::vector&lt;double&gt;&gt; predict_proba(std::vector&lt;std::vector&lt;int&gt;&gt;&amp; X) override;</span>
<span id="L32"><span class="lineNum"> 32</span> <span class="tlaGNC"> 128 : status_t getStatus() const override { return status; }</span></span>
<span id="L33"><span class="lineNum"> 33</span> <span class="tlaGNC"> 96 : std::string getVersion() override { return { project_version.begin(), project_version.end() }; };</span></span>
<span id="L34"><span class="lineNum"> 34</span> : float score(torch::Tensor&amp; X, torch::Tensor&amp; y) override;</span>
<span id="L35"><span class="lineNum"> 35</span> : float score(std::vector&lt;std::vector&lt;int&gt;&gt;&amp; X, std::vector&lt;int&gt;&amp; y) override;</span>
<span id="L36"><span class="lineNum"> 36</span> : std::vector&lt;std::string&gt; show() const override;</span>
<span id="L37"><span class="lineNum"> 37</span> : std::vector&lt;std::string&gt; topological_order() override;</span>
<span id="L38"><span class="lineNum"> 38</span> <span class="tlaGNC"> 80 : std::vector&lt;std::string&gt; getNotes() const override { return notes; }</span></span>
<span id="L39"><span class="lineNum"> 39</span> : std::string dump_cpt() const override;</span>
<span id="L40"><span class="lineNum"> 40</span> : void setHyperparameters(const nlohmann::json&amp; hyperparameters) override; //For classifiers that don't have hyperparameters</span>
<span id="L41"><span class="lineNum"> 41</span> : protected:</span>
<span id="L42"><span class="lineNum"> 42</span> : bool fitted;</span>
<span id="L43"><span class="lineNum"> 43</span> : unsigned int m, n; // m: number of samples, n: number of features</span>
<span id="L44"><span class="lineNum"> 44</span> : Network model;</span>
<span id="L45"><span class="lineNum"> 45</span> : Metrics metrics;</span>
<span id="L46"><span class="lineNum"> 46</span> : std::vector&lt;std::string&gt; features;</span>
<span id="L47"><span class="lineNum"> 47</span> : std::string className;</span>
<span id="L48"><span class="lineNum"> 48</span> : std::map&lt;std::string, std::vector&lt;int&gt;&gt; states;</span>
<span id="L49"><span class="lineNum"> 49</span> : torch::Tensor dataset; // (n+1)xm tensor</span>
<span id="L50"><span class="lineNum"> 50</span> : status_t status = NORMAL;</span>
<span id="L51"><span class="lineNum"> 51</span> : std::vector&lt;std::string&gt; notes; // Used to store messages occurred during the fit process</span>
<span id="L52"><span class="lineNum"> 52</span> : void checkFitParameters();</span>
<span id="L53"><span class="lineNum"> 53</span> : virtual void buildModel(const torch::Tensor&amp; weights) = 0;</span>
<span id="L54"><span class="lineNum"> 54</span> : void trainModel(const torch::Tensor&amp; weights) override;</span>
<span id="L55"><span class="lineNum"> 55</span> : void buildDataset(torch::Tensor&amp; y);</span>
<span id="L56"><span class="lineNum"> 56</span> : private:</span>
<span id="L57"><span class="lineNum"> 57</span> : Classifier&amp; build(const std::vector&lt;std::string&gt;&amp; features, const std::string&amp; className, std::map&lt;std::string, std::vector&lt;int&gt;&gt;&amp; states, const torch::Tensor&amp; weights);</span>
<span id="L58"><span class="lineNum"> 58</span> : };</span>
<span id="L59"><span class="lineNum"> 59</span> : }</span>
<span id="L60"><span class="lineNum"> 60</span> : #endif</span>
<span id="L61"><span class="lineNum"> 61</span> : </span>
<span id="L62"><span class="lineNum"> 62</span> : </span>
<span id="L63"><span class="lineNum"> 63</span> : </span>
<span id="L64"><span class="lineNum"> 64</span> : </span>
<span id="L65"><span class="lineNum"> 65</span> : </span>
</pre>
</td>
</tr>
</table>
<br>
<table width="100%" border=0 cellspacing=0 cellpadding=0>
<tr><td class="ruler"><img src="../../glass.png" width=3 height=3 alt=""></td></tr>
<tr><td class="versionInfo">Generated by: <a href="https://github.com//linux-test-project/lcov" target="_parent">LCOV version 2.0-1</a></td></tr>
</table>
<br>
</body>
</html>

View File

@ -1,37 +0,0 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html lang="en">
<head>
<title>LCOV - BayesNet Coverage Report - bayesnet/classifiers/Classifier.h</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" type="text/css" href="../../gcov.css">
</head>
<body>
<map name="overview">
<area shape="rect" coords="0,0,79,3" href="Classifier.h.gcov.html#L1" target="source" alt="overview">
<area shape="rect" coords="0,4,79,7" href="Classifier.h.gcov.html#L1" target="source" alt="overview">
<area shape="rect" coords="0,8,79,11" href="Classifier.h.gcov.html#L1" target="source" alt="overview">
<area shape="rect" coords="0,12,79,15" href="Classifier.h.gcov.html#L1" target="source" alt="overview">
<area shape="rect" coords="0,16,79,19" href="Classifier.h.gcov.html#L5" target="source" alt="overview">
<area shape="rect" coords="0,20,79,23" href="Classifier.h.gcov.html#L9" target="source" alt="overview">
<area shape="rect" coords="0,24,79,27" href="Classifier.h.gcov.html#L13" target="source" alt="overview">
<area shape="rect" coords="0,28,79,31" href="Classifier.h.gcov.html#L17" target="source" alt="overview">
<area shape="rect" coords="0,32,79,35" href="Classifier.h.gcov.html#L21" target="source" alt="overview">
<area shape="rect" coords="0,36,79,39" href="Classifier.h.gcov.html#L25" target="source" alt="overview">
<area shape="rect" coords="0,40,79,43" href="Classifier.h.gcov.html#L29" target="source" alt="overview">
<area shape="rect" coords="0,44,79,47" href="Classifier.h.gcov.html#L33" target="source" alt="overview">
<area shape="rect" coords="0,48,79,51" href="Classifier.h.gcov.html#L37" target="source" alt="overview">
<area shape="rect" coords="0,52,79,55" href="Classifier.h.gcov.html#L41" target="source" alt="overview">
<area shape="rect" coords="0,56,79,59" href="Classifier.h.gcov.html#L45" target="source" alt="overview">
<area shape="rect" coords="0,60,79,63" href="Classifier.h.gcov.html#L49" target="source" alt="overview">
<area shape="rect" coords="0,64,79,67" href="Classifier.h.gcov.html#L53" target="source" alt="overview">
</map>
<center>
<a href="Classifier.h.gcov.html#top" target="source">Top</a><br><br>
<img src="Classifier.h.gcov.png" width=80 height=64 alt="Overview" border=0 usemap="#overview">
</center>
</body>
</html>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 453 B

View File

@ -1,118 +0,0 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>LCOV - BayesNet Coverage Report - bayesnet/classifiers/KDB.cc - functions</title>
<link rel="stylesheet" type="text/css" href="../../gcov.css">
</head>
<body>
<table width="100%" border=0 cellspacing=0 cellpadding=0>
<tr><td class="title">LCOV - code coverage report</td></tr>
<tr><td class="ruler"><img src="../../glass.png" width=3 height=3 alt=""></td></tr>
<tr>
<td width="100%">
<table cellpadding=1 border=0 width="100%">
<tr>
<td width="10%" class="headerItem">Current view:</td>
<td width="10%" class="headerValue"><a href="../../index.html" target="_parent">top level</a> - <a href="index.html" target="_parent">bayesnet/classifiers</a> - KDB.cc<span style="font-size: 80%;"> (<a href="KDB.cc.gcov.html">source</a> / functions)</span></td>
<td width="5%"></td>
<td width="5%"></td>
<td width="5%" class="headerCovTableHead">Coverage</td>
<td width="5%" class="headerCovTableHead" title="Covered + Uncovered code">Total</td>
<td width="5%" class="headerCovTableHead" title="Exercised code only">Hit</td>
</tr>
<tr>
<td class="headerItem">Test:</td>
<td class="headerValue">BayesNet Coverage Report</td>
<td></td>
<td class="headerItem">Lines:</td>
<td class="headerCovTableEntryHi">96.3&nbsp;%</td>
<td class="headerCovTableEntry">54</td>
<td class="headerCovTableEntry">52</td>
</tr>
<tr>
<td class="headerItem">Test Date:</td>
<td class="headerValue">2024-05-06 17:54:04</td>
<td></td>
<td class="headerItem">Functions:</td>
<td class="headerCovTableEntryHi">100.0&nbsp;%</td>
<td class="headerCovTableEntry">5</td>
<td class="headerCovTableEntry">5</td>
</tr>
<tr>
<td class="headerItem">Legend:</td>
<td class="headerValueLeg"> Lines:
<span class="coverLegendCov">hit</span>
<span class="coverLegendNoCov">not hit</span>
</td>
<td></td>
</tr>
<tr><td><img src="../../glass.png" width=3 height=3 alt=""></td></tr>
</table>
</td>
</tr>
<tr><td class="ruler"><img src="../../glass.png" width=3 height=3 alt=""></td></tr>
</table>
<center>
<table cellpadding=1 cellspacing=1 border=0>
<tr><td><br></td></tr>
<tr>
<td class="tableHead">Function Name <span title="Click to sort table by function name" class="tableHeadSort"><a href="KDB.cc.func.html"><img src="../../updown.png" width=10 height=14 alt="Sort by function name" title="Click to sort table by function name" border=0></a></span></td>
<td class="tableHead">Hit count <span title="Click to sort table by function hit count" class="tableHeadSort"><img src="../../glass.png" width=10 height=14 alt="Sort by function hit count" title="Click to sort table by function hit count" border=0></span></td>
</tr>
<tr>
<td class="coverFn"><a href="KDB.cc.gcov.html#L101">bayesnet::KDB::graph(std::__cxx11::basic_string&lt;char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt; const&amp;) const</a></td>
<td class="coverFnHi">8</td>
</tr>
<tr>
<td class="coverFn"><a href="KDB.cc.gcov.html#L13">bayesnet::KDB::setHyperparameters(nlohmann::json_abi_v3_11_3::basic_json&lt;std::map, std::vector, std::__cxx11::basic_string&lt;char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt;, bool, long, unsigned long, double, std::allocator, nlohmann::json_abi_v3_11_3::adl_serializer, std::vector&lt;unsigned char, std::allocator&lt;unsigned char&gt; &gt;, void&gt; const&amp;)</a></td>
<td class="coverFnHi">12</td>
</tr>
<tr>
<td class="coverFn"><a href="KDB.cc.gcov.html#L26">bayesnet::KDB::buildModel(at::Tensor const&amp;)</a></td>
<td class="coverFnHi">52</td>
</tr>
<tr>
<td class="coverFn"><a href="KDB.cc.gcov.html#L8">bayesnet::KDB::KDB(int, float)</a></td>
<td class="coverFnHi">148</td>
</tr>
<tr>
<td class="coverFn"><a href="KDB.cc.gcov.html#L77">bayesnet::KDB::add_m_edges(int, std::vector&lt;int, std::allocator&lt;int&gt; &gt;&amp;, at::Tensor&amp;)</a></td>
<td class="coverFnHi">344</td>
</tr>
</table>
<br>
</center>
<table width="100%" border=0 cellspacing=0 cellpadding=0>
<tr><td class="ruler"><img src="../../glass.png" width=3 height=3 alt=""></td></tr>
<tr><td class="versionInfo">Generated by: <a href="https://github.com//linux-test-project/lcov" target="_parent">LCOV version 2.0-1</a></td></tr>
</table>
<br>
</body>
</html>

View File

@ -1,118 +0,0 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>LCOV - BayesNet Coverage Report - bayesnet/classifiers/KDB.cc - functions</title>
<link rel="stylesheet" type="text/css" href="../../gcov.css">
</head>
<body>
<table width="100%" border=0 cellspacing=0 cellpadding=0>
<tr><td class="title">LCOV - code coverage report</td></tr>
<tr><td class="ruler"><img src="../../glass.png" width=3 height=3 alt=""></td></tr>
<tr>
<td width="100%">
<table cellpadding=1 border=0 width="100%">
<tr>
<td width="10%" class="headerItem">Current view:</td>
<td width="10%" class="headerValue"><a href="../../index.html" target="_parent">top level</a> - <a href="index.html" target="_parent">bayesnet/classifiers</a> - KDB.cc<span style="font-size: 80%;"> (<a href="KDB.cc.gcov.html">source</a> / functions)</span></td>
<td width="5%"></td>
<td width="5%"></td>
<td width="5%" class="headerCovTableHead">Coverage</td>
<td width="5%" class="headerCovTableHead" title="Covered + Uncovered code">Total</td>
<td width="5%" class="headerCovTableHead" title="Exercised code only">Hit</td>
</tr>
<tr>
<td class="headerItem">Test:</td>
<td class="headerValue">BayesNet Coverage Report</td>
<td></td>
<td class="headerItem">Lines:</td>
<td class="headerCovTableEntryHi">96.3&nbsp;%</td>
<td class="headerCovTableEntry">54</td>
<td class="headerCovTableEntry">52</td>
</tr>
<tr>
<td class="headerItem">Test Date:</td>
<td class="headerValue">2024-05-06 17:54:04</td>
<td></td>
<td class="headerItem">Functions:</td>
<td class="headerCovTableEntryHi">100.0&nbsp;%</td>
<td class="headerCovTableEntry">5</td>
<td class="headerCovTableEntry">5</td>
</tr>
<tr>
<td class="headerItem">Legend:</td>
<td class="headerValueLeg"> Lines:
<span class="coverLegendCov">hit</span>
<span class="coverLegendNoCov">not hit</span>
</td>
<td></td>
</tr>
<tr><td><img src="../../glass.png" width=3 height=3 alt=""></td></tr>
</table>
</td>
</tr>
<tr><td class="ruler"><img src="../../glass.png" width=3 height=3 alt=""></td></tr>
</table>
<center>
<table cellpadding=1 cellspacing=1 border=0>
<tr><td><br></td></tr>
<tr>
<td class="tableHead">Function Name <span title="Click to sort table by function name" class="tableHeadSort"><img src="../../glass.png" width=10 height=14 alt="Sort by function name" title="Click to sort table by function name" border=0></span></td>
<td class="tableHead">Hit count <span title="Click to sort table by function hit count" class="tableHeadSort"><a href="KDB.cc.func-c.html"><img src="../../updown.png" width=10 height=14 alt="Sort by function hit count" title="Click to sort table by function hit count" border=0></a></span></td>
</tr>
<tr>
<td class="coverFn"><a href="KDB.cc.gcov.html#L8">bayesnet::KDB::KDB(int, float)</a></td>
<td class="coverFnHi">148</td>
</tr>
<tr>
<td class="coverFn"><a href="KDB.cc.gcov.html#L77">bayesnet::KDB::add_m_edges(int, std::vector&lt;int, std::allocator&lt;int&gt; &gt;&amp;, at::Tensor&amp;)</a></td>
<td class="coverFnHi">344</td>
</tr>
<tr>
<td class="coverFn"><a href="KDB.cc.gcov.html#L26">bayesnet::KDB::buildModel(at::Tensor const&amp;)</a></td>
<td class="coverFnHi">52</td>
</tr>
<tr>
<td class="coverFn"><a href="KDB.cc.gcov.html#L101">bayesnet::KDB::graph(std::__cxx11::basic_string&lt;char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt; const&amp;) const</a></td>
<td class="coverFnHi">8</td>
</tr>
<tr>
<td class="coverFn"><a href="KDB.cc.gcov.html#L13">bayesnet::KDB::setHyperparameters(nlohmann::json_abi_v3_11_3::basic_json&lt;std::map, std::vector, std::__cxx11::basic_string&lt;char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt;, bool, long, unsigned long, double, std::allocator, nlohmann::json_abi_v3_11_3::adl_serializer, std::vector&lt;unsigned char, std::allocator&lt;unsigned char&gt; &gt;, void&gt; const&amp;)</a></td>
<td class="coverFnHi">12</td>
</tr>
</table>
<br>
</center>
<table width="100%" border=0 cellspacing=0 cellpadding=0>
<tr><td class="ruler"><img src="../../glass.png" width=3 height=3 alt=""></td></tr>
<tr><td class="versionInfo">Generated by: <a href="https://github.com//linux-test-project/lcov" target="_parent">LCOV version 2.0-1</a></td></tr>
</table>
<br>
</body>
</html>

View File

@ -1,19 +0,0 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN">
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>LCOV - BayesNet Coverage Report - bayesnet/classifiers/KDB.cc</title>
<link rel="stylesheet" type="text/css" href="../../gcov.css">
</head>
<frameset cols="120,*">
<frame src="KDB.cc.gcov.overview.html" name="overview">
<frame src="KDB.cc.gcov.html" name="source">
<noframes>
<center>Frames not supported by your browser!<br></center>
</noframes>
</frameset>
</html>

View File

@ -1,195 +0,0 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>LCOV - BayesNet Coverage Report - bayesnet/classifiers/KDB.cc</title>
<link rel="stylesheet" type="text/css" href="../../gcov.css">
</head>
<body>
<table width="100%" border=0 cellspacing=0 cellpadding=0>
<tr><td class="title">LCOV - code coverage report</td></tr>
<tr><td class="ruler"><img src="../../glass.png" width=3 height=3 alt=""></td></tr>
<tr>
<td width="100%">
<table cellpadding=1 border=0 width="100%">
<tr>
<td width="10%" class="headerItem">Current view:</td>
<td width="10%" class="headerValue"><a href="../../index.html" target="_parent">top level</a> - <a href="index.html" target="_parent">bayesnet/classifiers</a> - KDB.cc<span style="font-size: 80%;"> (source / <a href="KDB.cc.func-c.html">functions</a>)</span></td>
<td width="5%"></td>
<td width="5%"></td>
<td width="5%" class="headerCovTableHead">Coverage</td>
<td width="5%" class="headerCovTableHead" title="Covered + Uncovered code">Total</td>
<td width="5%" class="headerCovTableHead" title="Exercised code only">Hit</td>
</tr>
<tr>
<td class="headerItem">Test:</td>
<td class="headerValue">BayesNet Coverage Report</td>
<td></td>
<td class="headerItem">Lines:</td>
<td class="headerCovTableEntryHi">96.3&nbsp;%</td>
<td class="headerCovTableEntry">54</td>
<td class="headerCovTableEntry">52</td>
</tr>
<tr>
<td class="headerItem">Test Date:</td>
<td class="headerValue">2024-05-06 17:54:04</td>
<td></td>
<td class="headerItem">Functions:</td>
<td class="headerCovTableEntryHi">100.0&nbsp;%</td>
<td class="headerCovTableEntry">5</td>
<td class="headerCovTableEntry">5</td>
</tr>
<tr>
<td class="headerItem">Legend:</td>
<td class="headerValueLeg"> Lines:
<span class="coverLegendCov">hit</span>
<span class="coverLegendNoCov">not hit</span>
</td>
<td></td>
</tr>
<tr><td><img src="../../glass.png" width=3 height=3 alt=""></td></tr>
</table>
</td>
</tr>
<tr><td class="ruler"><img src="../../glass.png" width=3 height=3 alt=""></td></tr>
</table>
<table cellpadding=0 cellspacing=0 border=0>
<tr>
<td><br></td>
</tr>
<tr>
<td>
<pre class="sourceHeading"> Line data Source code</pre>
<pre class="source">
<span id="L1"><span class="lineNum"> 1</span> : // ***************************************************************</span>
<span id="L2"><span class="lineNum"> 2</span> : // SPDX-FileCopyrightText: Copyright 2024 Ricardo Montañana Gómez</span>
<span id="L3"><span class="lineNum"> 3</span> : // SPDX-FileType: SOURCE</span>
<span id="L4"><span class="lineNum"> 4</span> : // SPDX-License-Identifier: MIT</span>
<span id="L5"><span class="lineNum"> 5</span> : // ***************************************************************</span>
<span id="L6"><span class="lineNum"> 6</span> : </span>
<span id="L7"><span class="lineNum"> 7</span> : #include &quot;KDB.h&quot;</span>
<span id="L8"><span class="lineNum"> 8</span> : </span>
<span id="L9"><span class="lineNum"> 9</span> : namespace bayesnet {</span>
<span id="L10"><span class="lineNum"> 10</span> <span class="tlaGNC tlaBgGNC"> 148 : KDB::KDB(int k, float theta) : Classifier(Network()), k(k), theta(theta)</span></span>
<span id="L11"><span class="lineNum"> 11</span> : {</span>
<span id="L12"><span class="lineNum"> 12</span> <span class="tlaGNC"> 444 : validHyperparameters = { &quot;k&quot;, &quot;theta&quot; };</span></span>
<span id="L13"><span class="lineNum"> 13</span> : </span>
<span id="L14"><span class="lineNum"> 14</span> <span class="tlaGNC"> 444 : }</span></span>
<span id="L15"><span class="lineNum"> 15</span> <span class="tlaGNC"> 12 : void KDB::setHyperparameters(const nlohmann::json&amp; hyperparameters_)</span></span>
<span id="L16"><span class="lineNum"> 16</span> : {</span>
<span id="L17"><span class="lineNum"> 17</span> <span class="tlaGNC"> 12 : auto hyperparameters = hyperparameters_;</span></span>
<span id="L18"><span class="lineNum"> 18</span> <span class="tlaGNC"> 12 : if (hyperparameters.contains(&quot;k&quot;)) {</span></span>
<span id="L19"><span class="lineNum"> 19</span> <span class="tlaGNC"> 4 : k = hyperparameters[&quot;k&quot;];</span></span>
<span id="L20"><span class="lineNum"> 20</span> <span class="tlaGNC"> 4 : hyperparameters.erase(&quot;k&quot;);</span></span>
<span id="L21"><span class="lineNum"> 21</span> : }</span>
<span id="L22"><span class="lineNum"> 22</span> <span class="tlaGNC"> 12 : if (hyperparameters.contains(&quot;theta&quot;)) {</span></span>
<span id="L23"><span class="lineNum"> 23</span> <span class="tlaGNC"> 4 : theta = hyperparameters[&quot;theta&quot;];</span></span>
<span id="L24"><span class="lineNum"> 24</span> <span class="tlaGNC"> 4 : hyperparameters.erase(&quot;theta&quot;);</span></span>
<span id="L25"><span class="lineNum"> 25</span> : }</span>
<span id="L26"><span class="lineNum"> 26</span> <span class="tlaGNC"> 12 : Classifier::setHyperparameters(hyperparameters);</span></span>
<span id="L27"><span class="lineNum"> 27</span> <span class="tlaGNC"> 12 : }</span></span>
<span id="L28"><span class="lineNum"> 28</span> <span class="tlaGNC"> 52 : void KDB::buildModel(const torch::Tensor&amp; weights)</span></span>
<span id="L29"><span class="lineNum"> 29</span> : {</span>
<span id="L30"><span class="lineNum"> 30</span> : /*</span>
<span id="L31"><span class="lineNum"> 31</span> : 1. For each feature Xi, compute mutual information, I(X;C),</span>
<span id="L32"><span class="lineNum"> 32</span> : where C is the class.</span>
<span id="L33"><span class="lineNum"> 33</span> : 2. Compute class conditional mutual information I(Xi;XjIC), f or each</span>
<span id="L34"><span class="lineNum"> 34</span> : pair of features Xi and Xj, where i#j.</span>
<span id="L35"><span class="lineNum"> 35</span> : 3. Let the used variable list, S, be empty.</span>
<span id="L36"><span class="lineNum"> 36</span> : 4. Let the DAG network being constructed, BN, begin with a single</span>
<span id="L37"><span class="lineNum"> 37</span> : class node, C.</span>
<span id="L38"><span class="lineNum"> 38</span> : 5. Repeat until S includes all domain features</span>
<span id="L39"><span class="lineNum"> 39</span> : 5.1. Select feature Xmax which is not in S and has the largest value</span>
<span id="L40"><span class="lineNum"> 40</span> : I(Xmax;C).</span>
<span id="L41"><span class="lineNum"> 41</span> : 5.2. Add a node to BN representing Xmax.</span>
<span id="L42"><span class="lineNum"> 42</span> : 5.3. Add an arc from C to Xmax in BN.</span>
<span id="L43"><span class="lineNum"> 43</span> : 5.4. Add m = min(lSl,/c) arcs from m distinct features Xj in S with</span>
<span id="L44"><span class="lineNum"> 44</span> : the highest value for I(Xmax;X,jC).</span>
<span id="L45"><span class="lineNum"> 45</span> : 5.5. Add Xmax to S.</span>
<span id="L46"><span class="lineNum"> 46</span> : Compute the conditional probabilility infered by the structure of BN by</span>
<span id="L47"><span class="lineNum"> 47</span> : using counts from DB, and output BN.</span>
<span id="L48"><span class="lineNum"> 48</span> : */</span>
<span id="L49"><span class="lineNum"> 49</span> : // 1. For each feature Xi, compute mutual information, I(X;C),</span>
<span id="L50"><span class="lineNum"> 50</span> : // where C is the class.</span>
<span id="L51"><span class="lineNum"> 51</span> <span class="tlaGNC"> 52 : addNodes();</span></span>
<span id="L52"><span class="lineNum"> 52</span> <span class="tlaGNC"> 156 : const torch::Tensor&amp; y = dataset.index({ -1, &quot;...&quot; });</span></span>
<span id="L53"><span class="lineNum"> 53</span> <span class="tlaGNC"> 52 : std::vector&lt;double&gt; mi;</span></span>
<span id="L54"><span class="lineNum"> 54</span> <span class="tlaGNC"> 396 : for (auto i = 0; i &lt; features.size(); i++) {</span></span>
<span id="L55"><span class="lineNum"> 55</span> <span class="tlaGNC"> 1032 : torch::Tensor firstFeature = dataset.index({ i, &quot;...&quot; });</span></span>
<span id="L56"><span class="lineNum"> 56</span> <span class="tlaGNC"> 344 : mi.push_back(metrics.mutualInformation(firstFeature, y, weights));</span></span>
<span id="L57"><span class="lineNum"> 57</span> <span class="tlaGNC"> 344 : }</span></span>
<span id="L58"><span class="lineNum"> 58</span> : // 2. Compute class conditional mutual information I(Xi;XjIC), f or each</span>
<span id="L59"><span class="lineNum"> 59</span> <span class="tlaGNC"> 52 : auto conditionalEdgeWeights = metrics.conditionalEdge(weights);</span></span>
<span id="L60"><span class="lineNum"> 60</span> : // 3. Let the used variable list, S, be empty.</span>
<span id="L61"><span class="lineNum"> 61</span> <span class="tlaGNC"> 52 : std::vector&lt;int&gt; S;</span></span>
<span id="L62"><span class="lineNum"> 62</span> : // 4. Let the DAG network being constructed, BN, begin with a single</span>
<span id="L63"><span class="lineNum"> 63</span> : // class node, C.</span>
<span id="L64"><span class="lineNum"> 64</span> : // 5. Repeat until S includes all domain features</span>
<span id="L65"><span class="lineNum"> 65</span> : // 5.1. Select feature Xmax which is not in S and has the largest value</span>
<span id="L66"><span class="lineNum"> 66</span> : // I(Xmax;C).</span>
<span id="L67"><span class="lineNum"> 67</span> <span class="tlaGNC"> 52 : auto order = argsort(mi);</span></span>
<span id="L68"><span class="lineNum"> 68</span> <span class="tlaGNC"> 396 : for (auto idx : order) {</span></span>
<span id="L69"><span class="lineNum"> 69</span> : // 5.2. Add a node to BN representing Xmax.</span>
<span id="L70"><span class="lineNum"> 70</span> : // 5.3. Add an arc from C to Xmax in BN.</span>
<span id="L71"><span class="lineNum"> 71</span> <span class="tlaGNC"> 344 : model.addEdge(className, features[idx]);</span></span>
<span id="L72"><span class="lineNum"> 72</span> : // 5.4. Add m = min(lSl,/c) arcs from m distinct features Xj in S with</span>
<span id="L73"><span class="lineNum"> 73</span> : // the highest value for I(Xmax;X,jC).</span>
<span id="L74"><span class="lineNum"> 74</span> <span class="tlaGNC"> 344 : add_m_edges(idx, S, conditionalEdgeWeights);</span></span>
<span id="L75"><span class="lineNum"> 75</span> : // 5.5. Add Xmax to S.</span>
<span id="L76"><span class="lineNum"> 76</span> <span class="tlaGNC"> 344 : S.push_back(idx);</span></span>
<span id="L77"><span class="lineNum"> 77</span> : }</span>
<span id="L78"><span class="lineNum"> 78</span> <span class="tlaGNC"> 448 : }</span></span>
<span id="L79"><span class="lineNum"> 79</span> <span class="tlaGNC"> 344 : void KDB::add_m_edges(int idx, std::vector&lt;int&gt;&amp; S, torch::Tensor&amp; weights)</span></span>
<span id="L80"><span class="lineNum"> 80</span> : {</span>
<span id="L81"><span class="lineNum"> 81</span> <span class="tlaGNC"> 344 : auto n_edges = std::min(k, static_cast&lt;int&gt;(S.size()));</span></span>
<span id="L82"><span class="lineNum"> 82</span> <span class="tlaGNC"> 344 : auto cond_w = clone(weights);</span></span>
<span id="L83"><span class="lineNum"> 83</span> <span class="tlaGNC"> 344 : bool exit_cond = k == 0;</span></span>
<span id="L84"><span class="lineNum"> 84</span> <span class="tlaGNC"> 344 : int num = 0;</span></span>
<span id="L85"><span class="lineNum"> 85</span> <span class="tlaGNC"> 1004 : while (!exit_cond) {</span></span>
<span id="L86"><span class="lineNum"> 86</span> <span class="tlaGNC"> 2640 : auto max_minfo = argmax(cond_w.index({ idx, &quot;...&quot; })).item&lt;int&gt;();</span></span>
<span id="L87"><span class="lineNum"> 87</span> <span class="tlaGNC"> 660 : auto belongs = find(S.begin(), S.end(), max_minfo) != S.end();</span></span>
<span id="L88"><span class="lineNum"> 88</span> <span class="tlaGNC"> 1764 : if (belongs &amp;&amp; cond_w.index({ idx, max_minfo }).item&lt;float&gt;() &gt; theta) {</span></span>
<span id="L89"><span class="lineNum"> 89</span> : try {</span>
<span id="L90"><span class="lineNum"> 90</span> <span class="tlaGNC"> 320 : model.addEdge(features[max_minfo], features[idx]);</span></span>
<span id="L91"><span class="lineNum"> 91</span> <span class="tlaGNC"> 320 : num++;</span></span>
<span id="L92"><span class="lineNum"> 92</span> : }</span>
<span id="L93"><span class="lineNum"> 93</span> <span class="tlaUNC tlaBgUNC"> 0 : catch (const std::invalid_argument&amp; e) {</span></span>
<span id="L94"><span class="lineNum"> 94</span> : // Loops are not allowed</span>
<span id="L95"><span class="lineNum"> 95</span> <span class="tlaUNC"> 0 : }</span></span>
<span id="L96"><span class="lineNum"> 96</span> : }</span>
<span id="L97"><span class="lineNum"> 97</span> <span class="tlaGNC tlaBgGNC"> 2640 : cond_w.index_put_({ idx, max_minfo }, -1);</span></span>
<span id="L98"><span class="lineNum"> 98</span> <span class="tlaGNC"> 1980 : auto candidates_mask = cond_w.index({ idx, &quot;...&quot; }).gt(theta);</span></span>
<span id="L99"><span class="lineNum"> 99</span> <span class="tlaGNC"> 660 : auto candidates = candidates_mask.nonzero();</span></span>
<span id="L100"><span class="lineNum"> 100</span> <span class="tlaGNC"> 660 : exit_cond = num == n_edges || candidates.size(0) == 0;</span></span>
<span id="L101"><span class="lineNum"> 101</span> <span class="tlaGNC"> 660 : }</span></span>
<span id="L102"><span class="lineNum"> 102</span> <span class="tlaGNC"> 2692 : }</span></span>
<span id="L103"><span class="lineNum"> 103</span> <span class="tlaGNC"> 8 : std::vector&lt;std::string&gt; KDB::graph(const std::string&amp; title) const</span></span>
<span id="L104"><span class="lineNum"> 104</span> : {</span>
<span id="L105"><span class="lineNum"> 105</span> <span class="tlaGNC"> 8 : std::string header{ title };</span></span>
<span id="L106"><span class="lineNum"> 106</span> <span class="tlaGNC"> 8 : if (title == &quot;KDB&quot;) {</span></span>
<span id="L107"><span class="lineNum"> 107</span> <span class="tlaGNC"> 8 : header += &quot; (k=&quot; + std::to_string(k) + &quot;, theta=&quot; + std::to_string(theta) + &quot;)&quot;;</span></span>
<span id="L108"><span class="lineNum"> 108</span> : }</span>
<span id="L109"><span class="lineNum"> 109</span> <span class="tlaGNC"> 16 : return model.graph(header);</span></span>
<span id="L110"><span class="lineNum"> 110</span> <span class="tlaGNC"> 8 : }</span></span>
<span id="L111"><span class="lineNum"> 111</span> : }</span>
</pre>
</td>
</tr>
</table>
<br>
<table width="100%" border=0 cellspacing=0 cellpadding=0>
<tr><td class="ruler"><img src="../../glass.png" width=3 height=3 alt=""></td></tr>
<tr><td class="versionInfo">Generated by: <a href="https://github.com//linux-test-project/lcov" target="_parent">LCOV version 2.0-1</a></td></tr>
</table>
<br>
</body>
</html>

View File

@ -1,48 +0,0 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html lang="en">
<head>
<title>LCOV - BayesNet Coverage Report - bayesnet/classifiers/KDB.cc</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" type="text/css" href="../../gcov.css">
</head>
<body>
<map name="overview">
<area shape="rect" coords="0,0,79,3" href="KDB.cc.gcov.html#L1" target="source" alt="overview">
<area shape="rect" coords="0,4,79,7" href="KDB.cc.gcov.html#L1" target="source" alt="overview">
<area shape="rect" coords="0,8,79,11" href="KDB.cc.gcov.html#L1" target="source" alt="overview">
<area shape="rect" coords="0,12,79,15" href="KDB.cc.gcov.html#L1" target="source" alt="overview">
<area shape="rect" coords="0,16,79,19" href="KDB.cc.gcov.html#L5" target="source" alt="overview">
<area shape="rect" coords="0,20,79,23" href="KDB.cc.gcov.html#L9" target="source" alt="overview">
<area shape="rect" coords="0,24,79,27" href="KDB.cc.gcov.html#L13" target="source" alt="overview">
<area shape="rect" coords="0,28,79,31" href="KDB.cc.gcov.html#L17" target="source" alt="overview">
<area shape="rect" coords="0,32,79,35" href="KDB.cc.gcov.html#L21" target="source" alt="overview">
<area shape="rect" coords="0,36,79,39" href="KDB.cc.gcov.html#L25" target="source" alt="overview">
<area shape="rect" coords="0,40,79,43" href="KDB.cc.gcov.html#L29" target="source" alt="overview">
<area shape="rect" coords="0,44,79,47" href="KDB.cc.gcov.html#L33" target="source" alt="overview">
<area shape="rect" coords="0,48,79,51" href="KDB.cc.gcov.html#L37" target="source" alt="overview">
<area shape="rect" coords="0,52,79,55" href="KDB.cc.gcov.html#L41" target="source" alt="overview">
<area shape="rect" coords="0,56,79,59" href="KDB.cc.gcov.html#L45" target="source" alt="overview">
<area shape="rect" coords="0,60,79,63" href="KDB.cc.gcov.html#L49" target="source" alt="overview">
<area shape="rect" coords="0,64,79,67" href="KDB.cc.gcov.html#L53" target="source" alt="overview">
<area shape="rect" coords="0,68,79,71" href="KDB.cc.gcov.html#L57" target="source" alt="overview">
<area shape="rect" coords="0,72,79,75" href="KDB.cc.gcov.html#L61" target="source" alt="overview">
<area shape="rect" coords="0,76,79,79" href="KDB.cc.gcov.html#L65" target="source" alt="overview">
<area shape="rect" coords="0,80,79,83" href="KDB.cc.gcov.html#L69" target="source" alt="overview">
<area shape="rect" coords="0,84,79,87" href="KDB.cc.gcov.html#L73" target="source" alt="overview">
<area shape="rect" coords="0,88,79,91" href="KDB.cc.gcov.html#L77" target="source" alt="overview">
<area shape="rect" coords="0,92,79,95" href="KDB.cc.gcov.html#L81" target="source" alt="overview">
<area shape="rect" coords="0,96,79,99" href="KDB.cc.gcov.html#L85" target="source" alt="overview">
<area shape="rect" coords="0,100,79,103" href="KDB.cc.gcov.html#L89" target="source" alt="overview">
<area shape="rect" coords="0,104,79,107" href="KDB.cc.gcov.html#L93" target="source" alt="overview">
<area shape="rect" coords="0,108,79,111" href="KDB.cc.gcov.html#L97" target="source" alt="overview">
</map>
<center>
<a href="KDB.cc.gcov.html#top" target="source">Top</a><br><br>
<img src="KDB.cc.gcov.png" width=80 height=110 alt="Overview" border=0 usemap="#overview">
</center>
</body>
</html>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 814 B

View File

@ -1,90 +0,0 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>LCOV - BayesNet Coverage Report - bayesnet/classifiers/KDB.h - functions</title>
<link rel="stylesheet" type="text/css" href="../../gcov.css">
</head>
<body>
<table width="100%" border=0 cellspacing=0 cellpadding=0>
<tr><td class="title">LCOV - code coverage report</td></tr>
<tr><td class="ruler"><img src="../../glass.png" width=3 height=3 alt=""></td></tr>
<tr>
<td width="100%">
<table cellpadding=1 border=0 width="100%">
<tr>
<td width="10%" class="headerItem">Current view:</td>
<td width="10%" class="headerValue"><a href="../../index.html" target="_parent">top level</a> - <a href="index.html" target="_parent">bayesnet/classifiers</a> - KDB.h<span style="font-size: 80%;"> (<a href="KDB.h.gcov.html">source</a> / functions)</span></td>
<td width="5%"></td>
<td width="5%"></td>
<td width="5%" class="headerCovTableHead">Coverage</td>
<td width="5%" class="headerCovTableHead" title="Covered + Uncovered code">Total</td>
<td width="5%" class="headerCovTableHead" title="Exercised code only">Hit</td>
</tr>
<tr>
<td class="headerItem">Test:</td>
<td class="headerValue">BayesNet Coverage Report</td>
<td></td>
<td class="headerItem">Lines:</td>
<td class="headerCovTableEntryHi">100.0&nbsp;%</td>
<td class="headerCovTableEntry">1</td>
<td class="headerCovTableEntry">1</td>
</tr>
<tr>
<td class="headerItem">Test Date:</td>
<td class="headerValue">2024-05-06 17:54:04</td>
<td></td>
<td class="headerItem">Functions:</td>
<td class="headerCovTableEntryHi">100.0&nbsp;%</td>
<td class="headerCovTableEntry">1</td>
<td class="headerCovTableEntry">1</td>
</tr>
<tr>
<td class="headerItem">Legend:</td>
<td class="headerValueLeg"> Lines:
<span class="coverLegendCov">hit</span>
<span class="coverLegendNoCov">not hit</span>
</td>
<td></td>
</tr>
<tr><td><img src="../../glass.png" width=3 height=3 alt=""></td></tr>
</table>
</td>
</tr>
<tr><td class="ruler"><img src="../../glass.png" width=3 height=3 alt=""></td></tr>
</table>
<center>
<table cellpadding=1 cellspacing=1 border=0>
<tr><td><br></td></tr>
<tr>
<td class="tableHead">Function Name <span title="Click to sort table by function name" class="tableHeadSort"><a href="KDB.h.func.html"><img src="../../updown.png" width=10 height=14 alt="Sort by function name" title="Click to sort table by function name" border=0></a></span></td>
<td class="tableHead">Hit count <span title="Click to sort table by function hit count" class="tableHeadSort"><img src="../../glass.png" width=10 height=14 alt="Sort by function hit count" title="Click to sort table by function hit count" border=0></span></td>
</tr>
<tr>
<td class="coverFn"><a href="KDB.h.gcov.html#L20">bayesnet::KDB::~KDB()</a></td>
<td class="coverFnHi">44</td>
</tr>
</table>
<br>
</center>
<table width="100%" border=0 cellspacing=0 cellpadding=0>
<tr><td class="ruler"><img src="../../glass.png" width=3 height=3 alt=""></td></tr>
<tr><td class="versionInfo">Generated by: <a href="https://github.com//linux-test-project/lcov" target="_parent">LCOV version 2.0-1</a></td></tr>
</table>
<br>
</body>
</html>

View File

@ -1,90 +0,0 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>LCOV - BayesNet Coverage Report - bayesnet/classifiers/KDB.h - functions</title>
<link rel="stylesheet" type="text/css" href="../../gcov.css">
</head>
<body>
<table width="100%" border=0 cellspacing=0 cellpadding=0>
<tr><td class="title">LCOV - code coverage report</td></tr>
<tr><td class="ruler"><img src="../../glass.png" width=3 height=3 alt=""></td></tr>
<tr>
<td width="100%">
<table cellpadding=1 border=0 width="100%">
<tr>
<td width="10%" class="headerItem">Current view:</td>
<td width="10%" class="headerValue"><a href="../../index.html" target="_parent">top level</a> - <a href="index.html" target="_parent">bayesnet/classifiers</a> - KDB.h<span style="font-size: 80%;"> (<a href="KDB.h.gcov.html">source</a> / functions)</span></td>
<td width="5%"></td>
<td width="5%"></td>
<td width="5%" class="headerCovTableHead">Coverage</td>
<td width="5%" class="headerCovTableHead" title="Covered + Uncovered code">Total</td>
<td width="5%" class="headerCovTableHead" title="Exercised code only">Hit</td>
</tr>
<tr>
<td class="headerItem">Test:</td>
<td class="headerValue">BayesNet Coverage Report</td>
<td></td>
<td class="headerItem">Lines:</td>
<td class="headerCovTableEntryHi">100.0&nbsp;%</td>
<td class="headerCovTableEntry">1</td>
<td class="headerCovTableEntry">1</td>
</tr>
<tr>
<td class="headerItem">Test Date:</td>
<td class="headerValue">2024-05-06 17:54:04</td>
<td></td>
<td class="headerItem">Functions:</td>
<td class="headerCovTableEntryHi">100.0&nbsp;%</td>
<td class="headerCovTableEntry">1</td>
<td class="headerCovTableEntry">1</td>
</tr>
<tr>
<td class="headerItem">Legend:</td>
<td class="headerValueLeg"> Lines:
<span class="coverLegendCov">hit</span>
<span class="coverLegendNoCov">not hit</span>
</td>
<td></td>
</tr>
<tr><td><img src="../../glass.png" width=3 height=3 alt=""></td></tr>
</table>
</td>
</tr>
<tr><td class="ruler"><img src="../../glass.png" width=3 height=3 alt=""></td></tr>
</table>
<center>
<table cellpadding=1 cellspacing=1 border=0>
<tr><td><br></td></tr>
<tr>
<td class="tableHead">Function Name <span title="Click to sort table by function name" class="tableHeadSort"><img src="../../glass.png" width=10 height=14 alt="Sort by function name" title="Click to sort table by function name" border=0></span></td>
<td class="tableHead">Hit count <span title="Click to sort table by function hit count" class="tableHeadSort"><a href="KDB.h.func-c.html"><img src="../../updown.png" width=10 height=14 alt="Sort by function hit count" title="Click to sort table by function hit count" border=0></a></span></td>
</tr>
<tr>
<td class="coverFn"><a href="KDB.h.gcov.html#L20">bayesnet::KDB::~KDB()</a></td>
<td class="coverFnHi">44</td>
</tr>
</table>
<br>
</center>
<table width="100%" border=0 cellspacing=0 cellpadding=0>
<tr><td class="ruler"><img src="../../glass.png" width=3 height=3 alt=""></td></tr>
<tr><td class="versionInfo">Generated by: <a href="https://github.com//linux-test-project/lcov" target="_parent">LCOV version 2.0-1</a></td></tr>
</table>
<br>
</body>
</html>

View File

@ -1,19 +0,0 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN">
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>LCOV - BayesNet Coverage Report - bayesnet/classifiers/KDB.h</title>
<link rel="stylesheet" type="text/css" href="../../gcov.css">
</head>
<frameset cols="120,*">
<frame src="KDB.h.gcov.overview.html" name="overview">
<frame src="KDB.h.gcov.html" name="source">
<noframes>
<center>Frames not supported by your browser!<br></center>
</noframes>
</frameset>
</html>

View File

@ -1,111 +0,0 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>LCOV - BayesNet Coverage Report - bayesnet/classifiers/KDB.h</title>
<link rel="stylesheet" type="text/css" href="../../gcov.css">
</head>
<body>
<table width="100%" border=0 cellspacing=0 cellpadding=0>
<tr><td class="title">LCOV - code coverage report</td></tr>
<tr><td class="ruler"><img src="../../glass.png" width=3 height=3 alt=""></td></tr>
<tr>
<td width="100%">
<table cellpadding=1 border=0 width="100%">
<tr>
<td width="10%" class="headerItem">Current view:</td>
<td width="10%" class="headerValue"><a href="../../index.html" target="_parent">top level</a> - <a href="index.html" target="_parent">bayesnet/classifiers</a> - KDB.h<span style="font-size: 80%;"> (source / <a href="KDB.h.func-c.html">functions</a>)</span></td>
<td width="5%"></td>
<td width="5%"></td>
<td width="5%" class="headerCovTableHead">Coverage</td>
<td width="5%" class="headerCovTableHead" title="Covered + Uncovered code">Total</td>
<td width="5%" class="headerCovTableHead" title="Exercised code only">Hit</td>
</tr>
<tr>
<td class="headerItem">Test:</td>
<td class="headerValue">BayesNet Coverage Report</td>
<td></td>
<td class="headerItem">Lines:</td>
<td class="headerCovTableEntryHi">100.0&nbsp;%</td>
<td class="headerCovTableEntry">1</td>
<td class="headerCovTableEntry">1</td>
</tr>
<tr>
<td class="headerItem">Test Date:</td>
<td class="headerValue">2024-05-06 17:54:04</td>
<td></td>
<td class="headerItem">Functions:</td>
<td class="headerCovTableEntryHi">100.0&nbsp;%</td>
<td class="headerCovTableEntry">1</td>
<td class="headerCovTableEntry">1</td>
</tr>
<tr>
<td class="headerItem">Legend:</td>
<td class="headerValueLeg"> Lines:
<span class="coverLegendCov">hit</span>
<span class="coverLegendNoCov">not hit</span>
</td>
<td></td>
</tr>
<tr><td><img src="../../glass.png" width=3 height=3 alt=""></td></tr>
</table>
</td>
</tr>
<tr><td class="ruler"><img src="../../glass.png" width=3 height=3 alt=""></td></tr>
</table>
<table cellpadding=0 cellspacing=0 border=0>
<tr>
<td><br></td>
</tr>
<tr>
<td>
<pre class="sourceHeading"> Line data Source code</pre>
<pre class="source">
<span id="L1"><span class="lineNum"> 1</span> : // ***************************************************************</span>
<span id="L2"><span class="lineNum"> 2</span> : // SPDX-FileCopyrightText: Copyright 2024 Ricardo Montañana Gómez</span>
<span id="L3"><span class="lineNum"> 3</span> : // SPDX-FileType: SOURCE</span>
<span id="L4"><span class="lineNum"> 4</span> : // SPDX-License-Identifier: MIT</span>
<span id="L5"><span class="lineNum"> 5</span> : // ***************************************************************</span>
<span id="L6"><span class="lineNum"> 6</span> : </span>
<span id="L7"><span class="lineNum"> 7</span> : #ifndef KDB_H</span>
<span id="L8"><span class="lineNum"> 8</span> : #define KDB_H</span>
<span id="L9"><span class="lineNum"> 9</span> : #include &lt;torch/torch.h&gt;</span>
<span id="L10"><span class="lineNum"> 10</span> : #include &quot;bayesnet/utils/bayesnetUtils.h&quot;</span>
<span id="L11"><span class="lineNum"> 11</span> : #include &quot;Classifier.h&quot;</span>
<span id="L12"><span class="lineNum"> 12</span> : namespace bayesnet {</span>
<span id="L13"><span class="lineNum"> 13</span> : class KDB : public Classifier {</span>
<span id="L14"><span class="lineNum"> 14</span> : private:</span>
<span id="L15"><span class="lineNum"> 15</span> : int k;</span>
<span id="L16"><span class="lineNum"> 16</span> : float theta;</span>
<span id="L17"><span class="lineNum"> 17</span> : void add_m_edges(int idx, std::vector&lt;int&gt;&amp; S, torch::Tensor&amp; weights);</span>
<span id="L18"><span class="lineNum"> 18</span> : protected:</span>
<span id="L19"><span class="lineNum"> 19</span> : void buildModel(const torch::Tensor&amp; weights) override;</span>
<span id="L20"><span class="lineNum"> 20</span> : public:</span>
<span id="L21"><span class="lineNum"> 21</span> : explicit KDB(int k, float theta = 0.03);</span>
<span id="L22"><span class="lineNum"> 22</span> <span class="tlaGNC tlaBgGNC"> 44 : virtual ~KDB() = default;</span></span>
<span id="L23"><span class="lineNum"> 23</span> : void setHyperparameters(const nlohmann::json&amp; hyperparameters_) override;</span>
<span id="L24"><span class="lineNum"> 24</span> : std::vector&lt;std::string&gt; graph(const std::string&amp; name = &quot;KDB&quot;) const override;</span>
<span id="L25"><span class="lineNum"> 25</span> : };</span>
<span id="L26"><span class="lineNum"> 26</span> : }</span>
<span id="L27"><span class="lineNum"> 27</span> : #endif</span>
</pre>
</td>
</tr>
</table>
<br>
<table width="100%" border=0 cellspacing=0 cellpadding=0>
<tr><td class="ruler"><img src="../../glass.png" width=3 height=3 alt=""></td></tr>
<tr><td class="versionInfo">Generated by: <a href="https://github.com//linux-test-project/lcov" target="_parent">LCOV version 2.0-1</a></td></tr>
</table>
<br>
</body>
</html>

View File

@ -1,27 +0,0 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html lang="en">
<head>
<title>LCOV - BayesNet Coverage Report - bayesnet/classifiers/KDB.h</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" type="text/css" href="../../gcov.css">
</head>
<body>
<map name="overview">
<area shape="rect" coords="0,0,79,3" href="KDB.h.gcov.html#L1" target="source" alt="overview">
<area shape="rect" coords="0,4,79,7" href="KDB.h.gcov.html#L1" target="source" alt="overview">
<area shape="rect" coords="0,8,79,11" href="KDB.h.gcov.html#L1" target="source" alt="overview">
<area shape="rect" coords="0,12,79,15" href="KDB.h.gcov.html#L1" target="source" alt="overview">
<area shape="rect" coords="0,16,79,19" href="KDB.h.gcov.html#L5" target="source" alt="overview">
<area shape="rect" coords="0,20,79,23" href="KDB.h.gcov.html#L9" target="source" alt="overview">
<area shape="rect" coords="0,24,79,27" href="KDB.h.gcov.html#L13" target="source" alt="overview">
</map>
<center>
<a href="KDB.h.gcov.html#top" target="source">Top</a><br><br>
<img src="KDB.h.gcov.png" width=80 height=26 alt="Overview" border=0 usemap="#overview">
</center>
</body>
</html>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 279 B

View File

@ -1,111 +0,0 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>LCOV - BayesNet Coverage Report - bayesnet/classifiers/KDBLd.cc - functions</title>
<link rel="stylesheet" type="text/css" href="../../gcov.css">
</head>
<body>
<table width="100%" border=0 cellspacing=0 cellpadding=0>
<tr><td class="title">LCOV - code coverage report</td></tr>
<tr><td class="ruler"><img src="../../glass.png" width=3 height=3 alt=""></td></tr>
<tr>
<td width="100%">
<table cellpadding=1 border=0 width="100%">
<tr>
<td width="10%" class="headerItem">Current view:</td>
<td width="10%" class="headerValue"><a href="../../index.html" target="_parent">top level</a> - <a href="index.html" target="_parent">bayesnet/classifiers</a> - KDBLd.cc<span style="font-size: 80%;"> (<a href="KDBLd.cc.gcov.html">source</a> / functions)</span></td>
<td width="5%"></td>
<td width="5%"></td>
<td width="5%" class="headerCovTableHead">Coverage</td>
<td width="5%" class="headerCovTableHead" title="Covered + Uncovered code">Total</td>
<td width="5%" class="headerCovTableHead" title="Exercised code only">Hit</td>
</tr>
<tr>
<td class="headerItem">Test:</td>
<td class="headerValue">BayesNet Coverage Report</td>
<td></td>
<td class="headerItem">Lines:</td>
<td class="headerCovTableEntryHi">100.0&nbsp;%</td>
<td class="headerCovTableEntry">17</td>
<td class="headerCovTableEntry">17</td>
</tr>
<tr>
<td class="headerItem">Test Date:</td>
<td class="headerValue">2024-05-06 17:54:04</td>
<td></td>
<td class="headerItem">Functions:</td>
<td class="headerCovTableEntryHi">100.0&nbsp;%</td>
<td class="headerCovTableEntry">4</td>
<td class="headerCovTableEntry">4</td>
</tr>
<tr>
<td class="headerItem">Legend:</td>
<td class="headerValueLeg"> Lines:
<span class="coverLegendCov">hit</span>
<span class="coverLegendNoCov">not hit</span>
</td>
<td></td>
</tr>
<tr><td><img src="../../glass.png" width=3 height=3 alt=""></td></tr>
</table>
</td>
</tr>
<tr><td class="ruler"><img src="../../glass.png" width=3 height=3 alt=""></td></tr>
</table>
<center>
<table cellpadding=1 cellspacing=1 border=0>
<tr><td><br></td></tr>
<tr>
<td class="tableHead">Function Name <span title="Click to sort table by function name" class="tableHeadSort"><a href="KDBLd.cc.func.html"><img src="../../updown.png" width=10 height=14 alt="Sort by function name" title="Click to sort table by function name" border=0></a></span></td>
<td class="tableHead">Hit count <span title="Click to sort table by function hit count" class="tableHeadSort"><img src="../../glass.png" width=10 height=14 alt="Sort by function hit count" title="Click to sort table by function hit count" border=0></span></td>
</tr>
<tr>
<td class="coverFn"><a href="KDBLd.cc.gcov.html#L29">bayesnet::KDBLd::graph(std::__cxx11::basic_string&lt;char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt; const&amp;) const</a></td>
<td class="coverFnHi">4</td>
</tr>
<tr>
<td class="coverFn"><a href="KDBLd.cc.gcov.html#L24">bayesnet::KDBLd::predict(at::Tensor&amp;)</a></td>
<td class="coverFnHi">16</td>
</tr>
<tr>
<td class="coverFn"><a href="KDBLd.cc.gcov.html#L9">bayesnet::KDBLd::fit(at::Tensor&amp;, at::Tensor&amp;, std::vector&lt;std::__cxx11::basic_string&lt;char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt;, std::allocator&lt;std::__cxx11::basic_string&lt;char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt; &gt; &gt; const&amp;, std::__cxx11::basic_string&lt;char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt; const&amp;, std::map&lt;std::__cxx11::basic_string&lt;char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt;, std::vector&lt;int, std::allocator&lt;int&gt; &gt;, std::less&lt;std::__cxx11::basic_string&lt;char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt; &gt;, std::allocator&lt;std::pair&lt;std::__cxx11::basic_string&lt;char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt; const, std::vector&lt;int, std::allocator&lt;int&gt; &gt; &gt; &gt; &gt;&amp;)</a></td>
<td class="coverFnHi">20</td>
</tr>
<tr>
<td class="coverFn"><a href="KDBLd.cc.gcov.html#L8">bayesnet::KDBLd::KDBLd(int)</a></td>
<td class="coverFnHi">68</td>
</tr>
</table>
<br>
</center>
<table width="100%" border=0 cellspacing=0 cellpadding=0>
<tr><td class="ruler"><img src="../../glass.png" width=3 height=3 alt=""></td></tr>
<tr><td class="versionInfo">Generated by: <a href="https://github.com//linux-test-project/lcov" target="_parent">LCOV version 2.0-1</a></td></tr>
</table>
<br>
</body>
</html>

View File

@ -1,111 +0,0 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>LCOV - BayesNet Coverage Report - bayesnet/classifiers/KDBLd.cc - functions</title>
<link rel="stylesheet" type="text/css" href="../../gcov.css">
</head>
<body>
<table width="100%" border=0 cellspacing=0 cellpadding=0>
<tr><td class="title">LCOV - code coverage report</td></tr>
<tr><td class="ruler"><img src="../../glass.png" width=3 height=3 alt=""></td></tr>
<tr>
<td width="100%">
<table cellpadding=1 border=0 width="100%">
<tr>
<td width="10%" class="headerItem">Current view:</td>
<td width="10%" class="headerValue"><a href="../../index.html" target="_parent">top level</a> - <a href="index.html" target="_parent">bayesnet/classifiers</a> - KDBLd.cc<span style="font-size: 80%;"> (<a href="KDBLd.cc.gcov.html">source</a> / functions)</span></td>
<td width="5%"></td>
<td width="5%"></td>
<td width="5%" class="headerCovTableHead">Coverage</td>
<td width="5%" class="headerCovTableHead" title="Covered + Uncovered code">Total</td>
<td width="5%" class="headerCovTableHead" title="Exercised code only">Hit</td>
</tr>
<tr>
<td class="headerItem">Test:</td>
<td class="headerValue">BayesNet Coverage Report</td>
<td></td>
<td class="headerItem">Lines:</td>
<td class="headerCovTableEntryHi">100.0&nbsp;%</td>
<td class="headerCovTableEntry">17</td>
<td class="headerCovTableEntry">17</td>
</tr>
<tr>
<td class="headerItem">Test Date:</td>
<td class="headerValue">2024-05-06 17:54:04</td>
<td></td>
<td class="headerItem">Functions:</td>
<td class="headerCovTableEntryHi">100.0&nbsp;%</td>
<td class="headerCovTableEntry">4</td>
<td class="headerCovTableEntry">4</td>
</tr>
<tr>
<td class="headerItem">Legend:</td>
<td class="headerValueLeg"> Lines:
<span class="coverLegendCov">hit</span>
<span class="coverLegendNoCov">not hit</span>
</td>
<td></td>
</tr>
<tr><td><img src="../../glass.png" width=3 height=3 alt=""></td></tr>
</table>
</td>
</tr>
<tr><td class="ruler"><img src="../../glass.png" width=3 height=3 alt=""></td></tr>
</table>
<center>
<table cellpadding=1 cellspacing=1 border=0>
<tr><td><br></td></tr>
<tr>
<td class="tableHead">Function Name <span title="Click to sort table by function name" class="tableHeadSort"><img src="../../glass.png" width=10 height=14 alt="Sort by function name" title="Click to sort table by function name" border=0></span></td>
<td class="tableHead">Hit count <span title="Click to sort table by function hit count" class="tableHeadSort"><a href="KDBLd.cc.func-c.html"><img src="../../updown.png" width=10 height=14 alt="Sort by function hit count" title="Click to sort table by function hit count" border=0></a></span></td>
</tr>
<tr>
<td class="coverFn"><a href="KDBLd.cc.gcov.html#L8">bayesnet::KDBLd::KDBLd(int)</a></td>
<td class="coverFnHi">68</td>
</tr>
<tr>
<td class="coverFn"><a href="KDBLd.cc.gcov.html#L9">bayesnet::KDBLd::fit(at::Tensor&amp;, at::Tensor&amp;, std::vector&lt;std::__cxx11::basic_string&lt;char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt;, std::allocator&lt;std::__cxx11::basic_string&lt;char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt; &gt; &gt; const&amp;, std::__cxx11::basic_string&lt;char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt; const&amp;, std::map&lt;std::__cxx11::basic_string&lt;char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt;, std::vector&lt;int, std::allocator&lt;int&gt; &gt;, std::less&lt;std::__cxx11::basic_string&lt;char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt; &gt;, std::allocator&lt;std::pair&lt;std::__cxx11::basic_string&lt;char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt; const, std::vector&lt;int, std::allocator&lt;int&gt; &gt; &gt; &gt; &gt;&amp;)</a></td>
<td class="coverFnHi">20</td>
</tr>
<tr>
<td class="coverFn"><a href="KDBLd.cc.gcov.html#L29">bayesnet::KDBLd::graph(std::__cxx11::basic_string&lt;char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt; const&amp;) const</a></td>
<td class="coverFnHi">4</td>
</tr>
<tr>
<td class="coverFn"><a href="KDBLd.cc.gcov.html#L24">bayesnet::KDBLd::predict(at::Tensor&amp;)</a></td>
<td class="coverFnHi">16</td>
</tr>
</table>
<br>
</center>
<table width="100%" border=0 cellspacing=0 cellpadding=0>
<tr><td class="ruler"><img src="../../glass.png" width=3 height=3 alt=""></td></tr>
<tr><td class="versionInfo">Generated by: <a href="https://github.com//linux-test-project/lcov" target="_parent">LCOV version 2.0-1</a></td></tr>
</table>
<br>
</body>
</html>

View File

@ -1,19 +0,0 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN">
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>LCOV - BayesNet Coverage Report - bayesnet/classifiers/KDBLd.cc</title>
<link rel="stylesheet" type="text/css" href="../../gcov.css">
</head>
<frameset cols="120,*">
<frame src="KDBLd.cc.gcov.overview.html" name="overview">
<frame src="KDBLd.cc.gcov.html" name="source">
<noframes>
<center>Frames not supported by your browser!<br></center>
</noframes>
</frameset>
</html>

View File

@ -1,119 +0,0 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>LCOV - BayesNet Coverage Report - bayesnet/classifiers/KDBLd.cc</title>
<link rel="stylesheet" type="text/css" href="../../gcov.css">
</head>
<body>
<table width="100%" border=0 cellspacing=0 cellpadding=0>
<tr><td class="title">LCOV - code coverage report</td></tr>
<tr><td class="ruler"><img src="../../glass.png" width=3 height=3 alt=""></td></tr>
<tr>
<td width="100%">
<table cellpadding=1 border=0 width="100%">
<tr>
<td width="10%" class="headerItem">Current view:</td>
<td width="10%" class="headerValue"><a href="../../index.html" target="_parent">top level</a> - <a href="index.html" target="_parent">bayesnet/classifiers</a> - KDBLd.cc<span style="font-size: 80%;"> (source / <a href="KDBLd.cc.func-c.html">functions</a>)</span></td>
<td width="5%"></td>
<td width="5%"></td>
<td width="5%" class="headerCovTableHead">Coverage</td>
<td width="5%" class="headerCovTableHead" title="Covered + Uncovered code">Total</td>
<td width="5%" class="headerCovTableHead" title="Exercised code only">Hit</td>
</tr>
<tr>
<td class="headerItem">Test:</td>
<td class="headerValue">BayesNet Coverage Report</td>
<td></td>
<td class="headerItem">Lines:</td>
<td class="headerCovTableEntryHi">100.0&nbsp;%</td>
<td class="headerCovTableEntry">17</td>
<td class="headerCovTableEntry">17</td>
</tr>
<tr>
<td class="headerItem">Test Date:</td>
<td class="headerValue">2024-05-06 17:54:04</td>
<td></td>
<td class="headerItem">Functions:</td>
<td class="headerCovTableEntryHi">100.0&nbsp;%</td>
<td class="headerCovTableEntry">4</td>
<td class="headerCovTableEntry">4</td>
</tr>
<tr>
<td class="headerItem">Legend:</td>
<td class="headerValueLeg"> Lines:
<span class="coverLegendCov">hit</span>
<span class="coverLegendNoCov">not hit</span>
</td>
<td></td>
</tr>
<tr><td><img src="../../glass.png" width=3 height=3 alt=""></td></tr>
</table>
</td>
</tr>
<tr><td class="ruler"><img src="../../glass.png" width=3 height=3 alt=""></td></tr>
</table>
<table cellpadding=0 cellspacing=0 border=0>
<tr>
<td><br></td>
</tr>
<tr>
<td>
<pre class="sourceHeading"> Line data Source code</pre>
<pre class="source">
<span id="L1"><span class="lineNum"> 1</span> : // ***************************************************************</span>
<span id="L2"><span class="lineNum"> 2</span> : // SPDX-FileCopyrightText: Copyright 2024 Ricardo Montañana Gómez</span>
<span id="L3"><span class="lineNum"> 3</span> : // SPDX-FileType: SOURCE</span>
<span id="L4"><span class="lineNum"> 4</span> : // SPDX-License-Identifier: MIT</span>
<span id="L5"><span class="lineNum"> 5</span> : // ***************************************************************</span>
<span id="L6"><span class="lineNum"> 6</span> : </span>
<span id="L7"><span class="lineNum"> 7</span> : #include &quot;KDBLd.h&quot;</span>
<span id="L8"><span class="lineNum"> 8</span> : </span>
<span id="L9"><span class="lineNum"> 9</span> : namespace bayesnet {</span>
<span id="L10"><span class="lineNum"> 10</span> <span class="tlaGNC tlaBgGNC"> 68 : KDBLd::KDBLd(int k) : KDB(k), Proposal(dataset, features, className) {}</span></span>
<span id="L11"><span class="lineNum"> 11</span> <span class="tlaGNC"> 20 : KDBLd&amp; KDBLd::fit(torch::Tensor&amp; X_, torch::Tensor&amp; y_, const std::vector&lt;std::string&gt;&amp; features_, const std::string&amp; className_, map&lt;std::string, std::vector&lt;int&gt;&gt;&amp; states_)</span></span>
<span id="L12"><span class="lineNum"> 12</span> : {</span>
<span id="L13"><span class="lineNum"> 13</span> <span class="tlaGNC"> 20 : checkInput(X_, y_);</span></span>
<span id="L14"><span class="lineNum"> 14</span> <span class="tlaGNC"> 20 : features = features_;</span></span>
<span id="L15"><span class="lineNum"> 15</span> <span class="tlaGNC"> 20 : className = className_;</span></span>
<span id="L16"><span class="lineNum"> 16</span> <span class="tlaGNC"> 20 : Xf = X_;</span></span>
<span id="L17"><span class="lineNum"> 17</span> <span class="tlaGNC"> 20 : y = y_;</span></span>
<span id="L18"><span class="lineNum"> 18</span> : // Fills std::vectors Xv &amp; yv with the data from tensors X_ (discretized) &amp; y</span>
<span id="L19"><span class="lineNum"> 19</span> <span class="tlaGNC"> 20 : states = fit_local_discretization(y);</span></span>
<span id="L20"><span class="lineNum"> 20</span> : // We have discretized the input data</span>
<span id="L21"><span class="lineNum"> 21</span> : // 1st we need to fit the model to build the normal KDB structure, KDB::fit initializes the base Bayesian network</span>
<span id="L22"><span class="lineNum"> 22</span> <span class="tlaGNC"> 20 : KDB::fit(dataset, features, className, states);</span></span>
<span id="L23"><span class="lineNum"> 23</span> <span class="tlaGNC"> 20 : states = localDiscretizationProposal(states, model);</span></span>
<span id="L24"><span class="lineNum"> 24</span> <span class="tlaGNC"> 20 : return *this;</span></span>
<span id="L25"><span class="lineNum"> 25</span> : }</span>
<span id="L26"><span class="lineNum"> 26</span> <span class="tlaGNC"> 16 : torch::Tensor KDBLd::predict(torch::Tensor&amp; X)</span></span>
<span id="L27"><span class="lineNum"> 27</span> : {</span>
<span id="L28"><span class="lineNum"> 28</span> <span class="tlaGNC"> 16 : auto Xt = prepareX(X);</span></span>
<span id="L29"><span class="lineNum"> 29</span> <span class="tlaGNC"> 32 : return KDB::predict(Xt);</span></span>
<span id="L30"><span class="lineNum"> 30</span> <span class="tlaGNC"> 16 : }</span></span>
<span id="L31"><span class="lineNum"> 31</span> <span class="tlaGNC"> 4 : std::vector&lt;std::string&gt; KDBLd::graph(const std::string&amp; name) const</span></span>
<span id="L32"><span class="lineNum"> 32</span> : {</span>
<span id="L33"><span class="lineNum"> 33</span> <span class="tlaGNC"> 4 : return KDB::graph(name);</span></span>
<span id="L34"><span class="lineNum"> 34</span> : }</span>
<span id="L35"><span class="lineNum"> 35</span> : }</span>
</pre>
</td>
</tr>
</table>
<br>
<table width="100%" border=0 cellspacing=0 cellpadding=0>
<tr><td class="ruler"><img src="../../glass.png" width=3 height=3 alt=""></td></tr>
<tr><td class="versionInfo">Generated by: <a href="https://github.com//linux-test-project/lcov" target="_parent">LCOV version 2.0-1</a></td></tr>
</table>
<br>
</body>
</html>

View File

@ -1,29 +0,0 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html lang="en">
<head>
<title>LCOV - BayesNet Coverage Report - bayesnet/classifiers/KDBLd.cc</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" type="text/css" href="../../gcov.css">
</head>
<body>
<map name="overview">
<area shape="rect" coords="0,0,79,3" href="KDBLd.cc.gcov.html#L1" target="source" alt="overview">
<area shape="rect" coords="0,4,79,7" href="KDBLd.cc.gcov.html#L1" target="source" alt="overview">
<area shape="rect" coords="0,8,79,11" href="KDBLd.cc.gcov.html#L1" target="source" alt="overview">
<area shape="rect" coords="0,12,79,15" href="KDBLd.cc.gcov.html#L1" target="source" alt="overview">
<area shape="rect" coords="0,16,79,19" href="KDBLd.cc.gcov.html#L5" target="source" alt="overview">
<area shape="rect" coords="0,20,79,23" href="KDBLd.cc.gcov.html#L9" target="source" alt="overview">
<area shape="rect" coords="0,24,79,27" href="KDBLd.cc.gcov.html#L13" target="source" alt="overview">
<area shape="rect" coords="0,28,79,31" href="KDBLd.cc.gcov.html#L17" target="source" alt="overview">
<area shape="rect" coords="0,32,79,35" href="KDBLd.cc.gcov.html#L21" target="source" alt="overview">
</map>
<center>
<a href="KDBLd.cc.gcov.html#top" target="source">Top</a><br><br>
<img src="KDBLd.cc.gcov.png" width=80 height=34 alt="Overview" border=0 usemap="#overview">
</center>
</body>
</html>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 333 B

View File

@ -1,90 +0,0 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>LCOV - BayesNet Coverage Report - bayesnet/classifiers/KDBLd.h - functions</title>
<link rel="stylesheet" type="text/css" href="../../gcov.css">
</head>
<body>
<table width="100%" border=0 cellspacing=0 cellpadding=0>
<tr><td class="title">LCOV - code coverage report</td></tr>
<tr><td class="ruler"><img src="../../glass.png" width=3 height=3 alt=""></td></tr>
<tr>
<td width="100%">
<table cellpadding=1 border=0 width="100%">
<tr>
<td width="10%" class="headerItem">Current view:</td>
<td width="10%" class="headerValue"><a href="../../index.html" target="_parent">top level</a> - <a href="index.html" target="_parent">bayesnet/classifiers</a> - KDBLd.h<span style="font-size: 80%;"> (<a href="KDBLd.h.gcov.html">source</a> / functions)</span></td>
<td width="5%"></td>
<td width="5%"></td>
<td width="5%" class="headerCovTableHead">Coverage</td>
<td width="5%" class="headerCovTableHead" title="Covered + Uncovered code">Total</td>
<td width="5%" class="headerCovTableHead" title="Exercised code only">Hit</td>
</tr>
<tr>
<td class="headerItem">Test:</td>
<td class="headerValue">BayesNet Coverage Report</td>
<td></td>
<td class="headerItem">Lines:</td>
<td class="headerCovTableEntryHi">100.0&nbsp;%</td>
<td class="headerCovTableEntry">1</td>
<td class="headerCovTableEntry">1</td>
</tr>
<tr>
<td class="headerItem">Test Date:</td>
<td class="headerValue">2024-05-06 17:54:04</td>
<td></td>
<td class="headerItem">Functions:</td>
<td class="headerCovTableEntryHi">100.0&nbsp;%</td>
<td class="headerCovTableEntry">1</td>
<td class="headerCovTableEntry">1</td>
</tr>
<tr>
<td class="headerItem">Legend:</td>
<td class="headerValueLeg"> Lines:
<span class="coverLegendCov">hit</span>
<span class="coverLegendNoCov">not hit</span>
</td>
<td></td>
</tr>
<tr><td><img src="../../glass.png" width=3 height=3 alt=""></td></tr>
</table>
</td>
</tr>
<tr><td class="ruler"><img src="../../glass.png" width=3 height=3 alt=""></td></tr>
</table>
<center>
<table cellpadding=1 cellspacing=1 border=0>
<tr><td><br></td></tr>
<tr>
<td class="tableHead">Function Name <span title="Click to sort table by function name" class="tableHeadSort"><a href="KDBLd.h.func.html"><img src="../../updown.png" width=10 height=14 alt="Sort by function name" title="Click to sort table by function name" border=0></a></span></td>
<td class="tableHead">Hit count <span title="Click to sort table by function hit count" class="tableHeadSort"><img src="../../glass.png" width=10 height=14 alt="Sort by function hit count" title="Click to sort table by function hit count" border=0></span></td>
</tr>
<tr>
<td class="coverFn"><a href="KDBLd.h.gcov.html#L15">bayesnet::KDBLd::~KDBLd()</a></td>
<td class="coverFnHi">20</td>
</tr>
</table>
<br>
</center>
<table width="100%" border=0 cellspacing=0 cellpadding=0>
<tr><td class="ruler"><img src="../../glass.png" width=3 height=3 alt=""></td></tr>
<tr><td class="versionInfo">Generated by: <a href="https://github.com//linux-test-project/lcov" target="_parent">LCOV version 2.0-1</a></td></tr>
</table>
<br>
</body>
</html>

View File

@ -1,90 +0,0 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>LCOV - BayesNet Coverage Report - bayesnet/classifiers/KDBLd.h - functions</title>
<link rel="stylesheet" type="text/css" href="../../gcov.css">
</head>
<body>
<table width="100%" border=0 cellspacing=0 cellpadding=0>
<tr><td class="title">LCOV - code coverage report</td></tr>
<tr><td class="ruler"><img src="../../glass.png" width=3 height=3 alt=""></td></tr>
<tr>
<td width="100%">
<table cellpadding=1 border=0 width="100%">
<tr>
<td width="10%" class="headerItem">Current view:</td>
<td width="10%" class="headerValue"><a href="../../index.html" target="_parent">top level</a> - <a href="index.html" target="_parent">bayesnet/classifiers</a> - KDBLd.h<span style="font-size: 80%;"> (<a href="KDBLd.h.gcov.html">source</a> / functions)</span></td>
<td width="5%"></td>
<td width="5%"></td>
<td width="5%" class="headerCovTableHead">Coverage</td>
<td width="5%" class="headerCovTableHead" title="Covered + Uncovered code">Total</td>
<td width="5%" class="headerCovTableHead" title="Exercised code only">Hit</td>
</tr>
<tr>
<td class="headerItem">Test:</td>
<td class="headerValue">BayesNet Coverage Report</td>
<td></td>
<td class="headerItem">Lines:</td>
<td class="headerCovTableEntryHi">100.0&nbsp;%</td>
<td class="headerCovTableEntry">1</td>
<td class="headerCovTableEntry">1</td>
</tr>
<tr>
<td class="headerItem">Test Date:</td>
<td class="headerValue">2024-05-06 17:54:04</td>
<td></td>
<td class="headerItem">Functions:</td>
<td class="headerCovTableEntryHi">100.0&nbsp;%</td>
<td class="headerCovTableEntry">1</td>
<td class="headerCovTableEntry">1</td>
</tr>
<tr>
<td class="headerItem">Legend:</td>
<td class="headerValueLeg"> Lines:
<span class="coverLegendCov">hit</span>
<span class="coverLegendNoCov">not hit</span>
</td>
<td></td>
</tr>
<tr><td><img src="../../glass.png" width=3 height=3 alt=""></td></tr>
</table>
</td>
</tr>
<tr><td class="ruler"><img src="../../glass.png" width=3 height=3 alt=""></td></tr>
</table>
<center>
<table cellpadding=1 cellspacing=1 border=0>
<tr><td><br></td></tr>
<tr>
<td class="tableHead">Function Name <span title="Click to sort table by function name" class="tableHeadSort"><img src="../../glass.png" width=10 height=14 alt="Sort by function name" title="Click to sort table by function name" border=0></span></td>
<td class="tableHead">Hit count <span title="Click to sort table by function hit count" class="tableHeadSort"><a href="KDBLd.h.func-c.html"><img src="../../updown.png" width=10 height=14 alt="Sort by function hit count" title="Click to sort table by function hit count" border=0></a></span></td>
</tr>
<tr>
<td class="coverFn"><a href="KDBLd.h.gcov.html#L15">bayesnet::KDBLd::~KDBLd()</a></td>
<td class="coverFnHi">20</td>
</tr>
</table>
<br>
</center>
<table width="100%" border=0 cellspacing=0 cellpadding=0>
<tr><td class="ruler"><img src="../../glass.png" width=3 height=3 alt=""></td></tr>
<tr><td class="versionInfo">Generated by: <a href="https://github.com//linux-test-project/lcov" target="_parent">LCOV version 2.0-1</a></td></tr>
</table>
<br>
</body>
</html>

View File

@ -1,19 +0,0 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN">
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>LCOV - BayesNet Coverage Report - bayesnet/classifiers/KDBLd.h</title>
<link rel="stylesheet" type="text/css" href="../../gcov.css">
</head>
<frameset cols="120,*">
<frame src="KDBLd.h.gcov.overview.html" name="overview">
<frame src="KDBLd.h.gcov.html" name="source">
<noframes>
<center>Frames not supported by your browser!<br></center>
</noframes>
</frameset>
</html>

View File

@ -1,108 +0,0 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>LCOV - BayesNet Coverage Report - bayesnet/classifiers/KDBLd.h</title>
<link rel="stylesheet" type="text/css" href="../../gcov.css">
</head>
<body>
<table width="100%" border=0 cellspacing=0 cellpadding=0>
<tr><td class="title">LCOV - code coverage report</td></tr>
<tr><td class="ruler"><img src="../../glass.png" width=3 height=3 alt=""></td></tr>
<tr>
<td width="100%">
<table cellpadding=1 border=0 width="100%">
<tr>
<td width="10%" class="headerItem">Current view:</td>
<td width="10%" class="headerValue"><a href="../../index.html" target="_parent">top level</a> - <a href="index.html" target="_parent">bayesnet/classifiers</a> - KDBLd.h<span style="font-size: 80%;"> (source / <a href="KDBLd.h.func-c.html">functions</a>)</span></td>
<td width="5%"></td>
<td width="5%"></td>
<td width="5%" class="headerCovTableHead">Coverage</td>
<td width="5%" class="headerCovTableHead" title="Covered + Uncovered code">Total</td>
<td width="5%" class="headerCovTableHead" title="Exercised code only">Hit</td>
</tr>
<tr>
<td class="headerItem">Test:</td>
<td class="headerValue">BayesNet Coverage Report</td>
<td></td>
<td class="headerItem">Lines:</td>
<td class="headerCovTableEntryHi">100.0&nbsp;%</td>
<td class="headerCovTableEntry">1</td>
<td class="headerCovTableEntry">1</td>
</tr>
<tr>
<td class="headerItem">Test Date:</td>
<td class="headerValue">2024-05-06 17:54:04</td>
<td></td>
<td class="headerItem">Functions:</td>
<td class="headerCovTableEntryHi">100.0&nbsp;%</td>
<td class="headerCovTableEntry">1</td>
<td class="headerCovTableEntry">1</td>
</tr>
<tr>
<td class="headerItem">Legend:</td>
<td class="headerValueLeg"> Lines:
<span class="coverLegendCov">hit</span>
<span class="coverLegendNoCov">not hit</span>
</td>
<td></td>
</tr>
<tr><td><img src="../../glass.png" width=3 height=3 alt=""></td></tr>
</table>
</td>
</tr>
<tr><td class="ruler"><img src="../../glass.png" width=3 height=3 alt=""></td></tr>
</table>
<table cellpadding=0 cellspacing=0 border=0>
<tr>
<td><br></td>
</tr>
<tr>
<td>
<pre class="sourceHeading"> Line data Source code</pre>
<pre class="source">
<span id="L1"><span class="lineNum"> 1</span> : // ***************************************************************</span>
<span id="L2"><span class="lineNum"> 2</span> : // SPDX-FileCopyrightText: Copyright 2024 Ricardo Montañana Gómez</span>
<span id="L3"><span class="lineNum"> 3</span> : // SPDX-FileType: SOURCE</span>
<span id="L4"><span class="lineNum"> 4</span> : // SPDX-License-Identifier: MIT</span>
<span id="L5"><span class="lineNum"> 5</span> : // ***************************************************************</span>
<span id="L6"><span class="lineNum"> 6</span> : </span>
<span id="L7"><span class="lineNum"> 7</span> : #ifndef KDBLD_H</span>
<span id="L8"><span class="lineNum"> 8</span> : #define KDBLD_H</span>
<span id="L9"><span class="lineNum"> 9</span> : #include &quot;Proposal.h&quot;</span>
<span id="L10"><span class="lineNum"> 10</span> : #include &quot;KDB.h&quot;</span>
<span id="L11"><span class="lineNum"> 11</span> : </span>
<span id="L12"><span class="lineNum"> 12</span> : namespace bayesnet {</span>
<span id="L13"><span class="lineNum"> 13</span> : class KDBLd : public KDB, public Proposal {</span>
<span id="L14"><span class="lineNum"> 14</span> : private:</span>
<span id="L15"><span class="lineNum"> 15</span> : public:</span>
<span id="L16"><span class="lineNum"> 16</span> : explicit KDBLd(int k);</span>
<span id="L17"><span class="lineNum"> 17</span> <span class="tlaGNC tlaBgGNC"> 20 : virtual ~KDBLd() = default;</span></span>
<span id="L18"><span class="lineNum"> 18</span> : KDBLd&amp; fit(torch::Tensor&amp; X, torch::Tensor&amp; y, const std::vector&lt;std::string&gt;&amp; features, const std::string&amp; className, map&lt;std::string, std::vector&lt;int&gt;&gt;&amp; states) override;</span>
<span id="L19"><span class="lineNum"> 19</span> : std::vector&lt;std::string&gt; graph(const std::string&amp; name = &quot;KDB&quot;) const override;</span>
<span id="L20"><span class="lineNum"> 20</span> : torch::Tensor predict(torch::Tensor&amp; X) override;</span>
<span id="L21"><span class="lineNum"> 21</span> : static inline std::string version() { return &quot;0.0.1&quot;; };</span>
<span id="L22"><span class="lineNum"> 22</span> : };</span>
<span id="L23"><span class="lineNum"> 23</span> : }</span>
<span id="L24"><span class="lineNum"> 24</span> : #endif // !KDBLD_H</span>
</pre>
</td>
</tr>
</table>
<br>
<table width="100%" border=0 cellspacing=0 cellpadding=0>
<tr><td class="ruler"><img src="../../glass.png" width=3 height=3 alt=""></td></tr>
<tr><td class="versionInfo">Generated by: <a href="https://github.com//linux-test-project/lcov" target="_parent">LCOV version 2.0-1</a></td></tr>
</table>
<br>
</body>
</html>

View File

@ -1,26 +0,0 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html lang="en">
<head>
<title>LCOV - BayesNet Coverage Report - bayesnet/classifiers/KDBLd.h</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" type="text/css" href="../../gcov.css">
</head>
<body>
<map name="overview">
<area shape="rect" coords="0,0,79,3" href="KDBLd.h.gcov.html#L1" target="source" alt="overview">
<area shape="rect" coords="0,4,79,7" href="KDBLd.h.gcov.html#L1" target="source" alt="overview">
<area shape="rect" coords="0,8,79,11" href="KDBLd.h.gcov.html#L1" target="source" alt="overview">
<area shape="rect" coords="0,12,79,15" href="KDBLd.h.gcov.html#L1" target="source" alt="overview">
<area shape="rect" coords="0,16,79,19" href="KDBLd.h.gcov.html#L5" target="source" alt="overview">
<area shape="rect" coords="0,20,79,23" href="KDBLd.h.gcov.html#L9" target="source" alt="overview">
</map>
<center>
<a href="KDBLd.h.gcov.html#top" target="source">Top</a><br><br>
<img src="KDBLd.h.gcov.png" width=80 height=23 alt="Overview" border=0 usemap="#overview">
</center>
</body>
</html>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 265 B

View File

@ -1,139 +0,0 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>LCOV - BayesNet Coverage Report - bayesnet/classifiers/Proposal.cc - functions</title>
<link rel="stylesheet" type="text/css" href="../../gcov.css">
</head>
<body>
<table width="100%" border=0 cellspacing=0 cellpadding=0>
<tr><td class="title">LCOV - code coverage report</td></tr>
<tr><td class="ruler"><img src="../../glass.png" width=3 height=3 alt=""></td></tr>
<tr>
<td width="100%">
<table cellpadding=1 border=0 width="100%">
<tr>
<td width="10%" class="headerItem">Current view:</td>
<td width="10%" class="headerValue"><a href="../../index.html" target="_parent">top level</a> - <a href="index.html" target="_parent">bayesnet/classifiers</a> - Proposal.cc<span style="font-size: 80%;"> (<a href="Proposal.cc.gcov.html">source</a> / functions)</span></td>
<td width="5%"></td>
<td width="5%"></td>
<td width="5%" class="headerCovTableHead">Coverage</td>
<td width="5%" class="headerCovTableHead" title="Covered + Uncovered code">Total</td>
<td width="5%" class="headerCovTableHead" title="Exercised code only">Hit</td>
</tr>
<tr>
<td class="headerItem">Test:</td>
<td class="headerValue">BayesNet Coverage Report</td>
<td></td>
<td class="headerItem">Lines:</td>
<td class="headerCovTableEntryHi">97.7&nbsp;%</td>
<td class="headerCovTableEntry">86</td>
<td class="headerCovTableEntry">84</td>
</tr>
<tr>
<td class="headerItem">Test Date:</td>
<td class="headerValue">2024-05-06 17:54:04</td>
<td></td>
<td class="headerItem">Functions:</td>
<td class="headerCovTableEntryHi">100.0&nbsp;%</td>
<td class="headerCovTableEntry">8</td>
<td class="headerCovTableEntry">8</td>
</tr>
<tr>
<td class="headerItem">Legend:</td>
<td class="headerValueLeg"> Lines:
<span class="coverLegendCov">hit</span>
<span class="coverLegendNoCov">not hit</span>
</td>
<td></td>
</tr>
<tr><td><img src="../../glass.png" width=3 height=3 alt=""></td></tr>
</table>
</td>
</tr>
<tr><td class="ruler"><img src="../../glass.png" width=3 height=3 alt=""></td></tr>
</table>
<center>
<table cellpadding=1 cellspacing=1 border=0>
<tr><td><br></td></tr>
<tr>
<td class="tableHead">Function Name <span title="Click to sort table by function name" class="tableHeadSort"><a href="Proposal.cc.func.html"><img src="../../updown.png" width=10 height=14 alt="Sort by function name" title="Click to sort table by function name" border=0></a></span></td>
<td class="tableHead">Hit count <span title="Click to sort table by function hit count" class="tableHeadSort"><img src="../../glass.png" width=10 height=14 alt="Sort by function hit count" title="Click to sort table by function hit count" border=0></span></td>
</tr>
<tr>
<td class="coverFn"><a href="Proposal.cc.gcov.html#L104">bayesnet::Proposal::prepareX(at::Tensor&amp;)</a></td>
<td class="coverFnHi">168</td>
</tr>
<tr>
<td class="coverFn"><a href="Proposal.cc.gcov.html#L10">bayesnet::Proposal::~Proposal()</a></td>
<td class="coverFnHi">200</td>
</tr>
<tr>
<td class="coverFn"><a href="Proposal.cc.gcov.html#L25">bayesnet::Proposal::localDiscretizationProposal(std::map&lt;std::__cxx11::basic_string&lt;char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt;, std::vector&lt;int, std::allocator&lt;int&gt; &gt;, std::less&lt;std::__cxx11::basic_string&lt;char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt; &gt;, std::allocator&lt;std::pair&lt;std::__cxx11::basic_string&lt;char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt; const, std::vector&lt;int, std::allocator&lt;int&gt; &gt; &gt; &gt; &gt; const&amp;, bayesnet::Network&amp;)</a></td>
<td class="coverFnHi">212</td>
</tr>
<tr>
<td class="coverFn"><a href="Proposal.cc.gcov.html#L16">bayesnet::Proposal::checkInput(at::Tensor const&amp;, at::Tensor const&amp;)</a></td>
<td class="coverFnHi">228</td>
</tr>
<tr>
<td class="coverFn"><a href="Proposal.cc.gcov.html#L77">bayesnet::Proposal::fit_local_discretization[abi:cxx11](at::Tensor const&amp;)</a></td>
<td class="coverFnHi">232</td>
</tr>
<tr>
<td class="coverFn"><a href="Proposal.cc.gcov.html#L9">bayesnet::Proposal::Proposal(at::Tensor&amp;, std::vector&lt;std::__cxx11::basic_string&lt;char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt;, std::allocator&lt;std::__cxx11::basic_string&lt;char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt; &gt; &gt;&amp;, std::__cxx11::basic_string&lt;char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt;&amp;)</a></td>
<td class="coverFnHi">424</td>
</tr>
<tr>
<td class="coverFn"><a href="Proposal.cc.gcov.html#L47">auto bayesnet::Proposal::localDiscretizationProposal(std::map&lt;std::__cxx11::basic_string&lt;char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt;, std::vector&lt;int, std::allocator&lt;int&gt; &gt;, std::less&lt;std::__cxx11::basic_string&lt;char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt; &gt;, std::allocator&lt;std::pair&lt;std::__cxx11::basic_string&lt;char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt; const, std::vector&lt;int, std::allocator&lt;int&gt; &gt; &gt; &gt; &gt; const&amp;, bayesnet::Network&amp;)::{lambda(auto:1 const&amp;)#2}::operator()&lt;std::__cxx11::basic_string&lt;char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt; &gt;(std::__cxx11::basic_string&lt;char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt; const&amp;) const</a></td>
<td class="coverFnHi">1372</td>
</tr>
<tr>
<td class="coverFn"><a href="Proposal.cc.gcov.html#L41">auto bayesnet::Proposal::localDiscretizationProposal(std::map&lt;std::__cxx11::basic_string&lt;char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt;, std::vector&lt;int, std::allocator&lt;int&gt; &gt;, std::less&lt;std::__cxx11::basic_string&lt;char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt; &gt;, std::allocator&lt;std::pair&lt;std::__cxx11::basic_string&lt;char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt; const, std::vector&lt;int, std::allocator&lt;int&gt; &gt; &gt; &gt; &gt; const&amp;, bayesnet::Network&amp;)::{lambda(auto:1 const&amp;)#1}::operator()&lt;bayesnet::Node*&gt;(bayesnet::Node* const&amp;) const</a></td>
<td class="coverFnHi">2696</td>
</tr>
</table>
<br>
</center>
<table width="100%" border=0 cellspacing=0 cellpadding=0>
<tr><td class="ruler"><img src="../../glass.png" width=3 height=3 alt=""></td></tr>
<tr><td class="versionInfo">Generated by: <a href="https://github.com//linux-test-project/lcov" target="_parent">LCOV version 2.0-1</a></td></tr>
</table>
<br>
</body>
</html>

View File

@ -1,139 +0,0 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>LCOV - BayesNet Coverage Report - bayesnet/classifiers/Proposal.cc - functions</title>
<link rel="stylesheet" type="text/css" href="../../gcov.css">
</head>
<body>
<table width="100%" border=0 cellspacing=0 cellpadding=0>
<tr><td class="title">LCOV - code coverage report</td></tr>
<tr><td class="ruler"><img src="../../glass.png" width=3 height=3 alt=""></td></tr>
<tr>
<td width="100%">
<table cellpadding=1 border=0 width="100%">
<tr>
<td width="10%" class="headerItem">Current view:</td>
<td width="10%" class="headerValue"><a href="../../index.html" target="_parent">top level</a> - <a href="index.html" target="_parent">bayesnet/classifiers</a> - Proposal.cc<span style="font-size: 80%;"> (<a href="Proposal.cc.gcov.html">source</a> / functions)</span></td>
<td width="5%"></td>
<td width="5%"></td>
<td width="5%" class="headerCovTableHead">Coverage</td>
<td width="5%" class="headerCovTableHead" title="Covered + Uncovered code">Total</td>
<td width="5%" class="headerCovTableHead" title="Exercised code only">Hit</td>
</tr>
<tr>
<td class="headerItem">Test:</td>
<td class="headerValue">BayesNet Coverage Report</td>
<td></td>
<td class="headerItem">Lines:</td>
<td class="headerCovTableEntryHi">97.7&nbsp;%</td>
<td class="headerCovTableEntry">86</td>
<td class="headerCovTableEntry">84</td>
</tr>
<tr>
<td class="headerItem">Test Date:</td>
<td class="headerValue">2024-05-06 17:54:04</td>
<td></td>
<td class="headerItem">Functions:</td>
<td class="headerCovTableEntryHi">100.0&nbsp;%</td>
<td class="headerCovTableEntry">8</td>
<td class="headerCovTableEntry">8</td>
</tr>
<tr>
<td class="headerItem">Legend:</td>
<td class="headerValueLeg"> Lines:
<span class="coverLegendCov">hit</span>
<span class="coverLegendNoCov">not hit</span>
</td>
<td></td>
</tr>
<tr><td><img src="../../glass.png" width=3 height=3 alt=""></td></tr>
</table>
</td>
</tr>
<tr><td class="ruler"><img src="../../glass.png" width=3 height=3 alt=""></td></tr>
</table>
<center>
<table cellpadding=1 cellspacing=1 border=0>
<tr><td><br></td></tr>
<tr>
<td class="tableHead">Function Name <span title="Click to sort table by function name" class="tableHeadSort"><img src="../../glass.png" width=10 height=14 alt="Sort by function name" title="Click to sort table by function name" border=0></span></td>
<td class="tableHead">Hit count <span title="Click to sort table by function hit count" class="tableHeadSort"><a href="Proposal.cc.func-c.html"><img src="../../updown.png" width=10 height=14 alt="Sort by function hit count" title="Click to sort table by function hit count" border=0></a></span></td>
</tr>
<tr>
<td class="coverFn"><a href="Proposal.cc.gcov.html#L41">auto bayesnet::Proposal::localDiscretizationProposal(std::map&lt;std::__cxx11::basic_string&lt;char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt;, std::vector&lt;int, std::allocator&lt;int&gt; &gt;, std::less&lt;std::__cxx11::basic_string&lt;char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt; &gt;, std::allocator&lt;std::pair&lt;std::__cxx11::basic_string&lt;char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt; const, std::vector&lt;int, std::allocator&lt;int&gt; &gt; &gt; &gt; &gt; const&amp;, bayesnet::Network&amp;)::{lambda(auto:1 const&amp;)#1}::operator()&lt;bayesnet::Node*&gt;(bayesnet::Node* const&amp;) const</a></td>
<td class="coverFnHi">2696</td>
</tr>
<tr>
<td class="coverFn"><a href="Proposal.cc.gcov.html#L47">auto bayesnet::Proposal::localDiscretizationProposal(std::map&lt;std::__cxx11::basic_string&lt;char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt;, std::vector&lt;int, std::allocator&lt;int&gt; &gt;, std::less&lt;std::__cxx11::basic_string&lt;char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt; &gt;, std::allocator&lt;std::pair&lt;std::__cxx11::basic_string&lt;char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt; const, std::vector&lt;int, std::allocator&lt;int&gt; &gt; &gt; &gt; &gt; const&amp;, bayesnet::Network&amp;)::{lambda(auto:1 const&amp;)#2}::operator()&lt;std::__cxx11::basic_string&lt;char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt; &gt;(std::__cxx11::basic_string&lt;char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt; const&amp;) const</a></td>
<td class="coverFnHi">1372</td>
</tr>
<tr>
<td class="coverFn"><a href="Proposal.cc.gcov.html#L9">bayesnet::Proposal::Proposal(at::Tensor&amp;, std::vector&lt;std::__cxx11::basic_string&lt;char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt;, std::allocator&lt;std::__cxx11::basic_string&lt;char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt; &gt; &gt;&amp;, std::__cxx11::basic_string&lt;char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt;&amp;)</a></td>
<td class="coverFnHi">424</td>
</tr>
<tr>
<td class="coverFn"><a href="Proposal.cc.gcov.html#L16">bayesnet::Proposal::checkInput(at::Tensor const&amp;, at::Tensor const&amp;)</a></td>
<td class="coverFnHi">228</td>
</tr>
<tr>
<td class="coverFn"><a href="Proposal.cc.gcov.html#L77">bayesnet::Proposal::fit_local_discretization[abi:cxx11](at::Tensor const&amp;)</a></td>
<td class="coverFnHi">232</td>
</tr>
<tr>
<td class="coverFn"><a href="Proposal.cc.gcov.html#L25">bayesnet::Proposal::localDiscretizationProposal(std::map&lt;std::__cxx11::basic_string&lt;char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt;, std::vector&lt;int, std::allocator&lt;int&gt; &gt;, std::less&lt;std::__cxx11::basic_string&lt;char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt; &gt;, std::allocator&lt;std::pair&lt;std::__cxx11::basic_string&lt;char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt; const, std::vector&lt;int, std::allocator&lt;int&gt; &gt; &gt; &gt; &gt; const&amp;, bayesnet::Network&amp;)</a></td>
<td class="coverFnHi">212</td>
</tr>
<tr>
<td class="coverFn"><a href="Proposal.cc.gcov.html#L104">bayesnet::Proposal::prepareX(at::Tensor&amp;)</a></td>
<td class="coverFnHi">168</td>
</tr>
<tr>
<td class="coverFn"><a href="Proposal.cc.gcov.html#L10">bayesnet::Proposal::~Proposal()</a></td>
<td class="coverFnHi">200</td>
</tr>
</table>
<br>
</center>
<table width="100%" border=0 cellspacing=0 cellpadding=0>
<tr><td class="ruler"><img src="../../glass.png" width=3 height=3 alt=""></td></tr>
<tr><td class="versionInfo">Generated by: <a href="https://github.com//linux-test-project/lcov" target="_parent">LCOV version 2.0-1</a></td></tr>
</table>
<br>
</body>
</html>

View File

@ -1,19 +0,0 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN">
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>LCOV - BayesNet Coverage Report - bayesnet/classifiers/Proposal.cc</title>
<link rel="stylesheet" type="text/css" href="../../gcov.css">
</head>
<frameset cols="120,*">
<frame src="Proposal.cc.gcov.overview.html" name="overview">
<frame src="Proposal.cc.gcov.html" name="source">
<noframes>
<center>Frames not supported by your browser!<br></center>
</noframes>
</frameset>
</html>

View File

@ -1,200 +0,0 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>LCOV - BayesNet Coverage Report - bayesnet/classifiers/Proposal.cc</title>
<link rel="stylesheet" type="text/css" href="../../gcov.css">
</head>
<body>
<table width="100%" border=0 cellspacing=0 cellpadding=0>
<tr><td class="title">LCOV - code coverage report</td></tr>
<tr><td class="ruler"><img src="../../glass.png" width=3 height=3 alt=""></td></tr>
<tr>
<td width="100%">
<table cellpadding=1 border=0 width="100%">
<tr>
<td width="10%" class="headerItem">Current view:</td>
<td width="10%" class="headerValue"><a href="../../index.html" target="_parent">top level</a> - <a href="index.html" target="_parent">bayesnet/classifiers</a> - Proposal.cc<span style="font-size: 80%;"> (source / <a href="Proposal.cc.func-c.html">functions</a>)</span></td>
<td width="5%"></td>
<td width="5%"></td>
<td width="5%" class="headerCovTableHead">Coverage</td>
<td width="5%" class="headerCovTableHead" title="Covered + Uncovered code">Total</td>
<td width="5%" class="headerCovTableHead" title="Exercised code only">Hit</td>
</tr>
<tr>
<td class="headerItem">Test:</td>
<td class="headerValue">BayesNet Coverage Report</td>
<td></td>
<td class="headerItem">Lines:</td>
<td class="headerCovTableEntryHi">97.7&nbsp;%</td>
<td class="headerCovTableEntry">86</td>
<td class="headerCovTableEntry">84</td>
</tr>
<tr>
<td class="headerItem">Test Date:</td>
<td class="headerValue">2024-05-06 17:54:04</td>
<td></td>
<td class="headerItem">Functions:</td>
<td class="headerCovTableEntryHi">100.0&nbsp;%</td>
<td class="headerCovTableEntry">8</td>
<td class="headerCovTableEntry">8</td>
</tr>
<tr>
<td class="headerItem">Legend:</td>
<td class="headerValueLeg"> Lines:
<span class="coverLegendCov">hit</span>
<span class="coverLegendNoCov">not hit</span>
</td>
<td></td>
</tr>
<tr><td><img src="../../glass.png" width=3 height=3 alt=""></td></tr>
</table>
</td>
</tr>
<tr><td class="ruler"><img src="../../glass.png" width=3 height=3 alt=""></td></tr>
</table>
<table cellpadding=0 cellspacing=0 border=0>
<tr>
<td><br></td>
</tr>
<tr>
<td>
<pre class="sourceHeading"> Line data Source code</pre>
<pre class="source">
<span id="L1"><span class="lineNum"> 1</span> : // ***************************************************************</span>
<span id="L2"><span class="lineNum"> 2</span> : // SPDX-FileCopyrightText: Copyright 2024 Ricardo Montañana Gómez</span>
<span id="L3"><span class="lineNum"> 3</span> : // SPDX-FileType: SOURCE</span>
<span id="L4"><span class="lineNum"> 4</span> : // SPDX-License-Identifier: MIT</span>
<span id="L5"><span class="lineNum"> 5</span> : // ***************************************************************</span>
<span id="L6"><span class="lineNum"> 6</span> : </span>
<span id="L7"><span class="lineNum"> 7</span> : #include &lt;ArffFiles.h&gt;</span>
<span id="L8"><span class="lineNum"> 8</span> : #include &quot;Proposal.h&quot;</span>
<span id="L9"><span class="lineNum"> 9</span> : </span>
<span id="L10"><span class="lineNum"> 10</span> : namespace bayesnet {</span>
<span id="L11"><span class="lineNum"> 11</span> <span class="tlaGNC tlaBgGNC"> 424 : Proposal::Proposal(torch::Tensor&amp; dataset_, std::vector&lt;std::string&gt;&amp; features_, std::string&amp; className_) : pDataset(dataset_), pFeatures(features_), pClassName(className_) {}</span></span>
<span id="L12"><span class="lineNum"> 12</span> <span class="tlaGNC"> 200 : Proposal::~Proposal()</span></span>
<span id="L13"><span class="lineNum"> 13</span> : {</span>
<span id="L14"><span class="lineNum"> 14</span> <span class="tlaGNC"> 1896 : for (auto&amp; [key, value] : discretizers) {</span></span>
<span id="L15"><span class="lineNum"> 15</span> <span class="tlaGNC"> 1696 : delete value;</span></span>
<span id="L16"><span class="lineNum"> 16</span> : }</span>
<span id="L17"><span class="lineNum"> 17</span> <span class="tlaGNC"> 200 : }</span></span>
<span id="L18"><span class="lineNum"> 18</span> <span class="tlaGNC"> 228 : void Proposal::checkInput(const torch::Tensor&amp; X, const torch::Tensor&amp; y)</span></span>
<span id="L19"><span class="lineNum"> 19</span> : {</span>
<span id="L20"><span class="lineNum"> 20</span> <span class="tlaGNC"> 228 : if (!torch::is_floating_point(X)) {</span></span>
<span id="L21"><span class="lineNum"> 21</span> <span class="tlaUNC tlaBgUNC"> 0 : throw std::invalid_argument(&quot;X must be a floating point tensor&quot;);</span></span>
<span id="L22"><span class="lineNum"> 22</span> : }</span>
<span id="L23"><span class="lineNum"> 23</span> <span class="tlaGNC tlaBgGNC"> 228 : if (torch::is_floating_point(y)) {</span></span>
<span id="L24"><span class="lineNum"> 24</span> <span class="tlaUNC tlaBgUNC"> 0 : throw std::invalid_argument(&quot;y must be an integer tensor&quot;);</span></span>
<span id="L25"><span class="lineNum"> 25</span> : }</span>
<span id="L26"><span class="lineNum"> 26</span> <span class="tlaGNC tlaBgGNC"> 228 : }</span></span>
<span id="L27"><span class="lineNum"> 27</span> <span class="tlaGNC"> 212 : map&lt;std::string, std::vector&lt;int&gt;&gt; Proposal::localDiscretizationProposal(const map&lt;std::string, std::vector&lt;int&gt;&gt;&amp; oldStates, Network&amp; model)</span></span>
<span id="L28"><span class="lineNum"> 28</span> : {</span>
<span id="L29"><span class="lineNum"> 29</span> : // order of local discretization is important. no good 0, 1, 2...</span>
<span id="L30"><span class="lineNum"> 30</span> : // although we rediscretize features after the local discretization of every feature</span>
<span id="L31"><span class="lineNum"> 31</span> <span class="tlaGNC"> 212 : auto order = model.topological_sort();</span></span>
<span id="L32"><span class="lineNum"> 32</span> <span class="tlaGNC"> 212 : auto&amp; nodes = model.getNodes();</span></span>
<span id="L33"><span class="lineNum"> 33</span> <span class="tlaGNC"> 212 : map&lt;std::string, std::vector&lt;int&gt;&gt; states = oldStates;</span></span>
<span id="L34"><span class="lineNum"> 34</span> <span class="tlaGNC"> 212 : std::vector&lt;int&gt; indicesToReDiscretize;</span></span>
<span id="L35"><span class="lineNum"> 35</span> <span class="tlaGNC"> 212 : bool upgrade = false; // Flag to check if we need to upgrade the model</span></span>
<span id="L36"><span class="lineNum"> 36</span> <span class="tlaGNC"> 1776 : for (auto feature : order) {</span></span>
<span id="L37"><span class="lineNum"> 37</span> <span class="tlaGNC"> 1564 : auto nodeParents = nodes[feature]-&gt;getParents();</span></span>
<span id="L38"><span class="lineNum"> 38</span> <span class="tlaGNC"> 1564 : if (nodeParents.size() &lt; 2) continue; // Only has class as parent</span></span>
<span id="L39"><span class="lineNum"> 39</span> <span class="tlaGNC"> 1324 : upgrade = true;</span></span>
<span id="L40"><span class="lineNum"> 40</span> <span class="tlaGNC"> 1324 : int index = find(pFeatures.begin(), pFeatures.end(), feature) - pFeatures.begin();</span></span>
<span id="L41"><span class="lineNum"> 41</span> <span class="tlaGNC"> 1324 : indicesToReDiscretize.push_back(index); // We need to re-discretize this feature</span></span>
<span id="L42"><span class="lineNum"> 42</span> <span class="tlaGNC"> 1324 : std::vector&lt;std::string&gt; parents;</span></span>
<span id="L43"><span class="lineNum"> 43</span> <span class="tlaGNC"> 4020 : transform(nodeParents.begin(), nodeParents.end(), back_inserter(parents), [](const auto&amp; p) { return p-&gt;getName(); });</span></span>
<span id="L44"><span class="lineNum"> 44</span> : // Remove class as parent as it will be added later</span>
<span id="L45"><span class="lineNum"> 45</span> <span class="tlaGNC"> 1324 : parents.erase(remove(parents.begin(), parents.end(), pClassName), parents.end());</span></span>
<span id="L46"><span class="lineNum"> 46</span> : // Get the indices of the parents</span>
<span id="L47"><span class="lineNum"> 47</span> <span class="tlaGNC"> 1324 : std::vector&lt;int&gt; indices;</span></span>
<span id="L48"><span class="lineNum"> 48</span> <span class="tlaGNC"> 1324 : indices.push_back(-1); // Add class index</span></span>
<span id="L49"><span class="lineNum"> 49</span> <span class="tlaGNC"> 2696 : transform(parents.begin(), parents.end(), back_inserter(indices), [&amp;](const auto&amp; p) {return find(pFeatures.begin(), pFeatures.end(), p) - pFeatures.begin(); });</span></span>
<span id="L50"><span class="lineNum"> 50</span> : // Now we fit the discretizer of the feature, conditioned on its parents and the class i.e. discretizer.fit(X[index], X[indices] + y)</span>
<span id="L51"><span class="lineNum"> 51</span> <span class="tlaGNC"> 1324 : std::vector&lt;std::string&gt; yJoinParents(Xf.size(1));</span></span>
<span id="L52"><span class="lineNum"> 52</span> <span class="tlaGNC"> 4020 : for (auto idx : indices) {</span></span>
<span id="L53"><span class="lineNum"> 53</span> <span class="tlaGNC"> 958640 : for (int i = 0; i &lt; Xf.size(1); ++i) {</span></span>
<span id="L54"><span class="lineNum"> 54</span> <span class="tlaGNC"> 2867832 : yJoinParents[i] += to_string(pDataset.index({ idx, i }).item&lt;int&gt;());</span></span>
<span id="L55"><span class="lineNum"> 55</span> : }</span>
<span id="L56"><span class="lineNum"> 56</span> : }</span>
<span id="L57"><span class="lineNum"> 57</span> <span class="tlaGNC"> 1324 : auto arff = ArffFiles();</span></span>
<span id="L58"><span class="lineNum"> 58</span> <span class="tlaGNC"> 1324 : auto yxv = arff.factorize(yJoinParents);</span></span>
<span id="L59"><span class="lineNum"> 59</span> <span class="tlaGNC"> 2648 : auto xvf_ptr = Xf.index({ index }).data_ptr&lt;float&gt;();</span></span>
<span id="L60"><span class="lineNum"> 60</span> <span class="tlaGNC"> 1324 : auto xvf = std::vector&lt;mdlp::precision_t&gt;(xvf_ptr, xvf_ptr + Xf.size(1));</span></span>
<span id="L61"><span class="lineNum"> 61</span> <span class="tlaGNC"> 1324 : discretizers[feature]-&gt;fit(xvf, yxv);</span></span>
<span id="L62"><span class="lineNum"> 62</span> <span class="tlaGNC"> 1804 : }</span></span>
<span id="L63"><span class="lineNum"> 63</span> <span class="tlaGNC"> 212 : if (upgrade) {</span></span>
<span id="L64"><span class="lineNum"> 64</span> : // Discretize again X (only the affected indices) with the new fitted discretizers</span>
<span id="L65"><span class="lineNum"> 65</span> <span class="tlaGNC"> 1536 : for (auto index : indicesToReDiscretize) {</span></span>
<span id="L66"><span class="lineNum"> 66</span> <span class="tlaGNC"> 2648 : auto Xt_ptr = Xf.index({ index }).data_ptr&lt;float&gt;();</span></span>
<span id="L67"><span class="lineNum"> 67</span> <span class="tlaGNC"> 1324 : auto Xt = std::vector&lt;float&gt;(Xt_ptr, Xt_ptr + Xf.size(1));</span></span>
<span id="L68"><span class="lineNum"> 68</span> <span class="tlaGNC"> 5296 : pDataset.index_put_({ index, &quot;...&quot; }, torch::tensor(discretizers[pFeatures[index]]-&gt;transform(Xt)));</span></span>
<span id="L69"><span class="lineNum"> 69</span> <span class="tlaGNC"> 1324 : auto xStates = std::vector&lt;int&gt;(discretizers[pFeatures[index]]-&gt;getCutPoints().size() + 1);</span></span>
<span id="L70"><span class="lineNum"> 70</span> <span class="tlaGNC"> 1324 : iota(xStates.begin(), xStates.end(), 0);</span></span>
<span id="L71"><span class="lineNum"> 71</span> : //Update new states of the feature/node</span>
<span id="L72"><span class="lineNum"> 72</span> <span class="tlaGNC"> 1324 : states[pFeatures[index]] = xStates;</span></span>
<span id="L73"><span class="lineNum"> 73</span> <span class="tlaGNC"> 1324 : }</span></span>
<span id="L74"><span class="lineNum"> 74</span> <span class="tlaGNC"> 212 : const torch::Tensor weights = torch::full({ pDataset.size(1) }, 1.0 / pDataset.size(1), torch::kDouble);</span></span>
<span id="L75"><span class="lineNum"> 75</span> <span class="tlaGNC"> 212 : model.fit(pDataset, weights, pFeatures, pClassName, states);</span></span>
<span id="L76"><span class="lineNum"> 76</span> <span class="tlaGNC"> 212 : }</span></span>
<span id="L77"><span class="lineNum"> 77</span> <span class="tlaGNC"> 424 : return states;</span></span>
<span id="L78"><span class="lineNum"> 78</span> <span class="tlaGNC"> 960128 : }</span></span>
<span id="L79"><span class="lineNum"> 79</span> <span class="tlaGNC"> 232 : map&lt;std::string, std::vector&lt;int&gt;&gt; Proposal::fit_local_discretization(const torch::Tensor&amp; y)</span></span>
<span id="L80"><span class="lineNum"> 80</span> : {</span>
<span id="L81"><span class="lineNum"> 81</span> : // Discretize the continuous input data and build pDataset (Classifier::dataset)</span>
<span id="L82"><span class="lineNum"> 82</span> <span class="tlaGNC"> 232 : int m = Xf.size(1);</span></span>
<span id="L83"><span class="lineNum"> 83</span> <span class="tlaGNC"> 232 : int n = Xf.size(0);</span></span>
<span id="L84"><span class="lineNum"> 84</span> <span class="tlaGNC"> 232 : map&lt;std::string, std::vector&lt;int&gt;&gt; states;</span></span>
<span id="L85"><span class="lineNum"> 85</span> <span class="tlaGNC"> 232 : pDataset = torch::zeros({ n + 1, m }, torch::kInt32);</span></span>
<span id="L86"><span class="lineNum"> 86</span> <span class="tlaGNC"> 232 : auto yv = std::vector&lt;int&gt;(y.data_ptr&lt;int&gt;(), y.data_ptr&lt;int&gt;() + y.size(0));</span></span>
<span id="L87"><span class="lineNum"> 87</span> : // discretize input data by feature(row)</span>
<span id="L88"><span class="lineNum"> 88</span> <span class="tlaGNC"> 1944 : for (auto i = 0; i &lt; pFeatures.size(); ++i) {</span></span>
<span id="L89"><span class="lineNum"> 89</span> <span class="tlaGNC"> 1712 : auto* discretizer = new mdlp::CPPFImdlp();</span></span>
<span id="L90"><span class="lineNum"> 90</span> <span class="tlaGNC"> 3424 : auto Xt_ptr = Xf.index({ i }).data_ptr&lt;float&gt;();</span></span>
<span id="L91"><span class="lineNum"> 91</span> <span class="tlaGNC"> 1712 : auto Xt = std::vector&lt;float&gt;(Xt_ptr, Xt_ptr + Xf.size(1));</span></span>
<span id="L92"><span class="lineNum"> 92</span> <span class="tlaGNC"> 1712 : discretizer-&gt;fit(Xt, yv);</span></span>
<span id="L93"><span class="lineNum"> 93</span> <span class="tlaGNC"> 6848 : pDataset.index_put_({ i, &quot;...&quot; }, torch::tensor(discretizer-&gt;transform(Xt)));</span></span>
<span id="L94"><span class="lineNum"> 94</span> <span class="tlaGNC"> 1712 : auto xStates = std::vector&lt;int&gt;(discretizer-&gt;getCutPoints().size() + 1);</span></span>
<span id="L95"><span class="lineNum"> 95</span> <span class="tlaGNC"> 1712 : iota(xStates.begin(), xStates.end(), 0);</span></span>
<span id="L96"><span class="lineNum"> 96</span> <span class="tlaGNC"> 1712 : states[pFeatures[i]] = xStates;</span></span>
<span id="L97"><span class="lineNum"> 97</span> <span class="tlaGNC"> 1712 : discretizers[pFeatures[i]] = discretizer;</span></span>
<span id="L98"><span class="lineNum"> 98</span> <span class="tlaGNC"> 1712 : }</span></span>
<span id="L99"><span class="lineNum"> 99</span> <span class="tlaGNC"> 232 : int n_classes = torch::max(y).item&lt;int&gt;() + 1;</span></span>
<span id="L100"><span class="lineNum"> 100</span> <span class="tlaGNC"> 232 : auto yStates = std::vector&lt;int&gt;(n_classes);</span></span>
<span id="L101"><span class="lineNum"> 101</span> <span class="tlaGNC"> 232 : iota(yStates.begin(), yStates.end(), 0);</span></span>
<span id="L102"><span class="lineNum"> 102</span> <span class="tlaGNC"> 232 : states[pClassName] = yStates;</span></span>
<span id="L103"><span class="lineNum"> 103</span> <span class="tlaGNC"> 696 : pDataset.index_put_({ n, &quot;...&quot; }, y);</span></span>
<span id="L104"><span class="lineNum"> 104</span> <span class="tlaGNC"> 464 : return states;</span></span>
<span id="L105"><span class="lineNum"> 105</span> <span class="tlaGNC"> 3888 : }</span></span>
<span id="L106"><span class="lineNum"> 106</span> <span class="tlaGNC"> 168 : torch::Tensor Proposal::prepareX(torch::Tensor&amp; X)</span></span>
<span id="L107"><span class="lineNum"> 107</span> : {</span>
<span id="L108"><span class="lineNum"> 108</span> <span class="tlaGNC"> 168 : auto Xtd = torch::zeros_like(X, torch::kInt32);</span></span>
<span id="L109"><span class="lineNum"> 109</span> <span class="tlaGNC"> 1376 : for (int i = 0; i &lt; X.size(0); ++i) {</span></span>
<span id="L110"><span class="lineNum"> 110</span> <span class="tlaGNC"> 1208 : auto Xt = std::vector&lt;float&gt;(X[i].data_ptr&lt;float&gt;(), X[i].data_ptr&lt;float&gt;() + X.size(1));</span></span>
<span id="L111"><span class="lineNum"> 111</span> <span class="tlaGNC"> 1208 : auto Xd = discretizers[pFeatures[i]]-&gt;transform(Xt);</span></span>
<span id="L112"><span class="lineNum"> 112</span> <span class="tlaGNC"> 3624 : Xtd.index_put_({ i }, torch::tensor(Xd, torch::kInt32));</span></span>
<span id="L113"><span class="lineNum"> 113</span> <span class="tlaGNC"> 1208 : }</span></span>
<span id="L114"><span class="lineNum"> 114</span> <span class="tlaGNC"> 336 : return Xtd;</span></span>
<span id="L115"><span class="lineNum"> 115</span> <span class="tlaGNC"> 1376 : }</span></span>
<span id="L116"><span class="lineNum"> 116</span> : }</span>
</pre>
</td>
</tr>
</table>
<br>
<table width="100%" border=0 cellspacing=0 cellpadding=0>
<tr><td class="ruler"><img src="../../glass.png" width=3 height=3 alt=""></td></tr>
<tr><td class="versionInfo">Generated by: <a href="https://github.com//linux-test-project/lcov" target="_parent">LCOV version 2.0-1</a></td></tr>
</table>
<br>
</body>
</html>

View File

@ -1,49 +0,0 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html lang="en">
<head>
<title>LCOV - BayesNet Coverage Report - bayesnet/classifiers/Proposal.cc</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" type="text/css" href="../../gcov.css">
</head>
<body>
<map name="overview">
<area shape="rect" coords="0,0,79,3" href="Proposal.cc.gcov.html#L1" target="source" alt="overview">
<area shape="rect" coords="0,4,79,7" href="Proposal.cc.gcov.html#L1" target="source" alt="overview">
<area shape="rect" coords="0,8,79,11" href="Proposal.cc.gcov.html#L1" target="source" alt="overview">
<area shape="rect" coords="0,12,79,15" href="Proposal.cc.gcov.html#L1" target="source" alt="overview">
<area shape="rect" coords="0,16,79,19" href="Proposal.cc.gcov.html#L5" target="source" alt="overview">
<area shape="rect" coords="0,20,79,23" href="Proposal.cc.gcov.html#L9" target="source" alt="overview">
<area shape="rect" coords="0,24,79,27" href="Proposal.cc.gcov.html#L13" target="source" alt="overview">
<area shape="rect" coords="0,28,79,31" href="Proposal.cc.gcov.html#L17" target="source" alt="overview">
<area shape="rect" coords="0,32,79,35" href="Proposal.cc.gcov.html#L21" target="source" alt="overview">
<area shape="rect" coords="0,36,79,39" href="Proposal.cc.gcov.html#L25" target="source" alt="overview">
<area shape="rect" coords="0,40,79,43" href="Proposal.cc.gcov.html#L29" target="source" alt="overview">
<area shape="rect" coords="0,44,79,47" href="Proposal.cc.gcov.html#L33" target="source" alt="overview">
<area shape="rect" coords="0,48,79,51" href="Proposal.cc.gcov.html#L37" target="source" alt="overview">
<area shape="rect" coords="0,52,79,55" href="Proposal.cc.gcov.html#L41" target="source" alt="overview">
<area shape="rect" coords="0,56,79,59" href="Proposal.cc.gcov.html#L45" target="source" alt="overview">
<area shape="rect" coords="0,60,79,63" href="Proposal.cc.gcov.html#L49" target="source" alt="overview">
<area shape="rect" coords="0,64,79,67" href="Proposal.cc.gcov.html#L53" target="source" alt="overview">
<area shape="rect" coords="0,68,79,71" href="Proposal.cc.gcov.html#L57" target="source" alt="overview">
<area shape="rect" coords="0,72,79,75" href="Proposal.cc.gcov.html#L61" target="source" alt="overview">
<area shape="rect" coords="0,76,79,79" href="Proposal.cc.gcov.html#L65" target="source" alt="overview">
<area shape="rect" coords="0,80,79,83" href="Proposal.cc.gcov.html#L69" target="source" alt="overview">
<area shape="rect" coords="0,84,79,87" href="Proposal.cc.gcov.html#L73" target="source" alt="overview">
<area shape="rect" coords="0,88,79,91" href="Proposal.cc.gcov.html#L77" target="source" alt="overview">
<area shape="rect" coords="0,92,79,95" href="Proposal.cc.gcov.html#L81" target="source" alt="overview">
<area shape="rect" coords="0,96,79,99" href="Proposal.cc.gcov.html#L85" target="source" alt="overview">
<area shape="rect" coords="0,100,79,103" href="Proposal.cc.gcov.html#L89" target="source" alt="overview">
<area shape="rect" coords="0,104,79,107" href="Proposal.cc.gcov.html#L93" target="source" alt="overview">
<area shape="rect" coords="0,108,79,111" href="Proposal.cc.gcov.html#L97" target="source" alt="overview">
<area shape="rect" coords="0,112,79,115" href="Proposal.cc.gcov.html#L101" target="source" alt="overview">
</map>
<center>
<a href="Proposal.cc.gcov.html#top" target="source">Top</a><br><br>
<img src="Proposal.cc.gcov.png" width=80 height=115 alt="Overview" border=0 usemap="#overview">
</center>
</body>
</html>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 796 B

View File

@ -1,104 +0,0 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>LCOV - BayesNet Coverage Report - bayesnet/classifiers/SPODE.cc - functions</title>
<link rel="stylesheet" type="text/css" href="../../gcov.css">
</head>
<body>
<table width="100%" border=0 cellspacing=0 cellpadding=0>
<tr><td class="title">LCOV - code coverage report</td></tr>
<tr><td class="ruler"><img src="../../glass.png" width=3 height=3 alt=""></td></tr>
<tr>
<td width="100%">
<table cellpadding=1 border=0 width="100%">
<tr>
<td width="10%" class="headerItem">Current view:</td>
<td width="10%" class="headerValue"><a href="../../index.html" target="_parent">top level</a> - <a href="index.html" target="_parent">bayesnet/classifiers</a> - SPODE.cc<span style="font-size: 80%;"> (<a href="SPODE.cc.gcov.html">source</a> / functions)</span></td>
<td width="5%"></td>
<td width="5%"></td>
<td width="5%" class="headerCovTableHead">Coverage</td>
<td width="5%" class="headerCovTableHead" title="Covered + Uncovered code">Total</td>
<td width="5%" class="headerCovTableHead" title="Exercised code only">Hit</td>
</tr>
<tr>
<td class="headerItem">Test:</td>
<td class="headerValue">BayesNet Coverage Report</td>
<td></td>
<td class="headerItem">Lines:</td>
<td class="headerCovTableEntryHi">100.0&nbsp;%</td>
<td class="headerCovTableEntry">10</td>
<td class="headerCovTableEntry">10</td>
</tr>
<tr>
<td class="headerItem">Test Date:</td>
<td class="headerValue">2024-05-06 17:54:04</td>
<td></td>
<td class="headerItem">Functions:</td>
<td class="headerCovTableEntryHi">100.0&nbsp;%</td>
<td class="headerCovTableEntry">3</td>
<td class="headerCovTableEntry">3</td>
</tr>
<tr>
<td class="headerItem">Legend:</td>
<td class="headerValueLeg"> Lines:
<span class="coverLegendCov">hit</span>
<span class="coverLegendNoCov">not hit</span>
</td>
<td></td>
</tr>
<tr><td><img src="../../glass.png" width=3 height=3 alt=""></td></tr>
</table>
</td>
</tr>
<tr><td class="ruler"><img src="../../glass.png" width=3 height=3 alt=""></td></tr>
</table>
<center>
<table cellpadding=1 cellspacing=1 border=0>
<tr><td><br></td></tr>
<tr>
<td class="tableHead">Function Name <span title="Click to sort table by function name" class="tableHeadSort"><a href="SPODE.cc.func.html"><img src="../../updown.png" width=10 height=14 alt="Sort by function name" title="Click to sort table by function name" border=0></a></span></td>
<td class="tableHead">Hit count <span title="Click to sort table by function hit count" class="tableHeadSort"><img src="../../glass.png" width=10 height=14 alt="Sort by function hit count" title="Click to sort table by function hit count" border=0></span></td>
</tr>
<tr>
<td class="coverFn"><a href="SPODE.cc.gcov.html#L24">bayesnet::SPODE::graph(std::__cxx11::basic_string&lt;char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt; const&amp;) const</a></td>
<td class="coverFnHi">68</td>
</tr>
<tr>
<td class="coverFn"><a href="SPODE.cc.gcov.html#L11">bayesnet::SPODE::buildModel(at::Tensor const&amp;)</a></td>
<td class="coverFnHi">1016</td>
</tr>
<tr>
<td class="coverFn"><a href="SPODE.cc.gcov.html#L9">bayesnet::SPODE::SPODE(int)</a></td>
<td class="coverFnHi">1124</td>
</tr>
</table>
<br>
</center>
<table width="100%" border=0 cellspacing=0 cellpadding=0>
<tr><td class="ruler"><img src="../../glass.png" width=3 height=3 alt=""></td></tr>
<tr><td class="versionInfo">Generated by: <a href="https://github.com//linux-test-project/lcov" target="_parent">LCOV version 2.0-1</a></td></tr>
</table>
<br>
</body>
</html>

View File

@ -1,104 +0,0 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>LCOV - BayesNet Coverage Report - bayesnet/classifiers/SPODE.cc - functions</title>
<link rel="stylesheet" type="text/css" href="../../gcov.css">
</head>
<body>
<table width="100%" border=0 cellspacing=0 cellpadding=0>
<tr><td class="title">LCOV - code coverage report</td></tr>
<tr><td class="ruler"><img src="../../glass.png" width=3 height=3 alt=""></td></tr>
<tr>
<td width="100%">
<table cellpadding=1 border=0 width="100%">
<tr>
<td width="10%" class="headerItem">Current view:</td>
<td width="10%" class="headerValue"><a href="../../index.html" target="_parent">top level</a> - <a href="index.html" target="_parent">bayesnet/classifiers</a> - SPODE.cc<span style="font-size: 80%;"> (<a href="SPODE.cc.gcov.html">source</a> / functions)</span></td>
<td width="5%"></td>
<td width="5%"></td>
<td width="5%" class="headerCovTableHead">Coverage</td>
<td width="5%" class="headerCovTableHead" title="Covered + Uncovered code">Total</td>
<td width="5%" class="headerCovTableHead" title="Exercised code only">Hit</td>
</tr>
<tr>
<td class="headerItem">Test:</td>
<td class="headerValue">BayesNet Coverage Report</td>
<td></td>
<td class="headerItem">Lines:</td>
<td class="headerCovTableEntryHi">100.0&nbsp;%</td>
<td class="headerCovTableEntry">10</td>
<td class="headerCovTableEntry">10</td>
</tr>
<tr>
<td class="headerItem">Test Date:</td>
<td class="headerValue">2024-05-06 17:54:04</td>
<td></td>
<td class="headerItem">Functions:</td>
<td class="headerCovTableEntryHi">100.0&nbsp;%</td>
<td class="headerCovTableEntry">3</td>
<td class="headerCovTableEntry">3</td>
</tr>
<tr>
<td class="headerItem">Legend:</td>
<td class="headerValueLeg"> Lines:
<span class="coverLegendCov">hit</span>
<span class="coverLegendNoCov">not hit</span>
</td>
<td></td>
</tr>
<tr><td><img src="../../glass.png" width=3 height=3 alt=""></td></tr>
</table>
</td>
</tr>
<tr><td class="ruler"><img src="../../glass.png" width=3 height=3 alt=""></td></tr>
</table>
<center>
<table cellpadding=1 cellspacing=1 border=0>
<tr><td><br></td></tr>
<tr>
<td class="tableHead">Function Name <span title="Click to sort table by function name" class="tableHeadSort"><img src="../../glass.png" width=10 height=14 alt="Sort by function name" title="Click to sort table by function name" border=0></span></td>
<td class="tableHead">Hit count <span title="Click to sort table by function hit count" class="tableHeadSort"><a href="SPODE.cc.func-c.html"><img src="../../updown.png" width=10 height=14 alt="Sort by function hit count" title="Click to sort table by function hit count" border=0></a></span></td>
</tr>
<tr>
<td class="coverFn"><a href="SPODE.cc.gcov.html#L9">bayesnet::SPODE::SPODE(int)</a></td>
<td class="coverFnHi">1124</td>
</tr>
<tr>
<td class="coverFn"><a href="SPODE.cc.gcov.html#L11">bayesnet::SPODE::buildModel(at::Tensor const&amp;)</a></td>
<td class="coverFnHi">1016</td>
</tr>
<tr>
<td class="coverFn"><a href="SPODE.cc.gcov.html#L24">bayesnet::SPODE::graph(std::__cxx11::basic_string&lt;char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt; const&amp;) const</a></td>
<td class="coverFnHi">68</td>
</tr>
</table>
<br>
</center>
<table width="100%" border=0 cellspacing=0 cellpadding=0>
<tr><td class="ruler"><img src="../../glass.png" width=3 height=3 alt=""></td></tr>
<tr><td class="versionInfo">Generated by: <a href="https://github.com//linux-test-project/lcov" target="_parent">LCOV version 2.0-1</a></td></tr>
</table>
<br>
</body>
</html>

View File

@ -1,19 +0,0 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN">
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>LCOV - BayesNet Coverage Report - bayesnet/classifiers/SPODE.cc</title>
<link rel="stylesheet" type="text/css" href="../../gcov.css">
</head>
<frameset cols="120,*">
<frame src="SPODE.cc.gcov.overview.html" name="overview">
<frame src="SPODE.cc.gcov.html" name="source">
<noframes>
<center>Frames not supported by your browser!<br></center>
</noframes>
</frameset>
</html>

View File

@ -1,115 +0,0 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>LCOV - BayesNet Coverage Report - bayesnet/classifiers/SPODE.cc</title>
<link rel="stylesheet" type="text/css" href="../../gcov.css">
</head>
<body>
<table width="100%" border=0 cellspacing=0 cellpadding=0>
<tr><td class="title">LCOV - code coverage report</td></tr>
<tr><td class="ruler"><img src="../../glass.png" width=3 height=3 alt=""></td></tr>
<tr>
<td width="100%">
<table cellpadding=1 border=0 width="100%">
<tr>
<td width="10%" class="headerItem">Current view:</td>
<td width="10%" class="headerValue"><a href="../../index.html" target="_parent">top level</a> - <a href="index.html" target="_parent">bayesnet/classifiers</a> - SPODE.cc<span style="font-size: 80%;"> (source / <a href="SPODE.cc.func-c.html">functions</a>)</span></td>
<td width="5%"></td>
<td width="5%"></td>
<td width="5%" class="headerCovTableHead">Coverage</td>
<td width="5%" class="headerCovTableHead" title="Covered + Uncovered code">Total</td>
<td width="5%" class="headerCovTableHead" title="Exercised code only">Hit</td>
</tr>
<tr>
<td class="headerItem">Test:</td>
<td class="headerValue">BayesNet Coverage Report</td>
<td></td>
<td class="headerItem">Lines:</td>
<td class="headerCovTableEntryHi">100.0&nbsp;%</td>
<td class="headerCovTableEntry">10</td>
<td class="headerCovTableEntry">10</td>
</tr>
<tr>
<td class="headerItem">Test Date:</td>
<td class="headerValue">2024-05-06 17:54:04</td>
<td></td>
<td class="headerItem">Functions:</td>
<td class="headerCovTableEntryHi">100.0&nbsp;%</td>
<td class="headerCovTableEntry">3</td>
<td class="headerCovTableEntry">3</td>
</tr>
<tr>
<td class="headerItem">Legend:</td>
<td class="headerValueLeg"> Lines:
<span class="coverLegendCov">hit</span>
<span class="coverLegendNoCov">not hit</span>
</td>
<td></td>
</tr>
<tr><td><img src="../../glass.png" width=3 height=3 alt=""></td></tr>
</table>
</td>
</tr>
<tr><td class="ruler"><img src="../../glass.png" width=3 height=3 alt=""></td></tr>
</table>
<table cellpadding=0 cellspacing=0 border=0>
<tr>
<td><br></td>
</tr>
<tr>
<td>
<pre class="sourceHeading"> Line data Source code</pre>
<pre class="source">
<span id="L1"><span class="lineNum"> 1</span> : // ***************************************************************</span>
<span id="L2"><span class="lineNum"> 2</span> : // SPDX-FileCopyrightText: Copyright 2024 Ricardo Montañana Gómez</span>
<span id="L3"><span class="lineNum"> 3</span> : // SPDX-FileType: SOURCE</span>
<span id="L4"><span class="lineNum"> 4</span> : // SPDX-License-Identifier: MIT</span>
<span id="L5"><span class="lineNum"> 5</span> : // ***************************************************************</span>
<span id="L6"><span class="lineNum"> 6</span> : </span>
<span id="L7"><span class="lineNum"> 7</span> : #include &quot;SPODE.h&quot;</span>
<span id="L8"><span class="lineNum"> 8</span> : </span>
<span id="L9"><span class="lineNum"> 9</span> : namespace bayesnet {</span>
<span id="L10"><span class="lineNum"> 10</span> : </span>
<span id="L11"><span class="lineNum"> 11</span> <span class="tlaGNC tlaBgGNC"> 1124 : SPODE::SPODE(int root) : Classifier(Network()), root(root) {}</span></span>
<span id="L12"><span class="lineNum"> 12</span> : </span>
<span id="L13"><span class="lineNum"> 13</span> <span class="tlaGNC"> 1016 : void SPODE::buildModel(const torch::Tensor&amp; weights)</span></span>
<span id="L14"><span class="lineNum"> 14</span> : {</span>
<span id="L15"><span class="lineNum"> 15</span> : // 0. Add all nodes to the model</span>
<span id="L16"><span class="lineNum"> 16</span> <span class="tlaGNC"> 1016 : addNodes();</span></span>
<span id="L17"><span class="lineNum"> 17</span> : // 1. Add edges from the class node to all other nodes</span>
<span id="L18"><span class="lineNum"> 18</span> : // 2. Add edges from the root node to all other nodes</span>
<span id="L19"><span class="lineNum"> 19</span> <span class="tlaGNC"> 25680 : for (int i = 0; i &lt; static_cast&lt;int&gt;(features.size()); ++i) {</span></span>
<span id="L20"><span class="lineNum"> 20</span> <span class="tlaGNC"> 24664 : model.addEdge(className, features[i]);</span></span>
<span id="L21"><span class="lineNum"> 21</span> <span class="tlaGNC"> 24664 : if (i != root) {</span></span>
<span id="L22"><span class="lineNum"> 22</span> <span class="tlaGNC"> 23648 : model.addEdge(features[root], features[i]);</span></span>
<span id="L23"><span class="lineNum"> 23</span> : }</span>
<span id="L24"><span class="lineNum"> 24</span> : }</span>
<span id="L25"><span class="lineNum"> 25</span> <span class="tlaGNC"> 1016 : }</span></span>
<span id="L26"><span class="lineNum"> 26</span> <span class="tlaGNC"> 68 : std::vector&lt;std::string&gt; SPODE::graph(const std::string&amp; name) const</span></span>
<span id="L27"><span class="lineNum"> 27</span> : {</span>
<span id="L28"><span class="lineNum"> 28</span> <span class="tlaGNC"> 68 : return model.graph(name);</span></span>
<span id="L29"><span class="lineNum"> 29</span> : }</span>
<span id="L30"><span class="lineNum"> 30</span> : </span>
<span id="L31"><span class="lineNum"> 31</span> : }</span>
</pre>
</td>
</tr>
</table>
<br>
<table width="100%" border=0 cellspacing=0 cellpadding=0>
<tr><td class="ruler"><img src="../../glass.png" width=3 height=3 alt=""></td></tr>
<tr><td class="versionInfo">Generated by: <a href="https://github.com//linux-test-project/lcov" target="_parent">LCOV version 2.0-1</a></td></tr>
</table>
<br>
</body>
</html>

View File

@ -1,28 +0,0 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html lang="en">
<head>
<title>LCOV - BayesNet Coverage Report - bayesnet/classifiers/SPODE.cc</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" type="text/css" href="../../gcov.css">
</head>
<body>
<map name="overview">
<area shape="rect" coords="0,0,79,3" href="SPODE.cc.gcov.html#L1" target="source" alt="overview">
<area shape="rect" coords="0,4,79,7" href="SPODE.cc.gcov.html#L1" target="source" alt="overview">
<area shape="rect" coords="0,8,79,11" href="SPODE.cc.gcov.html#L1" target="source" alt="overview">
<area shape="rect" coords="0,12,79,15" href="SPODE.cc.gcov.html#L1" target="source" alt="overview">
<area shape="rect" coords="0,16,79,19" href="SPODE.cc.gcov.html#L5" target="source" alt="overview">
<area shape="rect" coords="0,20,79,23" href="SPODE.cc.gcov.html#L9" target="source" alt="overview">
<area shape="rect" coords="0,24,79,27" href="SPODE.cc.gcov.html#L13" target="source" alt="overview">
<area shape="rect" coords="0,28,79,31" href="SPODE.cc.gcov.html#L17" target="source" alt="overview">
</map>
<center>
<a href="SPODE.cc.gcov.html#top" target="source">Top</a><br><br>
<img src="SPODE.cc.gcov.png" width=80 height=30 alt="Overview" border=0 usemap="#overview">
</center>
</body>
</html>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 310 B

View File

@ -1,90 +0,0 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>LCOV - BayesNet Coverage Report - bayesnet/classifiers/SPODE.h - functions</title>
<link rel="stylesheet" type="text/css" href="../../gcov.css">
</head>
<body>
<table width="100%" border=0 cellspacing=0 cellpadding=0>
<tr><td class="title">LCOV - code coverage report</td></tr>
<tr><td class="ruler"><img src="../../glass.png" width=3 height=3 alt=""></td></tr>
<tr>
<td width="100%">
<table cellpadding=1 border=0 width="100%">
<tr>
<td width="10%" class="headerItem">Current view:</td>
<td width="10%" class="headerValue"><a href="../../index.html" target="_parent">top level</a> - <a href="index.html" target="_parent">bayesnet/classifiers</a> - SPODE.h<span style="font-size: 80%;"> (<a href="SPODE.h.gcov.html">source</a> / functions)</span></td>
<td width="5%"></td>
<td width="5%"></td>
<td width="5%" class="headerCovTableHead">Coverage</td>
<td width="5%" class="headerCovTableHead" title="Covered + Uncovered code">Total</td>
<td width="5%" class="headerCovTableHead" title="Exercised code only">Hit</td>
</tr>
<tr>
<td class="headerItem">Test:</td>
<td class="headerValue">BayesNet Coverage Report</td>
<td></td>
<td class="headerItem">Lines:</td>
<td class="headerCovTableEntryHi">100.0&nbsp;%</td>
<td class="headerCovTableEntry">1</td>
<td class="headerCovTableEntry">1</td>
</tr>
<tr>
<td class="headerItem">Test Date:</td>
<td class="headerValue">2024-05-06 17:54:04</td>
<td></td>
<td class="headerItem">Functions:</td>
<td class="headerCovTableEntryHi">100.0&nbsp;%</td>
<td class="headerCovTableEntry">1</td>
<td class="headerCovTableEntry">1</td>
</tr>
<tr>
<td class="headerItem">Legend:</td>
<td class="headerValueLeg"> Lines:
<span class="coverLegendCov">hit</span>
<span class="coverLegendNoCov">not hit</span>
</td>
<td></td>
</tr>
<tr><td><img src="../../glass.png" width=3 height=3 alt=""></td></tr>
</table>
</td>
</tr>
<tr><td class="ruler"><img src="../../glass.png" width=3 height=3 alt=""></td></tr>
</table>
<center>
<table cellpadding=1 cellspacing=1 border=0>
<tr><td><br></td></tr>
<tr>
<td class="tableHead">Function Name <span title="Click to sort table by function name" class="tableHeadSort"><a href="SPODE.h.func.html"><img src="../../updown.png" width=10 height=14 alt="Sort by function name" title="Click to sort table by function name" border=0></a></span></td>
<td class="tableHead">Hit count <span title="Click to sort table by function hit count" class="tableHeadSort"><img src="../../glass.png" width=10 height=14 alt="Sort by function hit count" title="Click to sort table by function hit count" border=0></span></td>
</tr>
<tr>
<td class="coverFn"><a href="SPODE.h.gcov.html#L17">bayesnet::SPODE::~SPODE()</a></td>
<td class="coverFnHi">1836</td>
</tr>
</table>
<br>
</center>
<table width="100%" border=0 cellspacing=0 cellpadding=0>
<tr><td class="ruler"><img src="../../glass.png" width=3 height=3 alt=""></td></tr>
<tr><td class="versionInfo">Generated by: <a href="https://github.com//linux-test-project/lcov" target="_parent">LCOV version 2.0-1</a></td></tr>
</table>
<br>
</body>
</html>

View File

@ -1,90 +0,0 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>LCOV - BayesNet Coverage Report - bayesnet/classifiers/SPODE.h - functions</title>
<link rel="stylesheet" type="text/css" href="../../gcov.css">
</head>
<body>
<table width="100%" border=0 cellspacing=0 cellpadding=0>
<tr><td class="title">LCOV - code coverage report</td></tr>
<tr><td class="ruler"><img src="../../glass.png" width=3 height=3 alt=""></td></tr>
<tr>
<td width="100%">
<table cellpadding=1 border=0 width="100%">
<tr>
<td width="10%" class="headerItem">Current view:</td>
<td width="10%" class="headerValue"><a href="../../index.html" target="_parent">top level</a> - <a href="index.html" target="_parent">bayesnet/classifiers</a> - SPODE.h<span style="font-size: 80%;"> (<a href="SPODE.h.gcov.html">source</a> / functions)</span></td>
<td width="5%"></td>
<td width="5%"></td>
<td width="5%" class="headerCovTableHead">Coverage</td>
<td width="5%" class="headerCovTableHead" title="Covered + Uncovered code">Total</td>
<td width="5%" class="headerCovTableHead" title="Exercised code only">Hit</td>
</tr>
<tr>
<td class="headerItem">Test:</td>
<td class="headerValue">BayesNet Coverage Report</td>
<td></td>
<td class="headerItem">Lines:</td>
<td class="headerCovTableEntryHi">100.0&nbsp;%</td>
<td class="headerCovTableEntry">1</td>
<td class="headerCovTableEntry">1</td>
</tr>
<tr>
<td class="headerItem">Test Date:</td>
<td class="headerValue">2024-05-06 17:54:04</td>
<td></td>
<td class="headerItem">Functions:</td>
<td class="headerCovTableEntryHi">100.0&nbsp;%</td>
<td class="headerCovTableEntry">1</td>
<td class="headerCovTableEntry">1</td>
</tr>
<tr>
<td class="headerItem">Legend:</td>
<td class="headerValueLeg"> Lines:
<span class="coverLegendCov">hit</span>
<span class="coverLegendNoCov">not hit</span>
</td>
<td></td>
</tr>
<tr><td><img src="../../glass.png" width=3 height=3 alt=""></td></tr>
</table>
</td>
</tr>
<tr><td class="ruler"><img src="../../glass.png" width=3 height=3 alt=""></td></tr>
</table>
<center>
<table cellpadding=1 cellspacing=1 border=0>
<tr><td><br></td></tr>
<tr>
<td class="tableHead">Function Name <span title="Click to sort table by function name" class="tableHeadSort"><img src="../../glass.png" width=10 height=14 alt="Sort by function name" title="Click to sort table by function name" border=0></span></td>
<td class="tableHead">Hit count <span title="Click to sort table by function hit count" class="tableHeadSort"><a href="SPODE.h.func-c.html"><img src="../../updown.png" width=10 height=14 alt="Sort by function hit count" title="Click to sort table by function hit count" border=0></a></span></td>
</tr>
<tr>
<td class="coverFn"><a href="SPODE.h.gcov.html#L17">bayesnet::SPODE::~SPODE()</a></td>
<td class="coverFnHi">1836</td>
</tr>
</table>
<br>
</center>
<table width="100%" border=0 cellspacing=0 cellpadding=0>
<tr><td class="ruler"><img src="../../glass.png" width=3 height=3 alt=""></td></tr>
<tr><td class="versionInfo">Generated by: <a href="https://github.com//linux-test-project/lcov" target="_parent">LCOV version 2.0-1</a></td></tr>
</table>
<br>
</body>
</html>

View File

@ -1,19 +0,0 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN">
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>LCOV - BayesNet Coverage Report - bayesnet/classifiers/SPODE.h</title>
<link rel="stylesheet" type="text/css" href="../../gcov.css">
</head>
<frameset cols="120,*">
<frame src="SPODE.h.gcov.overview.html" name="overview">
<frame src="SPODE.h.gcov.html" name="source">
<noframes>
<center>Frames not supported by your browser!<br></center>
</noframes>
</frameset>
</html>

View File

@ -1,107 +0,0 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>LCOV - BayesNet Coverage Report - bayesnet/classifiers/SPODE.h</title>
<link rel="stylesheet" type="text/css" href="../../gcov.css">
</head>
<body>
<table width="100%" border=0 cellspacing=0 cellpadding=0>
<tr><td class="title">LCOV - code coverage report</td></tr>
<tr><td class="ruler"><img src="../../glass.png" width=3 height=3 alt=""></td></tr>
<tr>
<td width="100%">
<table cellpadding=1 border=0 width="100%">
<tr>
<td width="10%" class="headerItem">Current view:</td>
<td width="10%" class="headerValue"><a href="../../index.html" target="_parent">top level</a> - <a href="index.html" target="_parent">bayesnet/classifiers</a> - SPODE.h<span style="font-size: 80%;"> (source / <a href="SPODE.h.func-c.html">functions</a>)</span></td>
<td width="5%"></td>
<td width="5%"></td>
<td width="5%" class="headerCovTableHead">Coverage</td>
<td width="5%" class="headerCovTableHead" title="Covered + Uncovered code">Total</td>
<td width="5%" class="headerCovTableHead" title="Exercised code only">Hit</td>
</tr>
<tr>
<td class="headerItem">Test:</td>
<td class="headerValue">BayesNet Coverage Report</td>
<td></td>
<td class="headerItem">Lines:</td>
<td class="headerCovTableEntryHi">100.0&nbsp;%</td>
<td class="headerCovTableEntry">1</td>
<td class="headerCovTableEntry">1</td>
</tr>
<tr>
<td class="headerItem">Test Date:</td>
<td class="headerValue">2024-05-06 17:54:04</td>
<td></td>
<td class="headerItem">Functions:</td>
<td class="headerCovTableEntryHi">100.0&nbsp;%</td>
<td class="headerCovTableEntry">1</td>
<td class="headerCovTableEntry">1</td>
</tr>
<tr>
<td class="headerItem">Legend:</td>
<td class="headerValueLeg"> Lines:
<span class="coverLegendCov">hit</span>
<span class="coverLegendNoCov">not hit</span>
</td>
<td></td>
</tr>
<tr><td><img src="../../glass.png" width=3 height=3 alt=""></td></tr>
</table>
</td>
</tr>
<tr><td class="ruler"><img src="../../glass.png" width=3 height=3 alt=""></td></tr>
</table>
<table cellpadding=0 cellspacing=0 border=0>
<tr>
<td><br></td>
</tr>
<tr>
<td>
<pre class="sourceHeading"> Line data Source code</pre>
<pre class="source">
<span id="L1"><span class="lineNum"> 1</span> : // ***************************************************************</span>
<span id="L2"><span class="lineNum"> 2</span> : // SPDX-FileCopyrightText: Copyright 2024 Ricardo Montañana Gómez</span>
<span id="L3"><span class="lineNum"> 3</span> : // SPDX-FileType: SOURCE</span>
<span id="L4"><span class="lineNum"> 4</span> : // SPDX-License-Identifier: MIT</span>
<span id="L5"><span class="lineNum"> 5</span> : // ***************************************************************</span>
<span id="L6"><span class="lineNum"> 6</span> : </span>
<span id="L7"><span class="lineNum"> 7</span> : #ifndef SPODE_H</span>
<span id="L8"><span class="lineNum"> 8</span> : #define SPODE_H</span>
<span id="L9"><span class="lineNum"> 9</span> : #include &quot;Classifier.h&quot;</span>
<span id="L10"><span class="lineNum"> 10</span> : </span>
<span id="L11"><span class="lineNum"> 11</span> : namespace bayesnet {</span>
<span id="L12"><span class="lineNum"> 12</span> : class SPODE : public Classifier {</span>
<span id="L13"><span class="lineNum"> 13</span> : private:</span>
<span id="L14"><span class="lineNum"> 14</span> : int root;</span>
<span id="L15"><span class="lineNum"> 15</span> : protected:</span>
<span id="L16"><span class="lineNum"> 16</span> : void buildModel(const torch::Tensor&amp; weights) override;</span>
<span id="L17"><span class="lineNum"> 17</span> : public:</span>
<span id="L18"><span class="lineNum"> 18</span> : explicit SPODE(int root);</span>
<span id="L19"><span class="lineNum"> 19</span> <span class="tlaGNC tlaBgGNC"> 1836 : virtual ~SPODE() = default;</span></span>
<span id="L20"><span class="lineNum"> 20</span> : std::vector&lt;std::string&gt; graph(const std::string&amp; name = &quot;SPODE&quot;) const override;</span>
<span id="L21"><span class="lineNum"> 21</span> : };</span>
<span id="L22"><span class="lineNum"> 22</span> : }</span>
<span id="L23"><span class="lineNum"> 23</span> : #endif</span>
</pre>
</td>
</tr>
</table>
<br>
<table width="100%" border=0 cellspacing=0 cellpadding=0>
<tr><td class="ruler"><img src="../../glass.png" width=3 height=3 alt=""></td></tr>
<tr><td class="versionInfo">Generated by: <a href="https://github.com//linux-test-project/lcov" target="_parent">LCOV version 2.0-1</a></td></tr>
</table>
<br>
</body>
</html>

View File

@ -1,26 +0,0 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html lang="en">
<head>
<title>LCOV - BayesNet Coverage Report - bayesnet/classifiers/SPODE.h</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" type="text/css" href="../../gcov.css">
</head>
<body>
<map name="overview">
<area shape="rect" coords="0,0,79,3" href="SPODE.h.gcov.html#L1" target="source" alt="overview">
<area shape="rect" coords="0,4,79,7" href="SPODE.h.gcov.html#L1" target="source" alt="overview">
<area shape="rect" coords="0,8,79,11" href="SPODE.h.gcov.html#L1" target="source" alt="overview">
<area shape="rect" coords="0,12,79,15" href="SPODE.h.gcov.html#L1" target="source" alt="overview">
<area shape="rect" coords="0,16,79,19" href="SPODE.h.gcov.html#L5" target="source" alt="overview">
<area shape="rect" coords="0,20,79,23" href="SPODE.h.gcov.html#L9" target="source" alt="overview">
</map>
<center>
<a href="SPODE.h.gcov.html#top" target="source">Top</a><br><br>
<img src="SPODE.h.gcov.png" width=80 height=22 alt="Overview" border=0 usemap="#overview">
</center>
</body>
</html>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 245 B

View File

@ -1,125 +0,0 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>LCOV - BayesNet Coverage Report - bayesnet/classifiers/SPODELd.cc - functions</title>
<link rel="stylesheet" type="text/css" href="../../gcov.css">
</head>
<body>
<table width="100%" border=0 cellspacing=0 cellpadding=0>
<tr><td class="title">LCOV - code coverage report</td></tr>
<tr><td class="ruler"><img src="../../glass.png" width=3 height=3 alt=""></td></tr>
<tr>
<td width="100%">
<table cellpadding=1 border=0 width="100%">
<tr>
<td width="10%" class="headerItem">Current view:</td>
<td width="10%" class="headerValue"><a href="../../index.html" target="_parent">top level</a> - <a href="index.html" target="_parent">bayesnet/classifiers</a> - SPODELd.cc<span style="font-size: 80%;"> (<a href="SPODELd.cc.gcov.html">source</a> / functions)</span></td>
<td width="5%"></td>
<td width="5%"></td>
<td width="5%" class="headerCovTableHead">Coverage</td>
<td width="5%" class="headerCovTableHead" title="Covered + Uncovered code">Total</td>
<td width="5%" class="headerCovTableHead" title="Exercised code only">Hit</td>
</tr>
<tr>
<td class="headerItem">Test:</td>
<td class="headerValue">BayesNet Coverage Report</td>
<td></td>
<td class="headerItem">Lines:</td>
<td class="headerCovTableEntryHi">100.0&nbsp;%</td>
<td class="headerCovTableEntry">26</td>
<td class="headerCovTableEntry">26</td>
</tr>
<tr>
<td class="headerItem">Test Date:</td>
<td class="headerValue">2024-05-06 17:54:04</td>
<td></td>
<td class="headerItem">Functions:</td>
<td class="headerCovTableEntryHi">100.0&nbsp;%</td>
<td class="headerCovTableEntry">6</td>
<td class="headerCovTableEntry">6</td>
</tr>
<tr>
<td class="headerItem">Legend:</td>
<td class="headerValueLeg"> Lines:
<span class="coverLegendCov">hit</span>
<span class="coverLegendNoCov">not hit</span>
</td>
<td></td>
</tr>
<tr><td><img src="../../glass.png" width=3 height=3 alt=""></td></tr>
</table>
</td>
</tr>
<tr><td class="ruler"><img src="../../glass.png" width=3 height=3 alt=""></td></tr>
</table>
<center>
<table cellpadding=1 cellspacing=1 border=0>
<tr><td><br></td></tr>
<tr>
<td class="tableHead">Function Name <span title="Click to sort table by function name" class="tableHeadSort"><a href="SPODELd.cc.func.html"><img src="../../updown.png" width=10 height=14 alt="Sort by function name" title="Click to sort table by function name" border=0></a></span></td>
<td class="tableHead">Hit count <span title="Click to sort table by function hit count" class="tableHeadSort"><img src="../../glass.png" width=10 height=14 alt="Sort by function hit count" title="Click to sort table by function hit count" border=0></span></td>
</tr>
<tr>
<td class="coverFn"><a href="SPODELd.cc.gcov.html#L17">bayesnet::SPODELd::fit(at::Tensor&amp;, std::vector&lt;std::__cxx11::basic_string&lt;char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt;, std::allocator&lt;std::__cxx11::basic_string&lt;char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt; &gt; &gt; const&amp;, std::__cxx11::basic_string&lt;char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt; const&amp;, std::map&lt;std::__cxx11::basic_string&lt;char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt;, std::vector&lt;int, std::allocator&lt;int&gt; &gt;, std::less&lt;std::__cxx11::basic_string&lt;char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt; &gt;, std::allocator&lt;std::pair&lt;std::__cxx11::basic_string&lt;char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt; const, std::vector&lt;int, std::allocator&lt;int&gt; &gt; &gt; &gt; &gt;&amp;)</a></td>
<td class="coverFnHi">8</td>
</tr>
<tr>
<td class="coverFn"><a href="SPODELd.cc.gcov.html#L44">bayesnet::SPODELd::graph(std::__cxx11::basic_string&lt;char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt; const&amp;) const</a></td>
<td class="coverFnHi">36</td>
</tr>
<tr>
<td class="coverFn"><a href="SPODELd.cc.gcov.html#L39">bayesnet::SPODELd::predict(at::Tensor&amp;)</a></td>
<td class="coverFnHi">136</td>
</tr>
<tr>
<td class="coverFn"><a href="SPODELd.cc.gcov.html#L9">bayesnet::SPODELd::fit(at::Tensor&amp;, at::Tensor&amp;, std::vector&lt;std::__cxx11::basic_string&lt;char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt;, std::allocator&lt;std::__cxx11::basic_string&lt;char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt; &gt; &gt; const&amp;, std::__cxx11::basic_string&lt;char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt; const&amp;, std::map&lt;std::__cxx11::basic_string&lt;char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt;, std::vector&lt;int, std::allocator&lt;int&gt; &gt;, std::less&lt;std::__cxx11::basic_string&lt;char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt; &gt;, std::allocator&lt;std::pair&lt;std::__cxx11::basic_string&lt;char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt; const, std::vector&lt;int, std::allocator&lt;int&gt; &gt; &gt; &gt; &gt;&amp;)</a></td>
<td class="coverFnHi">168</td>
</tr>
<tr>
<td class="coverFn"><a href="SPODELd.cc.gcov.html#L27">bayesnet::SPODELd::commonFit(std::vector&lt;std::__cxx11::basic_string&lt;char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt;, std::allocator&lt;std::__cxx11::basic_string&lt;char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt; &gt; &gt; const&amp;, std::__cxx11::basic_string&lt;char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt; const&amp;, std::map&lt;std::__cxx11::basic_string&lt;char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt;, std::vector&lt;int, std::allocator&lt;int&gt; &gt;, std::less&lt;std::__cxx11::basic_string&lt;char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt; &gt;, std::allocator&lt;std::pair&lt;std::__cxx11::basic_string&lt;char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt; const, std::vector&lt;int, std::allocator&lt;int&gt; &gt; &gt; &gt; &gt;&amp;)</a></td>
<td class="coverFnHi">172</td>
</tr>
<tr>
<td class="coverFn"><a href="SPODELd.cc.gcov.html#L8">bayesnet::SPODELd::SPODELd(int)</a></td>
<td class="coverFnHi">220</td>
</tr>
</table>
<br>
</center>
<table width="100%" border=0 cellspacing=0 cellpadding=0>
<tr><td class="ruler"><img src="../../glass.png" width=3 height=3 alt=""></td></tr>
<tr><td class="versionInfo">Generated by: <a href="https://github.com//linux-test-project/lcov" target="_parent">LCOV version 2.0-1</a></td></tr>
</table>
<br>
</body>
</html>

View File

@ -1,125 +0,0 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>LCOV - BayesNet Coverage Report - bayesnet/classifiers/SPODELd.cc - functions</title>
<link rel="stylesheet" type="text/css" href="../../gcov.css">
</head>
<body>
<table width="100%" border=0 cellspacing=0 cellpadding=0>
<tr><td class="title">LCOV - code coverage report</td></tr>
<tr><td class="ruler"><img src="../../glass.png" width=3 height=3 alt=""></td></tr>
<tr>
<td width="100%">
<table cellpadding=1 border=0 width="100%">
<tr>
<td width="10%" class="headerItem">Current view:</td>
<td width="10%" class="headerValue"><a href="../../index.html" target="_parent">top level</a> - <a href="index.html" target="_parent">bayesnet/classifiers</a> - SPODELd.cc<span style="font-size: 80%;"> (<a href="SPODELd.cc.gcov.html">source</a> / functions)</span></td>
<td width="5%"></td>
<td width="5%"></td>
<td width="5%" class="headerCovTableHead">Coverage</td>
<td width="5%" class="headerCovTableHead" title="Covered + Uncovered code">Total</td>
<td width="5%" class="headerCovTableHead" title="Exercised code only">Hit</td>
</tr>
<tr>
<td class="headerItem">Test:</td>
<td class="headerValue">BayesNet Coverage Report</td>
<td></td>
<td class="headerItem">Lines:</td>
<td class="headerCovTableEntryHi">100.0&nbsp;%</td>
<td class="headerCovTableEntry">26</td>
<td class="headerCovTableEntry">26</td>
</tr>
<tr>
<td class="headerItem">Test Date:</td>
<td class="headerValue">2024-05-06 17:54:04</td>
<td></td>
<td class="headerItem">Functions:</td>
<td class="headerCovTableEntryHi">100.0&nbsp;%</td>
<td class="headerCovTableEntry">6</td>
<td class="headerCovTableEntry">6</td>
</tr>
<tr>
<td class="headerItem">Legend:</td>
<td class="headerValueLeg"> Lines:
<span class="coverLegendCov">hit</span>
<span class="coverLegendNoCov">not hit</span>
</td>
<td></td>
</tr>
<tr><td><img src="../../glass.png" width=3 height=3 alt=""></td></tr>
</table>
</td>
</tr>
<tr><td class="ruler"><img src="../../glass.png" width=3 height=3 alt=""></td></tr>
</table>
<center>
<table cellpadding=1 cellspacing=1 border=0>
<tr><td><br></td></tr>
<tr>
<td class="tableHead">Function Name <span title="Click to sort table by function name" class="tableHeadSort"><img src="../../glass.png" width=10 height=14 alt="Sort by function name" title="Click to sort table by function name" border=0></span></td>
<td class="tableHead">Hit count <span title="Click to sort table by function hit count" class="tableHeadSort"><a href="SPODELd.cc.func-c.html"><img src="../../updown.png" width=10 height=14 alt="Sort by function hit count" title="Click to sort table by function hit count" border=0></a></span></td>
</tr>
<tr>
<td class="coverFn"><a href="SPODELd.cc.gcov.html#L8">bayesnet::SPODELd::SPODELd(int)</a></td>
<td class="coverFnHi">220</td>
</tr>
<tr>
<td class="coverFn"><a href="SPODELd.cc.gcov.html#L27">bayesnet::SPODELd::commonFit(std::vector&lt;std::__cxx11::basic_string&lt;char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt;, std::allocator&lt;std::__cxx11::basic_string&lt;char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt; &gt; &gt; const&amp;, std::__cxx11::basic_string&lt;char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt; const&amp;, std::map&lt;std::__cxx11::basic_string&lt;char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt;, std::vector&lt;int, std::allocator&lt;int&gt; &gt;, std::less&lt;std::__cxx11::basic_string&lt;char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt; &gt;, std::allocator&lt;std::pair&lt;std::__cxx11::basic_string&lt;char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt; const, std::vector&lt;int, std::allocator&lt;int&gt; &gt; &gt; &gt; &gt;&amp;)</a></td>
<td class="coverFnHi">172</td>
</tr>
<tr>
<td class="coverFn"><a href="SPODELd.cc.gcov.html#L9">bayesnet::SPODELd::fit(at::Tensor&amp;, at::Tensor&amp;, std::vector&lt;std::__cxx11::basic_string&lt;char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt;, std::allocator&lt;std::__cxx11::basic_string&lt;char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt; &gt; &gt; const&amp;, std::__cxx11::basic_string&lt;char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt; const&amp;, std::map&lt;std::__cxx11::basic_string&lt;char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt;, std::vector&lt;int, std::allocator&lt;int&gt; &gt;, std::less&lt;std::__cxx11::basic_string&lt;char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt; &gt;, std::allocator&lt;std::pair&lt;std::__cxx11::basic_string&lt;char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt; const, std::vector&lt;int, std::allocator&lt;int&gt; &gt; &gt; &gt; &gt;&amp;)</a></td>
<td class="coverFnHi">168</td>
</tr>
<tr>
<td class="coverFn"><a href="SPODELd.cc.gcov.html#L17">bayesnet::SPODELd::fit(at::Tensor&amp;, std::vector&lt;std::__cxx11::basic_string&lt;char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt;, std::allocator&lt;std::__cxx11::basic_string&lt;char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt; &gt; &gt; const&amp;, std::__cxx11::basic_string&lt;char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt; const&amp;, std::map&lt;std::__cxx11::basic_string&lt;char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt;, std::vector&lt;int, std::allocator&lt;int&gt; &gt;, std::less&lt;std::__cxx11::basic_string&lt;char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt; &gt;, std::allocator&lt;std::pair&lt;std::__cxx11::basic_string&lt;char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt; const, std::vector&lt;int, std::allocator&lt;int&gt; &gt; &gt; &gt; &gt;&amp;)</a></td>
<td class="coverFnHi">8</td>
</tr>
<tr>
<td class="coverFn"><a href="SPODELd.cc.gcov.html#L44">bayesnet::SPODELd::graph(std::__cxx11::basic_string&lt;char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt; const&amp;) const</a></td>
<td class="coverFnHi">36</td>
</tr>
<tr>
<td class="coverFn"><a href="SPODELd.cc.gcov.html#L39">bayesnet::SPODELd::predict(at::Tensor&amp;)</a></td>
<td class="coverFnHi">136</td>
</tr>
</table>
<br>
</center>
<table width="100%" border=0 cellspacing=0 cellpadding=0>
<tr><td class="ruler"><img src="../../glass.png" width=3 height=3 alt=""></td></tr>
<tr><td class="versionInfo">Generated by: <a href="https://github.com//linux-test-project/lcov" target="_parent">LCOV version 2.0-1</a></td></tr>
</table>
<br>
</body>
</html>

View File

@ -1,19 +0,0 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN">
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>LCOV - BayesNet Coverage Report - bayesnet/classifiers/SPODELd.cc</title>
<link rel="stylesheet" type="text/css" href="../../gcov.css">
</head>
<frameset cols="120,*">
<frame src="SPODELd.cc.gcov.overview.html" name="overview">
<frame src="SPODELd.cc.gcov.html" name="source">
<noframes>
<center>Frames not supported by your browser!<br></center>
</noframes>
</frameset>
</html>

View File

@ -1,134 +0,0 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>LCOV - BayesNet Coverage Report - bayesnet/classifiers/SPODELd.cc</title>
<link rel="stylesheet" type="text/css" href="../../gcov.css">
</head>
<body>
<table width="100%" border=0 cellspacing=0 cellpadding=0>
<tr><td class="title">LCOV - code coverage report</td></tr>
<tr><td class="ruler"><img src="../../glass.png" width=3 height=3 alt=""></td></tr>
<tr>
<td width="100%">
<table cellpadding=1 border=0 width="100%">
<tr>
<td width="10%" class="headerItem">Current view:</td>
<td width="10%" class="headerValue"><a href="../../index.html" target="_parent">top level</a> - <a href="index.html" target="_parent">bayesnet/classifiers</a> - SPODELd.cc<span style="font-size: 80%;"> (source / <a href="SPODELd.cc.func-c.html">functions</a>)</span></td>
<td width="5%"></td>
<td width="5%"></td>
<td width="5%" class="headerCovTableHead">Coverage</td>
<td width="5%" class="headerCovTableHead" title="Covered + Uncovered code">Total</td>
<td width="5%" class="headerCovTableHead" title="Exercised code only">Hit</td>
</tr>
<tr>
<td class="headerItem">Test:</td>
<td class="headerValue">BayesNet Coverage Report</td>
<td></td>
<td class="headerItem">Lines:</td>
<td class="headerCovTableEntryHi">100.0&nbsp;%</td>
<td class="headerCovTableEntry">26</td>
<td class="headerCovTableEntry">26</td>
</tr>
<tr>
<td class="headerItem">Test Date:</td>
<td class="headerValue">2024-05-06 17:54:04</td>
<td></td>
<td class="headerItem">Functions:</td>
<td class="headerCovTableEntryHi">100.0&nbsp;%</td>
<td class="headerCovTableEntry">6</td>
<td class="headerCovTableEntry">6</td>
</tr>
<tr>
<td class="headerItem">Legend:</td>
<td class="headerValueLeg"> Lines:
<span class="coverLegendCov">hit</span>
<span class="coverLegendNoCov">not hit</span>
</td>
<td></td>
</tr>
<tr><td><img src="../../glass.png" width=3 height=3 alt=""></td></tr>
</table>
</td>
</tr>
<tr><td class="ruler"><img src="../../glass.png" width=3 height=3 alt=""></td></tr>
</table>
<table cellpadding=0 cellspacing=0 border=0>
<tr>
<td><br></td>
</tr>
<tr>
<td>
<pre class="sourceHeading"> Line data Source code</pre>
<pre class="source">
<span id="L1"><span class="lineNum"> 1</span> : // ***************************************************************</span>
<span id="L2"><span class="lineNum"> 2</span> : // SPDX-FileCopyrightText: Copyright 2024 Ricardo Montañana Gómez</span>
<span id="L3"><span class="lineNum"> 3</span> : // SPDX-FileType: SOURCE</span>
<span id="L4"><span class="lineNum"> 4</span> : // SPDX-License-Identifier: MIT</span>
<span id="L5"><span class="lineNum"> 5</span> : // ***************************************************************</span>
<span id="L6"><span class="lineNum"> 6</span> : </span>
<span id="L7"><span class="lineNum"> 7</span> : #include &quot;SPODELd.h&quot;</span>
<span id="L8"><span class="lineNum"> 8</span> : </span>
<span id="L9"><span class="lineNum"> 9</span> : namespace bayesnet {</span>
<span id="L10"><span class="lineNum"> 10</span> <span class="tlaGNC tlaBgGNC"> 220 : SPODELd::SPODELd(int root) : SPODE(root), Proposal(dataset, features, className) {}</span></span>
<span id="L11"><span class="lineNum"> 11</span> <span class="tlaGNC"> 168 : SPODELd&amp; SPODELd::fit(torch::Tensor&amp; X_, torch::Tensor&amp; y_, const std::vector&lt;std::string&gt;&amp; features_, const std::string&amp; className_, map&lt;std::string, std::vector&lt;int&gt;&gt;&amp; states_)</span></span>
<span id="L12"><span class="lineNum"> 12</span> : {</span>
<span id="L13"><span class="lineNum"> 13</span> <span class="tlaGNC"> 168 : checkInput(X_, y_);</span></span>
<span id="L14"><span class="lineNum"> 14</span> <span class="tlaGNC"> 168 : Xf = X_;</span></span>
<span id="L15"><span class="lineNum"> 15</span> <span class="tlaGNC"> 168 : y = y_;</span></span>
<span id="L16"><span class="lineNum"> 16</span> <span class="tlaGNC"> 168 : return commonFit(features_, className_, states_);</span></span>
<span id="L17"><span class="lineNum"> 17</span> : }</span>
<span id="L18"><span class="lineNum"> 18</span> : </span>
<span id="L19"><span class="lineNum"> 19</span> <span class="tlaGNC"> 8 : SPODELd&amp; SPODELd::fit(torch::Tensor&amp; dataset, const std::vector&lt;std::string&gt;&amp; features_, const std::string&amp; className_, map&lt;std::string, std::vector&lt;int&gt;&gt;&amp; states_)</span></span>
<span id="L20"><span class="lineNum"> 20</span> : {</span>
<span id="L21"><span class="lineNum"> 21</span> <span class="tlaGNC"> 8 : if (!torch::is_floating_point(dataset)) {</span></span>
<span id="L22"><span class="lineNum"> 22</span> <span class="tlaGNC"> 4 : throw std::runtime_error(&quot;Dataset must be a floating point tensor&quot;);</span></span>
<span id="L23"><span class="lineNum"> 23</span> : }</span>
<span id="L24"><span class="lineNum"> 24</span> <span class="tlaGNC"> 16 : Xf = dataset.index({ torch::indexing::Slice(0, dataset.size(0) - 1), &quot;...&quot; }).clone();</span></span>
<span id="L25"><span class="lineNum"> 25</span> <span class="tlaGNC"> 12 : y = dataset.index({ -1, &quot;...&quot; }).clone().to(torch::kInt32);</span></span>
<span id="L26"><span class="lineNum"> 26</span> <span class="tlaGNC"> 4 : return commonFit(features_, className_, states_);</span></span>
<span id="L27"><span class="lineNum"> 27</span> <span class="tlaGNC"> 12 : }</span></span>
<span id="L28"><span class="lineNum"> 28</span> : </span>
<span id="L29"><span class="lineNum"> 29</span> <span class="tlaGNC"> 172 : SPODELd&amp; SPODELd::commonFit(const std::vector&lt;std::string&gt;&amp; features_, const std::string&amp; className_, map&lt;std::string, std::vector&lt;int&gt;&gt;&amp; states_)</span></span>
<span id="L30"><span class="lineNum"> 30</span> : {</span>
<span id="L31"><span class="lineNum"> 31</span> <span class="tlaGNC"> 172 : features = features_;</span></span>
<span id="L32"><span class="lineNum"> 32</span> <span class="tlaGNC"> 172 : className = className_;</span></span>
<span id="L33"><span class="lineNum"> 33</span> : // Fills std::vectors Xv &amp; yv with the data from tensors X_ (discretized) &amp; y</span>
<span id="L34"><span class="lineNum"> 34</span> <span class="tlaGNC"> 172 : states = fit_local_discretization(y);</span></span>
<span id="L35"><span class="lineNum"> 35</span> : // We have discretized the input data</span>
<span id="L36"><span class="lineNum"> 36</span> : // 1st we need to fit the model to build the normal SPODE structure, SPODE::fit initializes the base Bayesian network</span>
<span id="L37"><span class="lineNum"> 37</span> <span class="tlaGNC"> 172 : SPODE::fit(dataset, features, className, states);</span></span>
<span id="L38"><span class="lineNum"> 38</span> <span class="tlaGNC"> 172 : states = localDiscretizationProposal(states, model);</span></span>
<span id="L39"><span class="lineNum"> 39</span> <span class="tlaGNC"> 172 : return *this;</span></span>
<span id="L40"><span class="lineNum"> 40</span> : }</span>
<span id="L41"><span class="lineNum"> 41</span> <span class="tlaGNC"> 136 : torch::Tensor SPODELd::predict(torch::Tensor&amp; X)</span></span>
<span id="L42"><span class="lineNum"> 42</span> : {</span>
<span id="L43"><span class="lineNum"> 43</span> <span class="tlaGNC"> 136 : auto Xt = prepareX(X);</span></span>
<span id="L44"><span class="lineNum"> 44</span> <span class="tlaGNC"> 272 : return SPODE::predict(Xt);</span></span>
<span id="L45"><span class="lineNum"> 45</span> <span class="tlaGNC"> 136 : }</span></span>
<span id="L46"><span class="lineNum"> 46</span> <span class="tlaGNC"> 36 : std::vector&lt;std::string&gt; SPODELd::graph(const std::string&amp; name) const</span></span>
<span id="L47"><span class="lineNum"> 47</span> : {</span>
<span id="L48"><span class="lineNum"> 48</span> <span class="tlaGNC"> 36 : return SPODE::graph(name);</span></span>
<span id="L49"><span class="lineNum"> 49</span> : }</span>
<span id="L50"><span class="lineNum"> 50</span> : }</span>
</pre>
</td>
</tr>
</table>
<br>
<table width="100%" border=0 cellspacing=0 cellpadding=0>
<tr><td class="ruler"><img src="../../glass.png" width=3 height=3 alt=""></td></tr>
<tr><td class="versionInfo">Generated by: <a href="https://github.com//linux-test-project/lcov" target="_parent">LCOV version 2.0-1</a></td></tr>
</table>
<br>
</body>
</html>

View File

@ -1,33 +0,0 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html lang="en">
<head>
<title>LCOV - BayesNet Coverage Report - bayesnet/classifiers/SPODELd.cc</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" type="text/css" href="../../gcov.css">
</head>
<body>
<map name="overview">
<area shape="rect" coords="0,0,79,3" href="SPODELd.cc.gcov.html#L1" target="source" alt="overview">
<area shape="rect" coords="0,4,79,7" href="SPODELd.cc.gcov.html#L1" target="source" alt="overview">
<area shape="rect" coords="0,8,79,11" href="SPODELd.cc.gcov.html#L1" target="source" alt="overview">
<area shape="rect" coords="0,12,79,15" href="SPODELd.cc.gcov.html#L1" target="source" alt="overview">
<area shape="rect" coords="0,16,79,19" href="SPODELd.cc.gcov.html#L5" target="source" alt="overview">
<area shape="rect" coords="0,20,79,23" href="SPODELd.cc.gcov.html#L9" target="source" alt="overview">
<area shape="rect" coords="0,24,79,27" href="SPODELd.cc.gcov.html#L13" target="source" alt="overview">
<area shape="rect" coords="0,28,79,31" href="SPODELd.cc.gcov.html#L17" target="source" alt="overview">
<area shape="rect" coords="0,32,79,35" href="SPODELd.cc.gcov.html#L21" target="source" alt="overview">
<area shape="rect" coords="0,36,79,39" href="SPODELd.cc.gcov.html#L25" target="source" alt="overview">
<area shape="rect" coords="0,40,79,43" href="SPODELd.cc.gcov.html#L29" target="source" alt="overview">
<area shape="rect" coords="0,44,79,47" href="SPODELd.cc.gcov.html#L33" target="source" alt="overview">
<area shape="rect" coords="0,48,79,51" href="SPODELd.cc.gcov.html#L37" target="source" alt="overview">
</map>
<center>
<a href="SPODELd.cc.gcov.html#top" target="source">Top</a><br><br>
<img src="SPODELd.cc.gcov.png" width=80 height=49 alt="Overview" border=0 usemap="#overview">
</center>
</body>
</html>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 403 B

View File

@ -1,90 +0,0 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>LCOV - BayesNet Coverage Report - bayesnet/classifiers/SPODELd.h - functions</title>
<link rel="stylesheet" type="text/css" href="../../gcov.css">
</head>
<body>
<table width="100%" border=0 cellspacing=0 cellpadding=0>
<tr><td class="title">LCOV - code coverage report</td></tr>
<tr><td class="ruler"><img src="../../glass.png" width=3 height=3 alt=""></td></tr>
<tr>
<td width="100%">
<table cellpadding=1 border=0 width="100%">
<tr>
<td width="10%" class="headerItem">Current view:</td>
<td width="10%" class="headerValue"><a href="../../index.html" target="_parent">top level</a> - <a href="index.html" target="_parent">bayesnet/classifiers</a> - SPODELd.h<span style="font-size: 80%;"> (<a href="SPODELd.h.gcov.html">source</a> / functions)</span></td>
<td width="5%"></td>
<td width="5%"></td>
<td width="5%" class="headerCovTableHead">Coverage</td>
<td width="5%" class="headerCovTableHead" title="Covered + Uncovered code">Total</td>
<td width="5%" class="headerCovTableHead" title="Exercised code only">Hit</td>
</tr>
<tr>
<td class="headerItem">Test:</td>
<td class="headerValue">BayesNet Coverage Report</td>
<td></td>
<td class="headerItem">Lines:</td>
<td class="headerCovTableEntryHi">100.0&nbsp;%</td>
<td class="headerCovTableEntry">1</td>
<td class="headerCovTableEntry">1</td>
</tr>
<tr>
<td class="headerItem">Test Date:</td>
<td class="headerValue">2024-05-06 17:54:04</td>
<td></td>
<td class="headerItem">Functions:</td>
<td class="headerCovTableEntryHi">100.0&nbsp;%</td>
<td class="headerCovTableEntry">1</td>
<td class="headerCovTableEntry">1</td>
</tr>
<tr>
<td class="headerItem">Legend:</td>
<td class="headerValueLeg"> Lines:
<span class="coverLegendCov">hit</span>
<span class="coverLegendNoCov">not hit</span>
</td>
<td></td>
</tr>
<tr><td><img src="../../glass.png" width=3 height=3 alt=""></td></tr>
</table>
</td>
</tr>
<tr><td class="ruler"><img src="../../glass.png" width=3 height=3 alt=""></td></tr>
</table>
<center>
<table cellpadding=1 cellspacing=1 border=0>
<tr><td><br></td></tr>
<tr>
<td class="tableHead">Function Name <span title="Click to sort table by function name" class="tableHeadSort"><a href="SPODELd.h.func.html"><img src="../../updown.png" width=10 height=14 alt="Sort by function name" title="Click to sort table by function name" border=0></a></span></td>
<td class="tableHead">Hit count <span title="Click to sort table by function hit count" class="tableHeadSort"><img src="../../glass.png" width=10 height=14 alt="Sort by function hit count" title="Click to sort table by function hit count" border=0></span></td>
</tr>
<tr>
<td class="coverFn"><a href="SPODELd.h.gcov.html#L14">bayesnet::SPODELd::~SPODELd()</a></td>
<td class="coverFnHi">320</td>
</tr>
</table>
<br>
</center>
<table width="100%" border=0 cellspacing=0 cellpadding=0>
<tr><td class="ruler"><img src="../../glass.png" width=3 height=3 alt=""></td></tr>
<tr><td class="versionInfo">Generated by: <a href="https://github.com//linux-test-project/lcov" target="_parent">LCOV version 2.0-1</a></td></tr>
</table>
<br>
</body>
</html>

View File

@ -1,90 +0,0 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>LCOV - BayesNet Coverage Report - bayesnet/classifiers/SPODELd.h - functions</title>
<link rel="stylesheet" type="text/css" href="../../gcov.css">
</head>
<body>
<table width="100%" border=0 cellspacing=0 cellpadding=0>
<tr><td class="title">LCOV - code coverage report</td></tr>
<tr><td class="ruler"><img src="../../glass.png" width=3 height=3 alt=""></td></tr>
<tr>
<td width="100%">
<table cellpadding=1 border=0 width="100%">
<tr>
<td width="10%" class="headerItem">Current view:</td>
<td width="10%" class="headerValue"><a href="../../index.html" target="_parent">top level</a> - <a href="index.html" target="_parent">bayesnet/classifiers</a> - SPODELd.h<span style="font-size: 80%;"> (<a href="SPODELd.h.gcov.html">source</a> / functions)</span></td>
<td width="5%"></td>
<td width="5%"></td>
<td width="5%" class="headerCovTableHead">Coverage</td>
<td width="5%" class="headerCovTableHead" title="Covered + Uncovered code">Total</td>
<td width="5%" class="headerCovTableHead" title="Exercised code only">Hit</td>
</tr>
<tr>
<td class="headerItem">Test:</td>
<td class="headerValue">BayesNet Coverage Report</td>
<td></td>
<td class="headerItem">Lines:</td>
<td class="headerCovTableEntryHi">100.0&nbsp;%</td>
<td class="headerCovTableEntry">1</td>
<td class="headerCovTableEntry">1</td>
</tr>
<tr>
<td class="headerItem">Test Date:</td>
<td class="headerValue">2024-05-06 17:54:04</td>
<td></td>
<td class="headerItem">Functions:</td>
<td class="headerCovTableEntryHi">100.0&nbsp;%</td>
<td class="headerCovTableEntry">1</td>
<td class="headerCovTableEntry">1</td>
</tr>
<tr>
<td class="headerItem">Legend:</td>
<td class="headerValueLeg"> Lines:
<span class="coverLegendCov">hit</span>
<span class="coverLegendNoCov">not hit</span>
</td>
<td></td>
</tr>
<tr><td><img src="../../glass.png" width=3 height=3 alt=""></td></tr>
</table>
</td>
</tr>
<tr><td class="ruler"><img src="../../glass.png" width=3 height=3 alt=""></td></tr>
</table>
<center>
<table cellpadding=1 cellspacing=1 border=0>
<tr><td><br></td></tr>
<tr>
<td class="tableHead">Function Name <span title="Click to sort table by function name" class="tableHeadSort"><img src="../../glass.png" width=10 height=14 alt="Sort by function name" title="Click to sort table by function name" border=0></span></td>
<td class="tableHead">Hit count <span title="Click to sort table by function hit count" class="tableHeadSort"><a href="SPODELd.h.func-c.html"><img src="../../updown.png" width=10 height=14 alt="Sort by function hit count" title="Click to sort table by function hit count" border=0></a></span></td>
</tr>
<tr>
<td class="coverFn"><a href="SPODELd.h.gcov.html#L14">bayesnet::SPODELd::~SPODELd()</a></td>
<td class="coverFnHi">320</td>
</tr>
</table>
<br>
</center>
<table width="100%" border=0 cellspacing=0 cellpadding=0>
<tr><td class="ruler"><img src="../../glass.png" width=3 height=3 alt=""></td></tr>
<tr><td class="versionInfo">Generated by: <a href="https://github.com//linux-test-project/lcov" target="_parent">LCOV version 2.0-1</a></td></tr>
</table>
<br>
</body>
</html>

View File

@ -1,19 +0,0 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN">
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>LCOV - BayesNet Coverage Report - bayesnet/classifiers/SPODELd.h</title>
<link rel="stylesheet" type="text/css" href="../../gcov.css">
</head>
<frameset cols="120,*">
<frame src="SPODELd.h.gcov.overview.html" name="overview">
<frame src="SPODELd.h.gcov.html" name="source">
<noframes>
<center>Frames not supported by your browser!<br></center>
</noframes>
</frameset>
</html>

View File

@ -1,109 +0,0 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>LCOV - BayesNet Coverage Report - bayesnet/classifiers/SPODELd.h</title>
<link rel="stylesheet" type="text/css" href="../../gcov.css">
</head>
<body>
<table width="100%" border=0 cellspacing=0 cellpadding=0>
<tr><td class="title">LCOV - code coverage report</td></tr>
<tr><td class="ruler"><img src="../../glass.png" width=3 height=3 alt=""></td></tr>
<tr>
<td width="100%">
<table cellpadding=1 border=0 width="100%">
<tr>
<td width="10%" class="headerItem">Current view:</td>
<td width="10%" class="headerValue"><a href="../../index.html" target="_parent">top level</a> - <a href="index.html" target="_parent">bayesnet/classifiers</a> - SPODELd.h<span style="font-size: 80%;"> (source / <a href="SPODELd.h.func-c.html">functions</a>)</span></td>
<td width="5%"></td>
<td width="5%"></td>
<td width="5%" class="headerCovTableHead">Coverage</td>
<td width="5%" class="headerCovTableHead" title="Covered + Uncovered code">Total</td>
<td width="5%" class="headerCovTableHead" title="Exercised code only">Hit</td>
</tr>
<tr>
<td class="headerItem">Test:</td>
<td class="headerValue">BayesNet Coverage Report</td>
<td></td>
<td class="headerItem">Lines:</td>
<td class="headerCovTableEntryHi">100.0&nbsp;%</td>
<td class="headerCovTableEntry">1</td>
<td class="headerCovTableEntry">1</td>
</tr>
<tr>
<td class="headerItem">Test Date:</td>
<td class="headerValue">2024-05-06 17:54:04</td>
<td></td>
<td class="headerItem">Functions:</td>
<td class="headerCovTableEntryHi">100.0&nbsp;%</td>
<td class="headerCovTableEntry">1</td>
<td class="headerCovTableEntry">1</td>
</tr>
<tr>
<td class="headerItem">Legend:</td>
<td class="headerValueLeg"> Lines:
<span class="coverLegendCov">hit</span>
<span class="coverLegendNoCov">not hit</span>
</td>
<td></td>
</tr>
<tr><td><img src="../../glass.png" width=3 height=3 alt=""></td></tr>
</table>
</td>
</tr>
<tr><td class="ruler"><img src="../../glass.png" width=3 height=3 alt=""></td></tr>
</table>
<table cellpadding=0 cellspacing=0 border=0>
<tr>
<td><br></td>
</tr>
<tr>
<td>
<pre class="sourceHeading"> Line data Source code</pre>
<pre class="source">
<span id="L1"><span class="lineNum"> 1</span> : // ***************************************************************</span>
<span id="L2"><span class="lineNum"> 2</span> : // SPDX-FileCopyrightText: Copyright 2024 Ricardo Montañana Gómez</span>
<span id="L3"><span class="lineNum"> 3</span> : // SPDX-FileType: SOURCE</span>
<span id="L4"><span class="lineNum"> 4</span> : // SPDX-License-Identifier: MIT</span>
<span id="L5"><span class="lineNum"> 5</span> : // ***************************************************************</span>
<span id="L6"><span class="lineNum"> 6</span> : </span>
<span id="L7"><span class="lineNum"> 7</span> : #ifndef SPODELD_H</span>
<span id="L8"><span class="lineNum"> 8</span> : #define SPODELD_H</span>
<span id="L9"><span class="lineNum"> 9</span> : #include &quot;SPODE.h&quot;</span>
<span id="L10"><span class="lineNum"> 10</span> : #include &quot;Proposal.h&quot;</span>
<span id="L11"><span class="lineNum"> 11</span> : </span>
<span id="L12"><span class="lineNum"> 12</span> : namespace bayesnet {</span>
<span id="L13"><span class="lineNum"> 13</span> : class SPODELd : public SPODE, public Proposal {</span>
<span id="L14"><span class="lineNum"> 14</span> : public:</span>
<span id="L15"><span class="lineNum"> 15</span> : explicit SPODELd(int root);</span>
<span id="L16"><span class="lineNum"> 16</span> <span class="tlaGNC tlaBgGNC"> 320 : virtual ~SPODELd() = default;</span></span>
<span id="L17"><span class="lineNum"> 17</span> : SPODELd&amp; fit(torch::Tensor&amp; X, torch::Tensor&amp; y, const std::vector&lt;std::string&gt;&amp; features, const std::string&amp; className, map&lt;std::string, std::vector&lt;int&gt;&gt;&amp; states) override;</span>
<span id="L18"><span class="lineNum"> 18</span> : SPODELd&amp; fit(torch::Tensor&amp; dataset, const std::vector&lt;std::string&gt;&amp; features, const std::string&amp; className, map&lt;std::string, std::vector&lt;int&gt;&gt;&amp; states) override;</span>
<span id="L19"><span class="lineNum"> 19</span> : SPODELd&amp; commonFit(const std::vector&lt;std::string&gt;&amp; features, const std::string&amp; className, map&lt;std::string, std::vector&lt;int&gt;&gt;&amp; states);</span>
<span id="L20"><span class="lineNum"> 20</span> : std::vector&lt;std::string&gt; graph(const std::string&amp; name = &quot;SPODE&quot;) const override;</span>
<span id="L21"><span class="lineNum"> 21</span> : torch::Tensor predict(torch::Tensor&amp; X) override;</span>
<span id="L22"><span class="lineNum"> 22</span> : static inline std::string version() { return &quot;0.0.1&quot;; };</span>
<span id="L23"><span class="lineNum"> 23</span> : };</span>
<span id="L24"><span class="lineNum"> 24</span> : }</span>
<span id="L25"><span class="lineNum"> 25</span> : #endif // !SPODELD_H</span>
</pre>
</td>
</tr>
</table>
<br>
<table width="100%" border=0 cellspacing=0 cellpadding=0>
<tr><td class="ruler"><img src="../../glass.png" width=3 height=3 alt=""></td></tr>
<tr><td class="versionInfo">Generated by: <a href="https://github.com//linux-test-project/lcov" target="_parent">LCOV version 2.0-1</a></td></tr>
</table>
<br>
</body>
</html>

View File

@ -1,27 +0,0 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html lang="en">
<head>
<title>LCOV - BayesNet Coverage Report - bayesnet/classifiers/SPODELd.h</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" type="text/css" href="../../gcov.css">
</head>
<body>
<map name="overview">
<area shape="rect" coords="0,0,79,3" href="SPODELd.h.gcov.html#L1" target="source" alt="overview">
<area shape="rect" coords="0,4,79,7" href="SPODELd.h.gcov.html#L1" target="source" alt="overview">
<area shape="rect" coords="0,8,79,11" href="SPODELd.h.gcov.html#L1" target="source" alt="overview">
<area shape="rect" coords="0,12,79,15" href="SPODELd.h.gcov.html#L1" target="source" alt="overview">
<area shape="rect" coords="0,16,79,19" href="SPODELd.h.gcov.html#L5" target="source" alt="overview">
<area shape="rect" coords="0,20,79,23" href="SPODELd.h.gcov.html#L9" target="source" alt="overview">
<area shape="rect" coords="0,24,79,27" href="SPODELd.h.gcov.html#L13" target="source" alt="overview">
</map>
<center>
<a href="SPODELd.h.gcov.html#top" target="source">Top</a><br><br>
<img src="SPODELd.h.gcov.png" width=80 height=24 alt="Overview" border=0 usemap="#overview">
</center>
</body>
</html>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 270 B

View File

@ -1,104 +0,0 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>LCOV - BayesNet Coverage Report - bayesnet/classifiers/SPnDE.cc - functions</title>
<link rel="stylesheet" type="text/css" href="../../gcov.css">
</head>
<body>
<table width="100%" border=0 cellspacing=0 cellpadding=0>
<tr><td class="title">LCOV - code coverage report</td></tr>
<tr><td class="ruler"><img src="../../glass.png" width=3 height=3 alt=""></td></tr>
<tr>
<td width="100%">
<table cellpadding=1 border=0 width="100%">
<tr>
<td width="10%" class="headerItem">Current view:</td>
<td width="10%" class="headerValue"><a href="../../index.html" target="_parent">top level</a> - <a href="index.html" target="_parent">bayesnet/classifiers</a> - SPnDE.cc<span style="font-size: 80%;"> (<a href="SPnDE.cc.gcov.html">source</a> / functions)</span></td>
<td width="5%"></td>
<td width="5%"></td>
<td width="5%" class="headerCovTableHead">Coverage</td>
<td width="5%" class="headerCovTableHead" title="Covered + Uncovered code">Total</td>
<td width="5%" class="headerCovTableHead" title="Exercised code only">Hit</td>
</tr>
<tr>
<td class="headerItem">Test:</td>
<td class="headerValue">BayesNet Coverage Report</td>
<td></td>
<td class="headerItem">Lines:</td>
<td class="headerCovTableEntryHi">100.0&nbsp;%</td>
<td class="headerCovTableEntry">14</td>
<td class="headerCovTableEntry">14</td>
</tr>
<tr>
<td class="headerItem">Test Date:</td>
<td class="headerValue">2024-05-06 17:54:04</td>
<td></td>
<td class="headerItem">Functions:</td>
<td class="headerCovTableEntryHi">100.0&nbsp;%</td>
<td class="headerCovTableEntry">3</td>
<td class="headerCovTableEntry">3</td>
</tr>
<tr>
<td class="headerItem">Legend:</td>
<td class="headerValueLeg"> Lines:
<span class="coverLegendCov">hit</span>
<span class="coverLegendNoCov">not hit</span>
</td>
<td></td>
</tr>
<tr><td><img src="../../glass.png" width=3 height=3 alt=""></td></tr>
</table>
</td>
</tr>
<tr><td class="ruler"><img src="../../glass.png" width=3 height=3 alt=""></td></tr>
</table>
<center>
<table cellpadding=1 cellspacing=1 border=0>
<tr><td><br></td></tr>
<tr>
<td class="tableHead">Function Name <span title="Click to sort table by function name" class="tableHeadSort"><a href="SPnDE.cc.func.html"><img src="../../updown.png" width=10 height=14 alt="Sort by function name" title="Click to sort table by function name" border=0></a></span></td>
<td class="tableHead">Hit count <span title="Click to sort table by function hit count" class="tableHeadSort"><img src="../../glass.png" width=10 height=14 alt="Sort by function hit count" title="Click to sort table by function hit count" border=0></span></td>
</tr>
<tr>
<td class="coverFn"><a href="SPnDE.cc.gcov.html#L31">bayesnet::SPnDE::graph(std::__cxx11::basic_string&lt;char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt; const&amp;) const</a></td>
<td class="coverFnHi">24</td>
</tr>
<tr>
<td class="coverFn"><a href="SPnDE.cc.gcov.html#L9">bayesnet::SPnDE::SPnDE(std::vector&lt;int, std::allocator&lt;int&gt; &gt;)</a></td>
<td class="coverFnHi">456</td>
</tr>
<tr>
<td class="coverFn"><a href="SPnDE.cc.gcov.html#L11">bayesnet::SPnDE::buildModel(at::Tensor const&amp;)</a></td>
<td class="coverFnHi">456</td>
</tr>
</table>
<br>
</center>
<table width="100%" border=0 cellspacing=0 cellpadding=0>
<tr><td class="ruler"><img src="../../glass.png" width=3 height=3 alt=""></td></tr>
<tr><td class="versionInfo">Generated by: <a href="https://github.com//linux-test-project/lcov" target="_parent">LCOV version 2.0-1</a></td></tr>
</table>
<br>
</body>
</html>

View File

@ -1,104 +0,0 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>LCOV - BayesNet Coverage Report - bayesnet/classifiers/SPnDE.cc - functions</title>
<link rel="stylesheet" type="text/css" href="../../gcov.css">
</head>
<body>
<table width="100%" border=0 cellspacing=0 cellpadding=0>
<tr><td class="title">LCOV - code coverage report</td></tr>
<tr><td class="ruler"><img src="../../glass.png" width=3 height=3 alt=""></td></tr>
<tr>
<td width="100%">
<table cellpadding=1 border=0 width="100%">
<tr>
<td width="10%" class="headerItem">Current view:</td>
<td width="10%" class="headerValue"><a href="../../index.html" target="_parent">top level</a> - <a href="index.html" target="_parent">bayesnet/classifiers</a> - SPnDE.cc<span style="font-size: 80%;"> (<a href="SPnDE.cc.gcov.html">source</a> / functions)</span></td>
<td width="5%"></td>
<td width="5%"></td>
<td width="5%" class="headerCovTableHead">Coverage</td>
<td width="5%" class="headerCovTableHead" title="Covered + Uncovered code">Total</td>
<td width="5%" class="headerCovTableHead" title="Exercised code only">Hit</td>
</tr>
<tr>
<td class="headerItem">Test:</td>
<td class="headerValue">BayesNet Coverage Report</td>
<td></td>
<td class="headerItem">Lines:</td>
<td class="headerCovTableEntryHi">100.0&nbsp;%</td>
<td class="headerCovTableEntry">14</td>
<td class="headerCovTableEntry">14</td>
</tr>
<tr>
<td class="headerItem">Test Date:</td>
<td class="headerValue">2024-05-06 17:54:04</td>
<td></td>
<td class="headerItem">Functions:</td>
<td class="headerCovTableEntryHi">100.0&nbsp;%</td>
<td class="headerCovTableEntry">3</td>
<td class="headerCovTableEntry">3</td>
</tr>
<tr>
<td class="headerItem">Legend:</td>
<td class="headerValueLeg"> Lines:
<span class="coverLegendCov">hit</span>
<span class="coverLegendNoCov">not hit</span>
</td>
<td></td>
</tr>
<tr><td><img src="../../glass.png" width=3 height=3 alt=""></td></tr>
</table>
</td>
</tr>
<tr><td class="ruler"><img src="../../glass.png" width=3 height=3 alt=""></td></tr>
</table>
<center>
<table cellpadding=1 cellspacing=1 border=0>
<tr><td><br></td></tr>
<tr>
<td class="tableHead">Function Name <span title="Click to sort table by function name" class="tableHeadSort"><img src="../../glass.png" width=10 height=14 alt="Sort by function name" title="Click to sort table by function name" border=0></span></td>
<td class="tableHead">Hit count <span title="Click to sort table by function hit count" class="tableHeadSort"><a href="SPnDE.cc.func-c.html"><img src="../../updown.png" width=10 height=14 alt="Sort by function hit count" title="Click to sort table by function hit count" border=0></a></span></td>
</tr>
<tr>
<td class="coverFn"><a href="SPnDE.cc.gcov.html#L9">bayesnet::SPnDE::SPnDE(std::vector&lt;int, std::allocator&lt;int&gt; &gt;)</a></td>
<td class="coverFnHi">456</td>
</tr>
<tr>
<td class="coverFn"><a href="SPnDE.cc.gcov.html#L11">bayesnet::SPnDE::buildModel(at::Tensor const&amp;)</a></td>
<td class="coverFnHi">456</td>
</tr>
<tr>
<td class="coverFn"><a href="SPnDE.cc.gcov.html#L31">bayesnet::SPnDE::graph(std::__cxx11::basic_string&lt;char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt; const&amp;) const</a></td>
<td class="coverFnHi">24</td>
</tr>
</table>
<br>
</center>
<table width="100%" border=0 cellspacing=0 cellpadding=0>
<tr><td class="ruler"><img src="../../glass.png" width=3 height=3 alt=""></td></tr>
<tr><td class="versionInfo">Generated by: <a href="https://github.com//linux-test-project/lcov" target="_parent">LCOV version 2.0-1</a></td></tr>
</table>
<br>
</body>
</html>

View File

@ -1,19 +0,0 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN">
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>LCOV - BayesNet Coverage Report - bayesnet/classifiers/SPnDE.cc</title>
<link rel="stylesheet" type="text/css" href="../../gcov.css">
</head>
<frameset cols="120,*">
<frame src="SPnDE.cc.gcov.overview.html" name="overview">
<frame src="SPnDE.cc.gcov.html" name="source">
<noframes>
<center>Frames not supported by your browser!<br></center>
</noframes>
</frameset>
</html>

View File

@ -1,122 +0,0 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>LCOV - BayesNet Coverage Report - bayesnet/classifiers/SPnDE.cc</title>
<link rel="stylesheet" type="text/css" href="../../gcov.css">
</head>
<body>
<table width="100%" border=0 cellspacing=0 cellpadding=0>
<tr><td class="title">LCOV - code coverage report</td></tr>
<tr><td class="ruler"><img src="../../glass.png" width=3 height=3 alt=""></td></tr>
<tr>
<td width="100%">
<table cellpadding=1 border=0 width="100%">
<tr>
<td width="10%" class="headerItem">Current view:</td>
<td width="10%" class="headerValue"><a href="../../index.html" target="_parent">top level</a> - <a href="index.html" target="_parent">bayesnet/classifiers</a> - SPnDE.cc<span style="font-size: 80%;"> (source / <a href="SPnDE.cc.func-c.html">functions</a>)</span></td>
<td width="5%"></td>
<td width="5%"></td>
<td width="5%" class="headerCovTableHead">Coverage</td>
<td width="5%" class="headerCovTableHead" title="Covered + Uncovered code">Total</td>
<td width="5%" class="headerCovTableHead" title="Exercised code only">Hit</td>
</tr>
<tr>
<td class="headerItem">Test:</td>
<td class="headerValue">BayesNet Coverage Report</td>
<td></td>
<td class="headerItem">Lines:</td>
<td class="headerCovTableEntryHi">100.0&nbsp;%</td>
<td class="headerCovTableEntry">14</td>
<td class="headerCovTableEntry">14</td>
</tr>
<tr>
<td class="headerItem">Test Date:</td>
<td class="headerValue">2024-05-06 17:54:04</td>
<td></td>
<td class="headerItem">Functions:</td>
<td class="headerCovTableEntryHi">100.0&nbsp;%</td>
<td class="headerCovTableEntry">3</td>
<td class="headerCovTableEntry">3</td>
</tr>
<tr>
<td class="headerItem">Legend:</td>
<td class="headerValueLeg"> Lines:
<span class="coverLegendCov">hit</span>
<span class="coverLegendNoCov">not hit</span>
</td>
<td></td>
</tr>
<tr><td><img src="../../glass.png" width=3 height=3 alt=""></td></tr>
</table>
</td>
</tr>
<tr><td class="ruler"><img src="../../glass.png" width=3 height=3 alt=""></td></tr>
</table>
<table cellpadding=0 cellspacing=0 border=0>
<tr>
<td><br></td>
</tr>
<tr>
<td>
<pre class="sourceHeading"> Line data Source code</pre>
<pre class="source">
<span id="L1"><span class="lineNum"> 1</span> : // ***************************************************************</span>
<span id="L2"><span class="lineNum"> 2</span> : // SPDX-FileCopyrightText: Copyright 2024 Ricardo Montañana Gómez</span>
<span id="L3"><span class="lineNum"> 3</span> : // SPDX-FileType: SOURCE</span>
<span id="L4"><span class="lineNum"> 4</span> : // SPDX-License-Identifier: MIT</span>
<span id="L5"><span class="lineNum"> 5</span> : // ***************************************************************</span>
<span id="L6"><span class="lineNum"> 6</span> : </span>
<span id="L7"><span class="lineNum"> 7</span> : #include &quot;SPnDE.h&quot;</span>
<span id="L8"><span class="lineNum"> 8</span> : </span>
<span id="L9"><span class="lineNum"> 9</span> : namespace bayesnet {</span>
<span id="L10"><span class="lineNum"> 10</span> : </span>
<span id="L11"><span class="lineNum"> 11</span> <span class="tlaGNC tlaBgGNC"> 456 : SPnDE::SPnDE(std::vector&lt;int&gt; parents) : Classifier(Network()), parents(parents) {}</span></span>
<span id="L12"><span class="lineNum"> 12</span> : </span>
<span id="L13"><span class="lineNum"> 13</span> <span class="tlaGNC"> 456 : void SPnDE::buildModel(const torch::Tensor&amp; weights)</span></span>
<span id="L14"><span class="lineNum"> 14</span> : {</span>
<span id="L15"><span class="lineNum"> 15</span> : // 0. Add all nodes to the model</span>
<span id="L16"><span class="lineNum"> 16</span> <span class="tlaGNC"> 456 : addNodes();</span></span>
<span id="L17"><span class="lineNum"> 17</span> <span class="tlaGNC"> 456 : std::vector&lt;int&gt; attributes;</span></span>
<span id="L18"><span class="lineNum"> 18</span> <span class="tlaGNC"> 4440 : for (int i = 0; i &lt; static_cast&lt;int&gt;(features.size()); ++i) {</span></span>
<span id="L19"><span class="lineNum"> 19</span> <span class="tlaGNC"> 3984 : if (std::find(parents.begin(), parents.end(), i) == parents.end()) {</span></span>
<span id="L20"><span class="lineNum"> 20</span> <span class="tlaGNC"> 3072 : attributes.push_back(i);</span></span>
<span id="L21"><span class="lineNum"> 21</span> : }</span>
<span id="L22"><span class="lineNum"> 22</span> : }</span>
<span id="L23"><span class="lineNum"> 23</span> : // 1. Add edges from the class node to all other nodes</span>
<span id="L24"><span class="lineNum"> 24</span> : // 2. Add edges from the parents nodes to all other nodes</span>
<span id="L25"><span class="lineNum"> 25</span> <span class="tlaGNC"> 3528 : for (const auto&amp; attribute : attributes) {</span></span>
<span id="L26"><span class="lineNum"> 26</span> <span class="tlaGNC"> 3072 : model.addEdge(className, features[attribute]);</span></span>
<span id="L27"><span class="lineNum"> 27</span> <span class="tlaGNC"> 9216 : for (const auto&amp; root : parents) {</span></span>
<span id="L28"><span class="lineNum"> 28</span> : </span>
<span id="L29"><span class="lineNum"> 29</span> <span class="tlaGNC"> 6144 : model.addEdge(features[root], features[attribute]);</span></span>
<span id="L30"><span class="lineNum"> 30</span> : }</span>
<span id="L31"><span class="lineNum"> 31</span> : }</span>
<span id="L32"><span class="lineNum"> 32</span> <span class="tlaGNC"> 456 : }</span></span>
<span id="L33"><span class="lineNum"> 33</span> <span class="tlaGNC"> 24 : std::vector&lt;std::string&gt; SPnDE::graph(const std::string&amp; name) const</span></span>
<span id="L34"><span class="lineNum"> 34</span> : {</span>
<span id="L35"><span class="lineNum"> 35</span> <span class="tlaGNC"> 24 : return model.graph(name);</span></span>
<span id="L36"><span class="lineNum"> 36</span> : }</span>
<span id="L37"><span class="lineNum"> 37</span> : </span>
<span id="L38"><span class="lineNum"> 38</span> : }</span>
</pre>
</td>
</tr>
</table>
<br>
<table width="100%" border=0 cellspacing=0 cellpadding=0>
<tr><td class="ruler"><img src="../../glass.png" width=3 height=3 alt=""></td></tr>
<tr><td class="versionInfo">Generated by: <a href="https://github.com//linux-test-project/lcov" target="_parent">LCOV version 2.0-1</a></td></tr>
</table>
<br>
</body>
</html>

View File

@ -1,30 +0,0 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html lang="en">
<head>
<title>LCOV - BayesNet Coverage Report - bayesnet/classifiers/SPnDE.cc</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" type="text/css" href="../../gcov.css">
</head>
<body>
<map name="overview">
<area shape="rect" coords="0,0,79,3" href="SPnDE.cc.gcov.html#L1" target="source" alt="overview">
<area shape="rect" coords="0,4,79,7" href="SPnDE.cc.gcov.html#L1" target="source" alt="overview">
<area shape="rect" coords="0,8,79,11" href="SPnDE.cc.gcov.html#L1" target="source" alt="overview">
<area shape="rect" coords="0,12,79,15" href="SPnDE.cc.gcov.html#L1" target="source" alt="overview">
<area shape="rect" coords="0,16,79,19" href="SPnDE.cc.gcov.html#L5" target="source" alt="overview">
<area shape="rect" coords="0,20,79,23" href="SPnDE.cc.gcov.html#L9" target="source" alt="overview">
<area shape="rect" coords="0,24,79,27" href="SPnDE.cc.gcov.html#L13" target="source" alt="overview">
<area shape="rect" coords="0,28,79,31" href="SPnDE.cc.gcov.html#L17" target="source" alt="overview">
<area shape="rect" coords="0,32,79,35" href="SPnDE.cc.gcov.html#L21" target="source" alt="overview">
<area shape="rect" coords="0,36,79,39" href="SPnDE.cc.gcov.html#L25" target="source" alt="overview">
</map>
<center>
<a href="SPnDE.cc.gcov.html#top" target="source">Top</a><br><br>
<img src="SPnDE.cc.gcov.png" width=80 height=37 alt="Overview" border=0 usemap="#overview">
</center>
</body>
</html>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 332 B

Some files were not shown because too many files have changed in this diff Show More