AnDE #28

Merged
rmontanana merged 15 commits from AnDE into main 2024-05-15 09:16:13 +00:00
1670 changed files with 9907 additions and 572481 deletions

57
.devcontainer/Dockerfile Normal file
View File

@ -0,0 +1,57 @@
FROM mcr.microsoft.com/devcontainers/cpp:ubuntu22.04
ARG REINSTALL_CMAKE_VERSION_FROM_SOURCE="3.22.2"
# Optionally install the cmake for vcpkg
COPY ./reinstall-cmake.sh /tmp/
RUN if [ "${REINSTALL_CMAKE_VERSION_FROM_SOURCE}" != "none" ]; then \
chmod +x /tmp/reinstall-cmake.sh && /tmp/reinstall-cmake.sh ${REINSTALL_CMAKE_VERSION_FROM_SOURCE}; \
fi \
&& rm -f /tmp/reinstall-cmake.sh
# [Optional] Uncomment this section to install additional vcpkg ports.
# RUN su vscode -c "${VCPKG_ROOT}/vcpkg install <your-port-name-here>"
# [Optional] Uncomment this section to install additional packages.
RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
&& apt-get -y install --no-install-recommends wget software-properties-common libdatetime-perl libcapture-tiny-perl libdatetime-format-dateparse-perl libgd-perl
# Add PPA for GCC 13
RUN add-apt-repository ppa:ubuntu-toolchain-r/test
RUN apt-get update
# Install GCC 13.1
RUN apt-get install -y gcc-13 g++-13
# Install lcov 2.1
RUN wget --quiet https://github.com/linux-test-project/lcov/releases/download/v2.1/lcov-2.1.tar.gz && \
tar -xvf lcov-2.1.tar.gz && \
cd lcov-2.1 && \
make install
RUN rm lcov-2.1.tar.gz
RUN rm -fr lcov-2.1
# Install Miniconda
RUN mkdir -p /opt/conda
RUN wget --quiet "https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-aarch64.sh" -O /opt/conda/miniconda.sh && \
bash /opt/conda/miniconda.sh -b -p /opt/miniconda
# Add conda to PATH
ENV PATH=/opt/miniconda/bin:$PATH
# add CXX and CC to the environment with gcc 13
ENV CXX=/usr/bin/g++-13
ENV CC=/usr/bin/gcc-13
# link the last gcov version
RUN rm /usr/bin/gcov
RUN ln -s /usr/bin/gcov-13 /usr/bin/gcov
# change ownership of /opt/miniconda to vscode user
RUN chown -R vscode:vscode /opt/miniconda
USER vscode
RUN conda init
RUN conda install -y -c conda-forge yaml pytorch

View File

@ -0,0 +1,37 @@
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
// README at: https://github.com/devcontainers/templates/tree/main/src/cpp
{
"name": "C++",
"build": {
"dockerfile": "Dockerfile"
},
// "features": {
// "ghcr.io/devcontainers/features/conda:1": {}
// }
// Features to add to the dev container. More info: https://containers.dev/features.
// "features": {},
// Use 'forwardPorts' to make a list of ports inside the container available locally.
// "forwardPorts": [],
// Use 'postCreateCommand' to run commands after the container is created.
"postCreateCommand": "make release && make debug && echo 'Done!'",
// Configure tool-specific properties.
// "customizations": {},
"customizations": {
// Configure properties specific to VS Code.
"vscode": {
"settings": {},
"extensions": [
"ms-vscode.cpptools",
"ms-vscode.cpptools-extension-pack",
"ms-vscode.cpptools-themes",
"ms-vscode.cmake-tools",
"ms-azuretools.vscode-docker",
"jbenden.c-cpp-flylint",
"matepek.vscode-catch2-test-adapter",
"GitHub.copilot"
]
}
}
// Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root.
// "remoteUser": "root"
}

View File

@ -0,0 +1,59 @@
#!/usr/bin/env bash
#-------------------------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See https://go.microsoft.com/fwlink/?linkid=2090316 for license information.
#-------------------------------------------------------------------------------------------------------------
#
set -e
CMAKE_VERSION=${1:-"none"}
if [ "${CMAKE_VERSION}" = "none" ]; then
echo "No CMake version specified, skipping CMake reinstallation"
exit 0
fi
# Cleanup temporary directory and associated files when exiting the script.
cleanup() {
EXIT_CODE=$?
set +e
if [[ -n "${TMP_DIR}" ]]; then
echo "Executing cleanup of tmp files"
rm -Rf "${TMP_DIR}"
fi
exit $EXIT_CODE
}
trap cleanup EXIT
echo "Installing CMake..."
apt-get -y purge --auto-remove cmake
mkdir -p /opt/cmake
architecture=$(dpkg --print-architecture)
case "${architecture}" in
arm64)
ARCH=aarch64 ;;
amd64)
ARCH=x86_64 ;;
*)
echo "Unsupported architecture ${architecture}."
exit 1
;;
esac
CMAKE_BINARY_NAME="cmake-${CMAKE_VERSION}-linux-${ARCH}.sh"
CMAKE_CHECKSUM_NAME="cmake-${CMAKE_VERSION}-SHA-256.txt"
TMP_DIR=$(mktemp -d -t cmake-XXXXXXXXXX)
echo "${TMP_DIR}"
cd "${TMP_DIR}"
curl -sSL "https://github.com/Kitware/CMake/releases/download/v${CMAKE_VERSION}/${CMAKE_BINARY_NAME}" -O
curl -sSL "https://github.com/Kitware/CMake/releases/download/v${CMAKE_VERSION}/${CMAKE_CHECKSUM_NAME}" -O
sha256sum -c --ignore-missing "${CMAKE_CHECKSUM_NAME}"
sh "${TMP_DIR}/${CMAKE_BINARY_NAME}" --prefix=/opt/cmake --skip-license
ln -s /opt/cmake/bin/cmake /usr/local/bin/cmake
ln -s /opt/cmake/bin/ctest /usr/local/bin/ctest

12
.github/dependabot.yml vendored Normal file
View File

@ -0,0 +1,12 @@
# To get started with Dependabot version updates, you'll need to specify which
# package ecosystems to update and where the package manifests are located.
# Please see the documentation for more information:
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
# https://containers.dev/guide/dependabot
version: 2
updates:
- package-ecosystem: "devcontainers"
directory: "/"
schedule:
interval: weekly

1
.gitignore vendored
View File

@ -39,4 +39,5 @@ cmake-build*/**
puml/** puml/**
.vscode/settings.json .vscode/settings.json
sample/build sample/build
**/.DS_Store

5
.gitmodules vendored
View File

@ -13,3 +13,8 @@
url = https://github.com/rmontanana/folding url = https://github.com/rmontanana/folding
main = main main = main
update = merge update = merge
[submodule "tests/lib/catch2"]
path = tests/lib/catch2
url = https://github.com/catchorg/Catch2.git
main = main
update = merge

2
.vscode/launch.json vendored
View File

@ -16,7 +16,7 @@
"name": "test", "name": "test",
"program": "${workspaceFolder}/build_debug/tests/TestBayesNet", "program": "${workspaceFolder}/build_debug/tests/TestBayesNet",
"args": [ "args": [
"\"Bisection Best\"" "[Node]"
], ],
"cwd": "${workspaceFolder}/build_debug/tests" "cwd": "${workspaceFolder}/build_debug/tests"
}, },

View File

@ -9,9 +9,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Added ### Added
- Add the Library logo generated with <https://openart.ai> to README.md - Library logo generated with <https://openart.ai> to README.md
- Add link to the coverage report in the README.md coverage label. - Link to the coverage report in the README.md coverage label.
- Add the *convergence_best* hyperparameter to the BoostAODE class, to control the way the prior accuracy is computed if convergence is set. Default value is *false*. - *convergence_best* hyperparameter to the BoostAODE class, to control the way the prior accuracy is computed if convergence is set. Default value is *false*.
- SPnDE model.
- A2DE model.
- A2DE & SPnDE tests.
- Add tests to reach 99% of coverage.
- Add tests to check the correct version of the mdlp, folding and json libraries.
### Internal ### Internal
@ -19,6 +24,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Refactor catch2 library location to test/lib - Refactor catch2 library location to test/lib
- Refactor loadDataset function in tests. - Refactor loadDataset function in tests.
- Remove conditionalEdgeWeights method in BayesMetrics. - Remove conditionalEdgeWeights method in BayesMetrics.
- Refactor Coverage Report generation.
- Add devcontainer to work on apple silicon.
- Change build cmake folder names to Debug & Release.
## [1.0.5] 2024-04-20 ## [1.0.5] 2024-04-20

View File

@ -1,7 +1,7 @@
cmake_minimum_required(VERSION 3.20) cmake_minimum_required(VERSION 3.20)
project(BayesNet project(BayesNet
VERSION 1.0.5 VERSION 1.0.5.1
DESCRIPTION "Bayesian Network and basic classifiers Library." DESCRIPTION "Bayesian Network and basic classifiers Library."
HOMEPAGE_URL "https://github.com/rmontanana/bayesnet" HOMEPAGE_URL "https://github.com/rmontanana/bayesnet"
LANGUAGES CXX LANGUAGES CXX
@ -25,8 +25,9 @@ set(CMAKE_CXX_EXTENSIONS OFF)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON) set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${TORCH_CXX_FLAGS}") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${TORCH_CXX_FLAGS}")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pthread") SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pthread")
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -fprofile-arcs -ftest-coverage -O0 -g") set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -fprofile-arcs -ftest-coverage -fno-elide-constructors -fno-default-inline")
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -O3") set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -O3")
# Options # Options
# ------- # -------
option(ENABLE_CLANG_TIDY "Enable to add clang tidy." OFF) option(ENABLE_CLANG_TIDY "Enable to add clang tidy." OFF)

View File

@ -2,14 +2,13 @@ SHELL := /bin/bash
.DEFAULT_GOAL := help .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
f_release = build_release f_release = build_Release
f_debug = build_debug f_debug = build_Debug
f_diagrams = diagrams f_diagrams = diagrams
app_targets = BayesNet app_targets = BayesNet
test_targets = TestBayesNet test_targets = TestBayesNet
clang-uml = clang-uml clang-uml = clang-uml
plantuml = plantuml plantuml = plantuml
gcovr = gcovr
lcov = lcov lcov = lcov
genhtml = genhtml genhtml = genhtml
dot = dot dot = dot
@ -115,24 +114,24 @@ test: ## Run tests (opt="-s") to verbose output the tests, (opt="-c='Test Maximu
coverage: ## Run tests and generate coverage report (build/index.html) coverage: ## Run tests and generate coverage report (build/index.html)
@echo ">>> Building tests with coverage..." @echo ">>> Building tests with coverage..."
@which $(gcovr) || (echo ">>> Please install gcovr"; exit 1)
@which $(lcov) || (echo ">>> Please install lcov"; exit 1) @which $(lcov) || (echo ">>> Please install lcov"; exit 1)
@which $(genhtml) || (echo ">>> Please install lcov"; exit 1) @if [ ! -f $(f_debug)/tests/coverage.info ] ; then $(MAKE) test ; fi
@$(MAKE) test
@$(gcovr) $(f_debug)/tests
@echo ">>> Building report..." @echo ">>> Building report..."
@cd $(f_debug)/tests; \ @cd $(f_debug)/tests; \
$(lcov) --directory CMakeFiles --capture --ignore-errors source,source --output-file coverage.info >/dev/null 2>&1; \ $(lcov) --directory CMakeFiles --capture --demangle-cpp --ignore-errors source,source --output-file coverage.info >/dev/null 2>&1; \
$(lcov) --remove coverage.info '/usr/*' --output-file coverage.info >/dev/null 2>&1; \ $(lcov) --remove coverage.info '/usr/*' --output-file coverage.info >/dev/null 2>&1; \
$(lcov) --remove coverage.info 'lib/*' --output-file coverage.info >/dev/null 2>&1; \ $(lcov) --remove coverage.info 'lib/*' --output-file coverage.info >/dev/null 2>&1; \
$(lcov) --remove coverage.info 'libtorch/*' --output-file coverage.info >/dev/null 2>&1; \ $(lcov) --remove coverage.info 'libtorch/*' --output-file coverage.info >/dev/null 2>&1; \
$(lcov) --remove coverage.info 'tests/*' --output-file coverage.info >/dev/null 2>&1; \ $(lcov) --remove coverage.info 'tests/*' --output-file coverage.info >/dev/null 2>&1; \
$(lcov) --remove coverage.info 'bayesnet/utils/loguru.*' --ignore-errors unused --output-file coverage.info >/dev/null 2>&1 $(lcov) --remove coverage.info 'bayesnet/utils/loguru.*' --ignore-errors unused --output-file coverage.info >/dev/null 2>&1; \
@$(genhtml) $(f_debug)/tests/coverage.info --demangle-cpp --output-directory html >/dev/null 2>&1; $(lcov) --remove coverage.info '/opt/miniconda/*' --ignore-errors unused --output-file coverage.info >/dev/null 2>&1; \
$(lcov) --summary coverage.info
@$(MAKE) updatebadge @$(MAKE) updatebadge
@echo ">>> Done"; @echo ">>> Done";
viewcoverage: ## View the html coverage report 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 @xdg-open html/index.html || open html/index.html 2>/dev/null
@echo ">>> Done"; @echo ">>> Done";

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) [![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) [![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) ![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-97,8%25-green)](html/index.html) [![Coverage Badge](https://img.shields.io/badge/Coverage-99,0%25-green)](html/index.html)
Bayesian Network Classifiers using libtorch from scratch Bayesian Network Classifiers using libtorch from scratch

View File

@ -0,0 +1,38 @@
// ***************************************************************
// SPDX-FileCopyrightText: Copyright 2024 Ricardo Montañana Gómez
// SPDX-FileType: SOURCE
// SPDX-License-Identifier: MIT
// ***************************************************************
#include "SPnDE.h"
namespace bayesnet {
SPnDE::SPnDE(std::vector<int> parents) : Classifier(Network()), parents(parents) {}
void SPnDE::buildModel(const torch::Tensor& weights)
{
// 0. Add all nodes to the model
addNodes();
std::vector<int> attributes;
for (int i = 0; i < static_cast<int>(features.size()); ++i) {
if (std::find(parents.begin(), parents.end(), i) == parents.end()) {
attributes.push_back(i);
}
}
// 1. Add edges from the class node to all other nodes
// 2. Add edges from the parents nodes to all other nodes
for (const auto& attribute : attributes) {
model.addEdge(className, features[attribute]);
for (const auto& root : parents) {
model.addEdge(features[root], features[attribute]);
}
}
}
std::vector<std::string> SPnDE::graph(const std::string& name) const
{
return model.graph(name);
}
}

View File

@ -0,0 +1,26 @@
// ***************************************************************
// SPDX-FileCopyrightText: Copyright 2024 Ricardo Montañana Gómez
// SPDX-FileType: SOURCE
// SPDX-License-Identifier: MIT
// ***************************************************************
#ifndef SPnDE_H
#define SPnDE_H
#include <vector>
#include "Classifier.h"
namespace bayesnet {
class SPnDE : public Classifier {
public:
explicit SPnDE(std::vector<int> parents);
virtual ~SPnDE() = default;
std::vector<std::string> graph(const std::string& name = "SPnDE") const override;
protected:
void buildModel(const torch::Tensor& weights) override;
private:
std::vector<int> parents;
};
}
#endif

View File

@ -0,0 +1,40 @@
// ***************************************************************
// SPDX-FileCopyrightText: Copyright 2024 Ricardo Montañana Gómez
// SPDX-FileType: SOURCE
// SPDX-License-Identifier: MIT
// ***************************************************************
#include "A2DE.h"
namespace bayesnet {
A2DE::A2DE(bool predict_voting) : Ensemble(predict_voting)
{
validHyperparameters = { "predict_voting" };
}
void A2DE::setHyperparameters(const nlohmann::json& hyperparameters_)
{
auto hyperparameters = hyperparameters_;
if (hyperparameters.contains("predict_voting")) {
predict_voting = hyperparameters["predict_voting"];
hyperparameters.erase("predict_voting");
}
Classifier::setHyperparameters(hyperparameters);
}
void A2DE::buildModel(const torch::Tensor& weights)
{
models.clear();
significanceModels.clear();
for (int i = 0; i < features.size() - 1; ++i) {
for (int j = i + 1; j < features.size(); ++j) {
auto model = std::make_unique<SPnDE>(std::vector<int>({ i, j }));
models.push_back(std::move(model));
}
}
n_models = static_cast<unsigned>(models.size());
significanceModels = std::vector<double>(n_models, 1.0);
}
std::vector<std::string> A2DE::graph(const std::string& title) const
{
return Ensemble::graph(title);
}
}

22
bayesnet/ensembles/A2DE.h Normal file
View File

@ -0,0 +1,22 @@
// ***************************************************************
// SPDX-FileCopyrightText: Copyright 2024 Ricardo Montañana Gómez
// SPDX-FileType: SOURCE
// SPDX-License-Identifier: MIT
// ***************************************************************
#ifndef A2DE_H
#define A2DE_H
#include "bayesnet/classifiers/SPnDE.h"
#include "Ensemble.h"
namespace bayesnet {
class A2DE : public Ensemble {
public:
A2DE(bool predict_voting = false);
virtual ~A2DE() {};
void setHyperparameters(const nlohmann::json& hyperparameters) override;
std::vector<std::string> graph(const std::string& title = "A2DE") const override;
protected:
void buildModel(const torch::Tensor& weights) override;
};
}
#endif

View File

@ -9,7 +9,7 @@
namespace bayesnet { namespace bayesnet {
Node::Node(const std::string& name) Node::Node(const std::string& name)
: name(name), numStates(0), cpTable(torch::Tensor()), parents(std::vector<Node*>()), children(std::vector<Node*>()) : name(name)
{ {
} }
void Node::clear() void Node::clear()
@ -96,7 +96,6 @@ namespace bayesnet {
// Get dimensions of the CPT // Get dimensions of the CPT
dimensions.push_back(numStates); dimensions.push_back(numStates);
transform(parents.begin(), parents.end(), back_inserter(dimensions), [](const auto& parent) { return parent->getNumStates(); }); transform(parents.begin(), parents.end(), back_inserter(dimensions), [](const auto& parent) { return parent->getNumStates(); });
// Create a tensor of zeros with the dimensions of the CPT // Create a tensor of zeros with the dimensions of the CPT
cpTable = torch::zeros(dimensions, torch::kFloat) + laplaceSmoothing; cpTable = torch::zeros(dimensions, torch::kFloat) + laplaceSmoothing;
// Fill table with counts // Fill table with counts

View File

@ -12,14 +12,6 @@
#include <torch/torch.h> #include <torch/torch.h>
namespace bayesnet { namespace bayesnet {
class Node { class Node {
private:
std::string name;
std::vector<Node*> parents;
std::vector<Node*> children;
int numStates; // number of states of the variable
torch::Tensor cpTable; // Order of indices is 0-> node variable, 1-> 1st parent, 2-> 2nd parent, ...
std::vector<int64_t> dimensions; // dimensions of the cpTable
std::vector<std::pair<std::string, std::string>> combinations(const std::vector<std::string>&);
public: public:
explicit Node(const std::string&); explicit Node(const std::string&);
void clear(); void clear();
@ -37,6 +29,14 @@ namespace bayesnet {
unsigned minFill(); unsigned minFill();
std::vector<std::string> graph(const std::string& clasName); // Returns a std::vector of std::strings representing the graph in graphviz format std::vector<std::string> graph(const std::string& clasName); // Returns a std::vector of std::strings representing the graph in graphviz format
float getFactorValue(std::map<std::string, int>&); float getFactorValue(std::map<std::string, int>&);
private:
std::string name;
std::vector<Node*> parents;
std::vector<Node*> children;
int numStates = 0; // number of states of the variable
torch::Tensor cpTable; // Order of indices is 0-> node variable, 1-> 1st parent, 2-> 2nd parent, ...
std::vector<int64_t> dimensions; // dimensions of the cpTable
std::vector<std::pair<std::string, std::string>> combinations(const std::vector<std::string>&);
}; };
} }
#endif #endif

View File

@ -4,6 +4,9 @@
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
// *************************************************************** // ***************************************************************
#include <map>
#include <unordered_map>
#include <tuple>
#include "Mst.h" #include "Mst.h"
#include "BayesMetrics.h" #include "BayesMetrics.h"
namespace bayesnet { namespace bayesnet {
@ -105,6 +108,8 @@ namespace bayesnet {
} }
return matrix; return matrix;
} }
// Measured in nats (natural logarithm (log) base e)
// Elements of Information Theory, 2nd Edition, Thomas M. Cover, Joy A. Thomas p. 14
double Metrics::entropy(const torch::Tensor& feature, const torch::Tensor& weights) double Metrics::entropy(const torch::Tensor& feature, const torch::Tensor& weights)
{ {
torch::Tensor counts = feature.bincount(weights); torch::Tensor counts = feature.bincount(weights);
@ -143,11 +148,64 @@ namespace bayesnet {
} }
return entropyValue; return entropyValue;
} }
// H(Y|X,C) = sum_{x in X, c in C} p(x,c) H(Y|X=x,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]);
auto keyMarginal = std::make_tuple(firstFeatureData[i], labelsData[i]);
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_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)
double Metrics::mutualInformation(const torch::Tensor& firstFeature, const torch::Tensor& secondFeature, const torch::Tensor& weights) double Metrics::mutualInformation(const torch::Tensor& firstFeature, const torch::Tensor& secondFeature, const torch::Tensor& weights)
{ {
return entropy(firstFeature, weights) - conditionalEntropy(firstFeature, secondFeature, weights); return entropy(firstFeature, weights) - conditionalEntropy(firstFeature, secondFeature, weights);
} }
// I(X;Y|C) = H(Y|C) - H(Y|X,C)
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);
}
/* /*
Compute the maximum spanning tree considering the weights as distances Compute the maximum spanning tree considering the weights as distances
and the indices of the weights as nodes of this square matrix using and the indices of the weights as nodes of this square matrix using

View File

@ -18,12 +18,16 @@ namespace bayesnet {
std::vector<int> SelectKBestWeighted(const torch::Tensor& weights, bool ascending = false, unsigned k = 0); std::vector<int> SelectKBestWeighted(const torch::Tensor& weights, bool ascending = false, unsigned k = 0);
std::vector<double> getScoresKBest() const; std::vector<double> getScoresKBest() const;
double mutualInformation(const torch::Tensor& firstFeature, const torch::Tensor& secondFeature, const torch::Tensor& weights); 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); torch::Tensor conditionalEdge(const torch::Tensor& weights);
std::vector<std::pair<int, int>> maximumSpanningTree(const std::vector<std::string>& features, const torch::Tensor& weights, const int root); std::vector<std::pair<int, int>> maximumSpanningTree(const std::vector<std::string>& features, const torch::Tensor& weights, const int root);
// Measured in nats (natural logarithm (log) base e)
// Elements of Information Theory, 2nd Edition, Thomas M. Cover, Joy A. Thomas p. 14
double entropy(const torch::Tensor& feature, const torch::Tensor& weights);
double conditionalEntropy(const torch::Tensor& firstFeature, const torch::Tensor& secondFeature, const torch::Tensor& labels, const torch::Tensor& weights);
protected: protected:
torch::Tensor samples; // n+1xm torch::Tensor used to fit the model where samples[-1] is the y std::vector torch::Tensor samples; // n+1xm torch::Tensor used to fit the model where samples[-1] is the y std::vector
std::string className; std::string className;
double entropy(const torch::Tensor& feature, const torch::Tensor& weights);
std::vector<std::string> features; std::vector<std::string> features;
template <class T> template <class T>
std::vector<std::pair<T, T>> doCombinations(const std::vector<T>& source) std::vector<std::pair<T, T>> doCombinations(const std::vector<T>& source)

View File

@ -1,35 +0,0 @@
File verbosity level: 9
date time ( uptime ) [ thread name/id ] file:line v|
2024-04-30 20:24:40.507 ( 0.002s) [BoostAODE ] loguru.cpp:825 INFO| Logging to 'boostAODE.log', mode: 'w', verbosity: 9
2024-04-30 20:24:40.517 ( 0.011s) [BoostAODE ] BoostAODE.cc:321 1| { counter=0 k=1 featureSelection.size: 4
2024-04-30 20:24:40.531 ( 0.025s) [BoostAODE ] BoostAODE.cc:340 2| . { numItemsPack: 1 n_models: 1 featuresUsed: 1
2024-04-30 20:24:40.531 ( 0.025s) [BoostAODE ] BoostAODE.cc:340 2| . } 0.000 s: numItemsPack: 1 n_models: 1 featuresUsed: 1
2024-04-30 20:24:40.533 ( 0.028s) [BoostAODE ] BoostAODE.cc:357 3| . { * (improvement>=threshold) Reset. tolerance: 0 numItemsPack: 1 improvement: 1.000000 prior: 0.933333 current: 0.933333
2024-04-30 20:24:40.533 ( 0.028s) [BoostAODE ] BoostAODE.cc:357 3| . } 0.000 s: * (improvement>=threshold) Reset. tolerance: 0 numItemsPack: 1 improvement: 1.000000 prior: 0.933333 current: 0.933333
2024-04-30 20:24:40.533 ( 0.028s) [BoostAODE ] BoostAODE.cc:369 1| . { tolerance: 0 featuresUsed.size: 1 features.size: 4
2024-04-30 20:24:40.533 ( 0.028s) [BoostAODE ] BoostAODE.cc:369 1| . } 0.000 s: tolerance: 0 featuresUsed.size: 1 features.size: 4
2024-04-30 20:24:40.533 ( 0.028s) [BoostAODE ] BoostAODE.cc:321 1| } 0.016 s: counter=0 k=1 featureSelection.size: 4
2024-04-30 20:24:40.534 ( 0.029s) [BoostAODE ] BoostAODE.cc:321 1| { counter=0 k=1 featureSelection.size: 3
2024-04-30 20:24:40.546 ( 0.040s) [BoostAODE ] BoostAODE.cc:340 2| . { numItemsPack: 1 n_models: 2 featuresUsed: 2
2024-04-30 20:24:40.546 ( 0.040s) [BoostAODE ] BoostAODE.cc:340 2| . } 0.000 s: numItemsPack: 1 n_models: 2 featuresUsed: 2
2024-04-30 20:24:40.549 ( 0.044s) [BoostAODE ] BoostAODE.cc:357 3| . { * (improvement>=threshold) Reset. tolerance: 0 numItemsPack: 1 improvement: 0.033333 prior: 0.933333 current: 0.966667
2024-04-30 20:24:40.549 ( 0.044s) [BoostAODE ] BoostAODE.cc:357 3| . } 0.000 s: * (improvement>=threshold) Reset. tolerance: 0 numItemsPack: 1 improvement: 0.033333 prior: 0.933333 current: 0.966667
2024-04-30 20:24:40.549 ( 0.044s) [BoostAODE ] BoostAODE.cc:369 1| . { tolerance: 0 featuresUsed.size: 2 features.size: 4
2024-04-30 20:24:40.549 ( 0.044s) [BoostAODE ] BoostAODE.cc:369 1| . } 0.000 s: tolerance: 0 featuresUsed.size: 2 features.size: 4
2024-04-30 20:24:40.549 ( 0.044s) [BoostAODE ] BoostAODE.cc:321 1| } 0.015 s: counter=0 k=1 featureSelection.size: 3
2024-04-30 20:24:40.551 ( 0.045s) [BoostAODE ] BoostAODE.cc:321 1| { counter=0 k=1 featureSelection.size: 2
2024-04-30 20:24:40.563 ( 0.058s) [BoostAODE ] BoostAODE.cc:340 2| . { numItemsPack: 1 n_models: 3 featuresUsed: 3
2024-04-30 20:24:40.563 ( 0.058s) [BoostAODE ] BoostAODE.cc:340 2| . } 0.000 s: numItemsPack: 1 n_models: 3 featuresUsed: 3
2024-04-30 20:24:40.568 ( 0.063s) [BoostAODE ] BoostAODE.cc:354 3| . { (improvement<threshold) tolerance: 0 numItemsPack: 1 improvement: -0.033333 prior: 0.966667 current: 0.933333
2024-04-30 20:24:40.568 ( 0.063s) [BoostAODE ] BoostAODE.cc:354 3| . } 0.000 s: (improvement<threshold) tolerance: 0 numItemsPack: 1 improvement: -0.033333 prior: 0.966667 current: 0.933333
2024-04-30 20:24:40.568 ( 0.063s) [BoostAODE ] BoostAODE.cc:369 1| . { tolerance: 1 featuresUsed.size: 3 features.size: 4
2024-04-30 20:24:40.568 ( 0.063s) [BoostAODE ] BoostAODE.cc:369 1| . } 0.000 s: tolerance: 1 featuresUsed.size: 3 features.size: 4
2024-04-30 20:24:40.568 ( 0.063s) [BoostAODE ] BoostAODE.cc:321 1| } 0.018 s: counter=0 k=1 featureSelection.size: 2
2024-04-30 20:24:40.570 ( 0.065s) [BoostAODE ] BoostAODE.cc:321 1| { counter=0 k=2 featureSelection.size: 1
2024-04-30 20:24:40.584 ( 0.079s) [BoostAODE ] BoostAODE.cc:340 2| . { numItemsPack: 2 n_models: 4 featuresUsed: 4
2024-04-30 20:24:40.584 ( 0.079s) [BoostAODE ] BoostAODE.cc:340 2| . } 0.000 s: numItemsPack: 2 n_models: 4 featuresUsed: 4
2024-04-30 20:24:40.590 ( 0.084s) [BoostAODE ] BoostAODE.cc:354 3| . { (improvement<threshold) tolerance: 1 numItemsPack: 2 improvement: 0.000000 prior: 0.933333 current: 0.933333
2024-04-30 20:24:40.590 ( 0.084s) [BoostAODE ] BoostAODE.cc:354 3| . } 0.000 s: (improvement<threshold) tolerance: 1 numItemsPack: 2 improvement: 0.000000 prior: 0.933333 current: 0.933333
2024-04-30 20:24:40.590 ( 0.084s) [BoostAODE ] BoostAODE.cc:369 1| . { tolerance: 2 featuresUsed.size: 4 features.size: 4
2024-04-30 20:24:40.590 ( 0.084s) [BoostAODE ] BoostAODE.cc:369 1| . } 0.000 s: tolerance: 2 featuresUsed.size: 4 features.size: 4
2024-04-30 20:24:40.590 ( 0.084s) [BoostAODE ] BoostAODE.cc:321 1| } 0.020 s: counter=0 k=2 featureSelection.size: 1

Binary file not shown.

View File

@ -1,6 +0,0 @@
filter = bayesnet/
exclude-directories = build_debug/lib/
exclude-directories = build_debug/tests/lib
exclude = bayesnet/utils/loguru.*
print-summary = yes
sort = uncovered-percent

View File

@ -1,121 +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 - coverage.info - BayesNet/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">top level</a> - <a href="index.html">BayesNet/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">coverage.info</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-04-30 13:17:26</td>
<td></td>
<td class="headerItem">Functions:</td>
<td class="headerCovTableEntryLo">50.0&nbsp;%</td>
<td class="headerCovTableEntry">2</td>
<td class="headerCovTableEntry">1</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"> 606 : 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,243 +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 - coverage.info - BayesNet/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">top level</a> - <a href="index.html">BayesNet/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">coverage.info</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-04-30 13:17:26</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><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#L178">_ZN8bayesnet10Classifier17topological_orderB5cxx11Ev</a></td>
<td class="coverFnHi">2</td>
</tr>
<tr>
<td class="coverFn"><a href="Classifier.cc.gcov.html#L182">_ZNK8bayesnet10Classifier8dump_cptB5cxx11Ev</a></td>
<td class="coverFnHi">2</td>
</tr>
<tr>
<td class="coverFn"><a href="Classifier.cc.gcov.html#L142">_ZN8bayesnet10Classifier5scoreERSt6vectorIS1_IiSaIiEESaIS3_EERS3_</a></td>
<td class="coverFnHi">8</td>
</tr>
<tr>
<td class="coverFn"><a href="Classifier.cc.gcov.html#L101">_ZN8bayesnet10Classifier7predictERSt6vectorIS1_IiSaIiEESaIS3_EE</a></td>
<td class="coverFnHi">8</td>
</tr>
<tr>
<td class="coverFn"><a href="Classifier.cc.gcov.html#L170">_ZNK8bayesnet10Classifier17getNumberOfStatesEv</a></td>
<td class="coverFnHi">12</td>
</tr>
<tr>
<td class="coverFn"><a href="Classifier.cc.gcov.html#L149">_ZNK8bayesnet10Classifier4showB5cxx11Ev</a></td>
<td class="coverFnHi">12</td>
</tr>
<tr>
<td class="coverFn"><a href="Classifier.cc.gcov.html#L186">_ZN8bayesnet10Classifier18setHyperparametersERKN8nlohmann16json_abi_v3_11_310basic_jsonISt3mapSt6vectorNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEblmdSaNS2_14adl_serializerES5_IhSaIhEEvEE</a></td>
<td class="coverFnHi">42</td>
</tr>
<tr>
<td class="coverFn"><a href="Classifier.cc.gcov.html#L137">_ZN8bayesnet10Classifier5scoreERN2at6TensorES3_</a></td>
<td class="coverFnHi">56</td>
</tr>
<tr>
<td class="coverFn"><a href="Classifier.cc.gcov.html#L55">_ZN8bayesnet10Classifier3fitERSt6vectorIS1_IiSaIiEESaIS3_EERS3_RKS1_INSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESaISD_EERKSD_RSt3mapISD_S3_St4lessISD_ESaISt4pairISI_S3_EEE</a></td>
<td class="coverFnHi">60</td>
</tr>
<tr>
<td class="coverFn"><a href="Classifier.cc.gcov.html#L47">_ZN8bayesnet10Classifier3fitERN2at6TensorES3_RKSt6vectorINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESaISA_EERKSA_RSt3mapISA_S4_IiSaIiEESt4lessISA_ESaISt4pairISF_SJ_EEE</a></td>
<td class="coverFnHi">64</td>
</tr>
<tr>
<td class="coverFn"><a href="Classifier.cc.gcov.html#L166">_ZNK8bayesnet10Classifier16getNumberOfEdgesEv</a></td>
<td class="coverFnHi">94</td>
</tr>
<tr>
<td class="coverFn"><a href="Classifier.cc.gcov.html#L161">_ZNK8bayesnet10Classifier16getNumberOfNodesEv</a></td>
<td class="coverFnHi">94</td>
</tr>
<tr>
<td class="coverFn"><a href="Classifier.cc.gcov.html#L122">_ZN8bayesnet10Classifier13predict_probaERSt6vectorIS1_IiSaIiEESaIS3_EE</a></td>
<td class="coverFnHi">130</td>
</tr>
<tr>
<td class="coverFn"><a href="Classifier.cc.gcov.html#L28">_ZN8bayesnet10Classifier12buildDatasetERN2at6TensorE</a></td>
<td class="coverFnHi">162</td>
</tr>
<tr>
<td class="coverFn"><a href="Classifier.cc.gcov.html#L174">_ZNK8bayesnet10Classifier17getClassNumStatesEv</a></td>
<td class="coverFnHi">170</td>
</tr>
<tr>
<td class="coverFn"><a href="Classifier.cc.gcov.html#L66">_ZN8bayesnet10Classifier3fitERN2at6TensorERKSt6vectorINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESaISA_EERKSA_RSt3mapISA_S4_IiSaIiEESt4lessISA_ESaISt4pairISF_SJ_EEE</a></td>
<td class="coverFnHi">198</td>
</tr>
<tr>
<td class="coverFn"><a href="Classifier.cc.gcov.html#L72">_ZN8bayesnet10Classifier3fitERN2at6TensorERKSt6vectorINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESaISA_EERKSA_RSt3mapISA_S4_IiSaIiEESt4lessISA_ESaISt4pairISF_SJ_EEERKS2_</a></td>
<td class="coverFnHi">330</td>
</tr>
<tr>
<td class="coverFn"><a href="Classifier.cc.gcov.html#L42">_ZN8bayesnet10Classifier10trainModelERKN2at6TensorE</a></td>
<td class="coverFnHi">560</td>
</tr>
<tr>
<td class="coverFn"><a href="Classifier.cc.gcov.html#L153">_ZN8bayesnet10Classifier8addNodesEv</a></td>
<td class="coverFnHi">560</td>
</tr>
<tr>
<td class="coverFn"><a href="Classifier.cc.gcov.html#L77">_ZN8bayesnet10Classifier18checkFitParametersEv</a></td>
<td class="coverFnHi">644</td>
</tr>
<tr>
<td class="coverFn"><a href="Classifier.cc.gcov.html#L12">_ZN8bayesnet10Classifier5buildERKSt6vectorINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESaIS7_EERKS7_RSt3mapIS7_S1_IiSaIiEESt4lessIS7_ESaISt4pairISC_SG_EEERKN2at6TensorE</a></td>
<td class="coverFnHi">644</td>
</tr>
<tr>
<td class="coverFn"><a href="Classifier.cc.gcov.html#L115">_ZN8bayesnet10Classifier13predict_probaERN2at6TensorE</a></td>
<td class="coverFnHi">742</td>
</tr>
<tr>
<td class="coverFn"><a href="Classifier.cc.gcov.html#L94">_ZN8bayesnet10Classifier7predictERN2at6TensorE</a></td>
<td class="coverFnHi">850</td>
</tr>
<tr>
<td class="coverFn"><a href="Classifier.cc.gcov.html#L10">_ZN8bayesnet10ClassifierC2ENS_7NetworkE</a></td>
<td class="coverFnHi">886</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,243 +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 - coverage.info - BayesNet/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">top level</a> - <a href="index.html">BayesNet/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">coverage.info</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-04-30 13:17:26</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><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#L42">_ZN8bayesnet10Classifier10trainModelERKN2at6TensorE</a></td>
<td class="coverFnHi">560</td>
</tr>
<tr>
<td class="coverFn"><a href="Classifier.cc.gcov.html#L28">_ZN8bayesnet10Classifier12buildDatasetERN2at6TensorE</a></td>
<td class="coverFnHi">162</td>
</tr>
<tr>
<td class="coverFn"><a href="Classifier.cc.gcov.html#L115">_ZN8bayesnet10Classifier13predict_probaERN2at6TensorE</a></td>
<td class="coverFnHi">742</td>
</tr>
<tr>
<td class="coverFn"><a href="Classifier.cc.gcov.html#L122">_ZN8bayesnet10Classifier13predict_probaERSt6vectorIS1_IiSaIiEESaIS3_EE</a></td>
<td class="coverFnHi">130</td>
</tr>
<tr>
<td class="coverFn"><a href="Classifier.cc.gcov.html#L178">_ZN8bayesnet10Classifier17topological_orderB5cxx11Ev</a></td>
<td class="coverFnHi">2</td>
</tr>
<tr>
<td class="coverFn"><a href="Classifier.cc.gcov.html#L77">_ZN8bayesnet10Classifier18checkFitParametersEv</a></td>
<td class="coverFnHi">644</td>
</tr>
<tr>
<td class="coverFn"><a href="Classifier.cc.gcov.html#L186">_ZN8bayesnet10Classifier18setHyperparametersERKN8nlohmann16json_abi_v3_11_310basic_jsonISt3mapSt6vectorNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEblmdSaNS2_14adl_serializerES5_IhSaIhEEvEE</a></td>
<td class="coverFnHi">42</td>
</tr>
<tr>
<td class="coverFn"><a href="Classifier.cc.gcov.html#L66">_ZN8bayesnet10Classifier3fitERN2at6TensorERKSt6vectorINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESaISA_EERKSA_RSt3mapISA_S4_IiSaIiEESt4lessISA_ESaISt4pairISF_SJ_EEE</a></td>
<td class="coverFnHi">198</td>
</tr>
<tr>
<td class="coverFn"><a href="Classifier.cc.gcov.html#L72">_ZN8bayesnet10Classifier3fitERN2at6TensorERKSt6vectorINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESaISA_EERKSA_RSt3mapISA_S4_IiSaIiEESt4lessISA_ESaISt4pairISF_SJ_EEERKS2_</a></td>
<td class="coverFnHi">330</td>
</tr>
<tr>
<td class="coverFn"><a href="Classifier.cc.gcov.html#L47">_ZN8bayesnet10Classifier3fitERN2at6TensorES3_RKSt6vectorINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESaISA_EERKSA_RSt3mapISA_S4_IiSaIiEESt4lessISA_ESaISt4pairISF_SJ_EEE</a></td>
<td class="coverFnHi">64</td>
</tr>
<tr>
<td class="coverFn"><a href="Classifier.cc.gcov.html#L55">_ZN8bayesnet10Classifier3fitERSt6vectorIS1_IiSaIiEESaIS3_EERS3_RKS1_INSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESaISD_EERKSD_RSt3mapISD_S3_St4lessISD_ESaISt4pairISI_S3_EEE</a></td>
<td class="coverFnHi">60</td>
</tr>
<tr>
<td class="coverFn"><a href="Classifier.cc.gcov.html#L12">_ZN8bayesnet10Classifier5buildERKSt6vectorINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESaIS7_EERKS7_RSt3mapIS7_S1_IiSaIiEESt4lessIS7_ESaISt4pairISC_SG_EEERKN2at6TensorE</a></td>
<td class="coverFnHi">644</td>
</tr>
<tr>
<td class="coverFn"><a href="Classifier.cc.gcov.html#L137">_ZN8bayesnet10Classifier5scoreERN2at6TensorES3_</a></td>
<td class="coverFnHi">56</td>
</tr>
<tr>
<td class="coverFn"><a href="Classifier.cc.gcov.html#L142">_ZN8bayesnet10Classifier5scoreERSt6vectorIS1_IiSaIiEESaIS3_EERS3_</a></td>
<td class="coverFnHi">8</td>
</tr>
<tr>
<td class="coverFn"><a href="Classifier.cc.gcov.html#L94">_ZN8bayesnet10Classifier7predictERN2at6TensorE</a></td>
<td class="coverFnHi">850</td>
</tr>
<tr>
<td class="coverFn"><a href="Classifier.cc.gcov.html#L101">_ZN8bayesnet10Classifier7predictERSt6vectorIS1_IiSaIiEESaIS3_EE</a></td>
<td class="coverFnHi">8</td>
</tr>
<tr>
<td class="coverFn"><a href="Classifier.cc.gcov.html#L153">_ZN8bayesnet10Classifier8addNodesEv</a></td>
<td class="coverFnHi">560</td>
</tr>
<tr>
<td class="coverFn"><a href="Classifier.cc.gcov.html#L10">_ZN8bayesnet10ClassifierC2ENS_7NetworkE</a></td>
<td class="coverFnHi">886</td>
</tr>
<tr>
<td class="coverFn"><a href="Classifier.cc.gcov.html#L166">_ZNK8bayesnet10Classifier16getNumberOfEdgesEv</a></td>
<td class="coverFnHi">94</td>
</tr>
<tr>
<td class="coverFn"><a href="Classifier.cc.gcov.html#L161">_ZNK8bayesnet10Classifier16getNumberOfNodesEv</a></td>
<td class="coverFnHi">94</td>
</tr>
<tr>
<td class="coverFn"><a href="Classifier.cc.gcov.html#L174">_ZNK8bayesnet10Classifier17getClassNumStatesEv</a></td>
<td class="coverFnHi">170</td>
</tr>
<tr>
<td class="coverFn"><a href="Classifier.cc.gcov.html#L170">_ZNK8bayesnet10Classifier17getNumberOfStatesEv</a></td>
<td class="coverFnHi">12</td>
</tr>
<tr>
<td class="coverFn"><a href="Classifier.cc.gcov.html#L149">_ZNK8bayesnet10Classifier4showB5cxx11Ev</a></td>
<td class="coverFnHi">12</td>
</tr>
<tr>
<td class="coverFn"><a href="Classifier.cc.gcov.html#L182">_ZNK8bayesnet10Classifier8dump_cptB5cxx11Ev</a></td>
<td class="coverFnHi">2</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,270 +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 - coverage.info - BayesNet/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">top level</a> - <a href="index.html">BayesNet/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">coverage.info</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-04-30 13:17:26</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><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"> 886 : 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"> 644 : 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"> 644 : this-&gt;features = features;</span></span>
<span id="L17"><span class="lineNum"> 17</span> <span class="tlaGNC"> 644 : this-&gt;className = className;</span></span>
<span id="L18"><span class="lineNum"> 18</span> <span class="tlaGNC"> 644 : this-&gt;states = states;</span></span>
<span id="L19"><span class="lineNum"> 19</span> <span class="tlaGNC"> 644 : m = dataset.size(1);</span></span>
<span id="L20"><span class="lineNum"> 20</span> <span class="tlaGNC"> 644 : n = features.size();</span></span>
<span id="L21"><span class="lineNum"> 21</span> <span class="tlaGNC"> 644 : checkFitParameters();</span></span>
<span id="L22"><span class="lineNum"> 22</span> <span class="tlaGNC"> 628 : auto n_classes = states.at(className).size();</span></span>
<span id="L23"><span class="lineNum"> 23</span> <span class="tlaGNC"> 628 : metrics = Metrics(dataset, features, className, n_classes);</span></span>
<span id="L24"><span class="lineNum"> 24</span> <span class="tlaGNC"> 628 : model.initialize();</span></span>
<span id="L25"><span class="lineNum"> 25</span> <span class="tlaGNC"> 628 : buildModel(weights);</span></span>
<span id="L26"><span class="lineNum"> 26</span> <span class="tlaGNC"> 628 : trainModel(weights);</span></span>
<span id="L27"><span class="lineNum"> 27</span> <span class="tlaGNC"> 620 : fitted = true;</span></span>
<span id="L28"><span class="lineNum"> 28</span> <span class="tlaGNC"> 620 : return *this;</span></span>
<span id="L29"><span class="lineNum"> 29</span> : }</span>
<span id="L30"><span class="lineNum"> 30</span> <span class="tlaGNC"> 162 : 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"> 162 : 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"> 502 : dataset = torch::cat({ dataset, yresized }, 0);</span></span>
<span id="L35"><span class="lineNum"> 35</span> <span class="tlaGNC"> 162 : }</span></span>
<span id="L36"><span class="lineNum"> 36</span> <span class="tlaGNC"> 8 : catch (const std::exception&amp; e) {</span></span>
<span id="L37"><span class="lineNum"> 37</span> <span class="tlaGNC"> 8 : std::stringstream oss;</span></span>
<span id="L38"><span class="lineNum"> 38</span> <span class="tlaGNC"> 8 : 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"> 8 : 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"> 8 : oss &lt;&lt; &quot;y dimensions: &quot; &lt;&lt; ytmp.sizes();</span></span>
<span id="L41"><span class="lineNum"> 41</span> <span class="tlaGNC"> 8 : throw std::runtime_error(oss.str());</span></span>
<span id="L42"><span class="lineNum"> 42</span> <span class="tlaGNC"> 16 : }</span></span>
<span id="L43"><span class="lineNum"> 43</span> <span class="tlaGNC"> 324 : }</span></span>
<span id="L44"><span class="lineNum"> 44</span> <span class="tlaGNC"> 560 : 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"> 560 : model.fit(dataset, weights, features, className, states);</span></span>
<span id="L47"><span class="lineNum"> 47</span> <span class="tlaGNC"> 560 : }</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"> 64 : 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"> 64 : dataset = X;</span></span>
<span id="L52"><span class="lineNum"> 52</span> <span class="tlaGNC"> 64 : buildDataset(y);</span></span>
<span id="L53"><span class="lineNum"> 53</span> <span class="tlaGNC"> 60 : 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"> 104 : return build(features, className, states, weights);</span></span>
<span id="L55"><span class="lineNum"> 55</span> <span class="tlaGNC"> 60 : }</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"> 60 : 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"> 60 : 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"> 418 : for (int i = 0; i &lt; X.size(); ++i) {</span></span>
<span id="L61"><span class="lineNum"> 61</span> <span class="tlaGNC"> 1432 : 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"> 60 : auto ytmp = torch::tensor(y, torch::kInt32);</span></span>
<span id="L64"><span class="lineNum"> 64</span> <span class="tlaGNC"> 60 : buildDataset(ytmp);</span></span>
<span id="L65"><span class="lineNum"> 65</span> <span class="tlaGNC"> 56 : 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"> 104 : return build(features, className, states, weights);</span></span>
<span id="L67"><span class="lineNum"> 67</span> <span class="tlaGNC"> 426 : }</span></span>
<span id="L68"><span class="lineNum"> 68</span> <span class="tlaGNC"> 198 : 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"> 198 : this-&gt;dataset = dataset;</span></span>
<span id="L71"><span class="lineNum"> 71</span> <span class="tlaGNC"> 198 : 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"> 396 : return build(features, className, states, weights);</span></span>
<span id="L73"><span class="lineNum"> 73</span> <span class="tlaGNC"> 198 : }</span></span>
<span id="L74"><span class="lineNum"> 74</span> <span class="tlaGNC"> 330 : 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"> 330 : this-&gt;dataset = dataset;</span></span>
<span id="L77"><span class="lineNum"> 77</span> <span class="tlaGNC"> 330 : 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"> 644 : 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"> 644 : if (torch::is_floating_point(dataset)) {</span></span>
<span id="L82"><span class="lineNum"> 82</span> <span class="tlaGNC"> 4 : 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"> 640 : if (dataset.size(0) - 1 != features.size()) {</span></span>
<span id="L85"><span class="lineNum"> 85</span> <span class="tlaGNC"> 4 : 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"> 636 : if (states.find(className) == states.end()) {</span></span>
<span id="L88"><span class="lineNum"> 88</span> <span class="tlaGNC"> 4 : 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"> 14208 : for (auto feature : features) {</span></span>
<span id="L91"><span class="lineNum"> 91</span> <span class="tlaGNC"> 13580 : if (states.find(feature) == states.end()) {</span></span>
<span id="L92"><span class="lineNum"> 92</span> <span class="tlaGNC"> 4 : 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"> 13580 : }</span></span>
<span id="L95"><span class="lineNum"> 95</span> <span class="tlaGNC"> 628 : }</span></span>
<span id="L96"><span class="lineNum"> 96</span> <span class="tlaGNC"> 850 : 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"> 850 : if (!fitted) {</span></span>
<span id="L99"><span class="lineNum"> 99</span> <span class="tlaGNC"> 8 : 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"> 842 : 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"> 8 : 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"> 8 : if (!fitted) {</span></span>
<span id="L106"><span class="lineNum"> 106</span> <span class="tlaGNC"> 4 : 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"> 4 : auto m_ = X[0].size();</span></span>
<span id="L109"><span class="lineNum"> 109</span> <span class="tlaGNC"> 4 : auto n_ = X.size();</span></span>
<span id="L110"><span class="lineNum"> 110</span> <span class="tlaGNC"> 4 : 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"> 20 : for (auto i = 0; i &lt; n_; i++) {</span></span>
<span id="L112"><span class="lineNum"> 112</span> <span class="tlaGNC"> 32 : 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"> 4 : auto yp = model.predict(Xd);</span></span>
<span id="L115"><span class="lineNum"> 115</span> <span class="tlaGNC"> 8 : return yp;</span></span>
<span id="L116"><span class="lineNum"> 116</span> <span class="tlaGNC"> 4 : }</span></span>
<span id="L117"><span class="lineNum"> 117</span> <span class="tlaGNC"> 742 : 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"> 742 : if (!fitted) {</span></span>
<span id="L120"><span class="lineNum"> 120</span> <span class="tlaGNC"> 4 : 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"> 738 : 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"> 130 : 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"> 130 : if (!fitted) {</span></span>
<span id="L127"><span class="lineNum"> 127</span> <span class="tlaGNC"> 4 : 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"> 126 : auto m_ = X[0].size();</span></span>
<span id="L130"><span class="lineNum"> 130</span> <span class="tlaGNC"> 126 : auto n_ = X.size();</span></span>
<span id="L131"><span class="lineNum"> 131</span> <span class="tlaGNC"> 126 : 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"> 1080 : for (auto i = 0; i &lt; n_; i++) {</span></span>
<span id="L134"><span class="lineNum"> 134</span> <span class="tlaGNC"> 1908 : 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"> 126 : auto yp = model.predict_proba(Xd);</span></span>
<span id="L137"><span class="lineNum"> 137</span> <span class="tlaGNC"> 252 : return yp;</span></span>
<span id="L138"><span class="lineNum"> 138</span> <span class="tlaGNC"> 126 : }</span></span>
<span id="L139"><span class="lineNum"> 139</span> <span class="tlaGNC"> 56 : 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"> 56 : torch::Tensor y_pred = predict(X);</span></span>
<span id="L142"><span class="lineNum"> 142</span> <span class="tlaGNC"> 104 : 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"> 52 : }</span></span>
<span id="L144"><span class="lineNum"> 144</span> <span class="tlaGNC"> 8 : 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"> 8 : if (!fitted) {</span></span>
<span id="L147"><span class="lineNum"> 147</span> <span class="tlaGNC"> 4 : 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"> 4 : 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"> 12 : 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"> 12 : 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"> 560 : 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"> 13216 : for (const auto&amp; feature : features) {</span></span>
<span id="L159"><span class="lineNum"> 159</span> <span class="tlaGNC"> 12656 : 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"> 560 : model.addNode(className);</span></span>
<span id="L162"><span class="lineNum"> 162</span> <span class="tlaGNC"> 560 : }</span></span>
<span id="L163"><span class="lineNum"> 163</span> <span class="tlaGNC"> 94 : 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"> 94 : 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"> 94 : 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"> 94 : 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"> 12 : 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"> 12 : 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"> 170 : 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"> 170 : 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"> 2 : 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"> 2 : 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"> 2 : 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"> 2 : 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"> 42 : 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"> 42 : if (!hyperparameters.empty()) {</span></span>
<span id="L191"><span class="lineNum"> 191</span> <span class="tlaGNC"> 4 : 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"> 38 : }</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,117 +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 - coverage.info - BayesNet/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">top level</a> - <a href="index.html">BayesNet/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">coverage.info</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-04-30 13:17:26</td>
<td></td>
<td class="headerItem">Functions:</td>
<td class="headerCovTableEntryMed">80.0&nbsp;%</td>
<td class="headerCovTableEntry">5</td>
<td class="headerCovTableEntry">4</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">_ZN8bayesnet10Classifier10getVersionB5cxx11Ev</a></td>
<td class="coverFnHi">16</td>
</tr>
<tr>
<td class="coverFn"><a href="Classifier.h.gcov.html#L36">_ZNK8bayesnet10Classifier8getNotesB5cxx11Ev</a></td>
<td class="coverFnHi">38</td>
</tr>
<tr>
<td class="coverFn"><a href="Classifier.h.gcov.html#L30">_ZNK8bayesnet10Classifier9getStatusEv</a></td>
<td class="coverFnHi">64</td>
</tr>
<tr>
<td class="coverFn"><a href="Classifier.h.gcov.html#L16">_ZN8bayesnet10ClassifierD0Ev</a></td>
<td class="coverFnHi">606</td>
</tr>
<tr>
<td class="coverFnAlias"><a href="Classifier.h.gcov.html#L16">_ZN8bayesnet10ClassifierD0Ev</a></td>
<td class="coverFnAliasLo">0</td>
</tr>
<tr>
<td class="coverFnAlias"><a href="Classifier.h.gcov.html#L16">_ZN8bayesnet10ClassifierD2Ev</a></td>
<td class="coverFnAliasHi">606</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,117 +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 - coverage.info - BayesNet/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">top level</a> - <a href="index.html">BayesNet/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">coverage.info</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-04-30 13:17:26</td>
<td></td>
<td class="headerItem">Functions:</td>
<td class="headerCovTableEntryMed">80.0&nbsp;%</td>
<td class="headerCovTableEntry">5</td>
<td class="headerCovTableEntry">4</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#L31">_ZN8bayesnet10Classifier10getVersionB5cxx11Ev</a></td>
<td class="coverFnHi">16</td>
</tr>
<tr>
<td class="coverFn"><a href="Classifier.h.gcov.html#L16">_ZN8bayesnet10ClassifierD0Ev</a></td>
<td class="coverFnHi">606</td>
</tr>
<tr>
<td class="coverFnAlias"><a href="Classifier.h.gcov.html#L16">_ZN8bayesnet10ClassifierD0Ev</a></td>
<td class="coverFnAliasLo">0</td>
</tr>
<tr>
<td class="coverFnAlias"><a href="Classifier.h.gcov.html#L16">_ZN8bayesnet10ClassifierD2Ev</a></td>
<td class="coverFnAliasHi">606</td>
</tr>
<tr>
<td class="coverFn"><a href="Classifier.h.gcov.html#L36">_ZNK8bayesnet10Classifier8getNotesB5cxx11Ev</a></td>
<td class="coverFnHi">38</td>
</tr>
<tr>
<td class="coverFn"><a href="Classifier.h.gcov.html#L30">_ZNK8bayesnet10Classifier9getStatusEv</a></td>
<td class="coverFnHi">64</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,141 +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 - coverage.info - BayesNet/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">top level</a> - <a href="index.html">BayesNet/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">coverage.info</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-04-30 13:17:26</td>
<td></td>
<td class="headerItem">Functions:</td>
<td class="headerCovTableEntryMed">80.0&nbsp;%</td>
<td class="headerCovTableEntry">5</td>
<td class="headerCovTableEntry">4</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"> 606 : 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"> 64 : status_t getStatus() const override { return status; }</span></span>
<span id="L33"><span class="lineNum"> 33</span> <span class="tlaGNC"> 48 : 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"> 38 : 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,110 +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 - coverage.info - BayesNet/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">top level</a> - <a href="index.html">BayesNet/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">coverage.info</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-04-30 13:17:26</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><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">_ZNK8bayesnet3KDB5graphERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE</a></td>
<td class="coverFnHi">4</td>
</tr>
<tr>
<td class="coverFn"><a href="KDB.cc.gcov.html#L13">_ZN8bayesnet3KDB18setHyperparametersERKN8nlohmann16json_abi_v3_11_310basic_jsonISt3mapSt6vectorNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEblmdSaNS2_14adl_serializerES5_IhSaIhEEvEE</a></td>
<td class="coverFnHi">6</td>
</tr>
<tr>
<td class="coverFn"><a href="KDB.cc.gcov.html#L26">_ZN8bayesnet3KDB10buildModelERKN2at6TensorE</a></td>
<td class="coverFnHi">26</td>
</tr>
<tr>
<td class="coverFn"><a href="KDB.cc.gcov.html#L8">_ZN8bayesnet3KDBC2Eif</a></td>
<td class="coverFnHi">74</td>
</tr>
<tr>
<td class="coverFn"><a href="KDB.cc.gcov.html#L77">_ZN8bayesnet3KDB11add_m_edgesEiRSt6vectorIiSaIiEERN2at6TensorE</a></td>
<td class="coverFnHi">172</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,110 +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 - coverage.info - BayesNet/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">top level</a> - <a href="index.html">BayesNet/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">coverage.info</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-04-30 13:17:26</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><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#L26">_ZN8bayesnet3KDB10buildModelERKN2at6TensorE</a></td>
<td class="coverFnHi">26</td>
</tr>
<tr>
<td class="coverFn"><a href="KDB.cc.gcov.html#L77">_ZN8bayesnet3KDB11add_m_edgesEiRSt6vectorIiSaIiEERN2at6TensorE</a></td>
<td class="coverFnHi">172</td>
</tr>
<tr>
<td class="coverFn"><a href="KDB.cc.gcov.html#L13">_ZN8bayesnet3KDB18setHyperparametersERKN8nlohmann16json_abi_v3_11_310basic_jsonISt3mapSt6vectorNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEblmdSaNS2_14adl_serializerES5_IhSaIhEEvEE</a></td>
<td class="coverFnHi">6</td>
</tr>
<tr>
<td class="coverFn"><a href="KDB.cc.gcov.html#L8">_ZN8bayesnet3KDBC2Eif</a></td>
<td class="coverFnHi">74</td>
</tr>
<tr>
<td class="coverFn"><a href="KDB.cc.gcov.html#L101">_ZNK8bayesnet3KDB5graphERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE</a></td>
<td class="coverFnHi">4</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,187 +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 - coverage.info - BayesNet/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">top level</a> - <a href="index.html">BayesNet/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">coverage.info</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-04-30 13:17:26</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><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"> 74 : 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"> 222 : 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"> 222 : }</span></span>
<span id="L15"><span class="lineNum"> 15</span> <span class="tlaGNC"> 6 : 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"> 6 : auto hyperparameters = hyperparameters_;</span></span>
<span id="L18"><span class="lineNum"> 18</span> <span class="tlaGNC"> 6 : if (hyperparameters.contains(&quot;k&quot;)) {</span></span>
<span id="L19"><span class="lineNum"> 19</span> <span class="tlaGNC"> 2 : k = hyperparameters[&quot;k&quot;];</span></span>
<span id="L20"><span class="lineNum"> 20</span> <span class="tlaGNC"> 2 : 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"> 6 : if (hyperparameters.contains(&quot;theta&quot;)) {</span></span>
<span id="L23"><span class="lineNum"> 23</span> <span class="tlaGNC"> 2 : theta = hyperparameters[&quot;theta&quot;];</span></span>
<span id="L24"><span class="lineNum"> 24</span> <span class="tlaGNC"> 2 : 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"> 6 : Classifier::setHyperparameters(hyperparameters);</span></span>
<span id="L27"><span class="lineNum"> 27</span> <span class="tlaGNC"> 6 : }</span></span>
<span id="L28"><span class="lineNum"> 28</span> <span class="tlaGNC"> 26 : 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"> 26 : addNodes();</span></span>
<span id="L52"><span class="lineNum"> 52</span> <span class="tlaGNC"> 78 : const torch::Tensor&amp; y = dataset.index({ -1, &quot;...&quot; });</span></span>
<span id="L53"><span class="lineNum"> 53</span> <span class="tlaGNC"> 26 : std::vector&lt;double&gt; mi;</span></span>
<span id="L54"><span class="lineNum"> 54</span> <span class="tlaGNC"> 198 : for (auto i = 0; i &lt; features.size(); i++) {</span></span>
<span id="L55"><span class="lineNum"> 55</span> <span class="tlaGNC"> 516 : torch::Tensor firstFeature = dataset.index({ i, &quot;...&quot; });</span></span>
<span id="L56"><span class="lineNum"> 56</span> <span class="tlaGNC"> 172 : mi.push_back(metrics.mutualInformation(firstFeature, y, weights));</span></span>
<span id="L57"><span class="lineNum"> 57</span> <span class="tlaGNC"> 172 : }</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"> 26 : 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"> 26 : 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"> 26 : auto order = argsort(mi);</span></span>
<span id="L68"><span class="lineNum"> 68</span> <span class="tlaGNC"> 198 : 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"> 172 : 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"> 172 : 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"> 172 : 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"> 224 : }</span></span>
<span id="L79"><span class="lineNum"> 79</span> <span class="tlaGNC"> 172 : 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"> 172 : 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"> 172 : auto cond_w = clone(weights);</span></span>
<span id="L83"><span class="lineNum"> 83</span> <span class="tlaGNC"> 172 : bool exit_cond = k == 0;</span></span>
<span id="L84"><span class="lineNum"> 84</span> <span class="tlaGNC"> 172 : int num = 0;</span></span>
<span id="L85"><span class="lineNum"> 85</span> <span class="tlaGNC"> 502 : while (!exit_cond) {</span></span>
<span id="L86"><span class="lineNum"> 86</span> <span class="tlaGNC"> 1320 : 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"> 330 : auto belongs = find(S.begin(), S.end(), max_minfo) != S.end();</span></span>
<span id="L88"><span class="lineNum"> 88</span> <span class="tlaGNC"> 882 : 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"> 160 : model.addEdge(features[max_minfo], features[idx]);</span></span>
<span id="L91"><span class="lineNum"> 91</span> <span class="tlaGNC"> 160 : 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"> 1320 : cond_w.index_put_({ idx, max_minfo }, -1);</span></span>
<span id="L98"><span class="lineNum"> 98</span> <span class="tlaGNC"> 990 : auto candidates_mask = cond_w.index({ idx, &quot;...&quot; }).gt(theta);</span></span>
<span id="L99"><span class="lineNum"> 99</span> <span class="tlaGNC"> 330 : auto candidates = candidates_mask.nonzero();</span></span>
<span id="L100"><span class="lineNum"> 100</span> <span class="tlaGNC"> 330 : exit_cond = num == n_edges || candidates.size(0) == 0;</span></span>
<span id="L101"><span class="lineNum"> 101</span> <span class="tlaGNC"> 330 : }</span></span>
<span id="L102"><span class="lineNum"> 102</span> <span class="tlaGNC"> 1346 : }</span></span>
<span id="L103"><span class="lineNum"> 103</span> <span class="tlaGNC"> 4 : 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"> 4 : std::string header{ title };</span></span>
<span id="L106"><span class="lineNum"> 106</span> <span class="tlaGNC"> 4 : if (title == &quot;KDB&quot;) {</span></span>
<span id="L107"><span class="lineNum"> 107</span> <span class="tlaGNC"> 4 : 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"> 8 : return model.graph(header);</span></span>
<span id="L110"><span class="lineNum"> 110</span> <span class="tlaGNC"> 4 : }</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,96 +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 - coverage.info - BayesNet/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">top level</a> - <a href="index.html">BayesNet/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">coverage.info</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-04-30 13:17:26</td>
<td></td>
<td class="headerItem">Functions:</td>
<td class="headerCovTableEntryHi">100.0&nbsp;%</td>
<td class="headerCovTableEntry">2</td>
<td class="headerCovTableEntry">2</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">_ZN8bayesnet3KDBD0Ev</a></td>
<td class="coverFnHi">22</td>
</tr>
<tr>
<td class="coverFnAlias"><a href="KDB.h.gcov.html#L20">_ZN8bayesnet3KDBD0Ev</a></td>
<td class="coverFnAliasHi">4</td>
</tr>
<tr>
<td class="coverFnAlias"><a href="KDB.h.gcov.html#L20">_ZN8bayesnet3KDBD2Ev</a></td>
<td class="coverFnAliasHi">18</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,96 +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 - coverage.info - BayesNet/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">top level</a> - <a href="index.html">BayesNet/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">coverage.info</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-04-30 13:17:26</td>
<td></td>
<td class="headerItem">Functions:</td>
<td class="headerCovTableEntryHi">100.0&nbsp;%</td>
<td class="headerCovTableEntry">2</td>
<td class="headerCovTableEntry">2</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">_ZN8bayesnet3KDBD0Ev</a></td>
<td class="coverFnHi">22</td>
</tr>
<tr>
<td class="coverFnAlias"><a href="KDB.h.gcov.html#L20">_ZN8bayesnet3KDBD0Ev</a></td>
<td class="coverFnAliasHi">4</td>
</tr>
<tr>
<td class="coverFnAlias"><a href="KDB.h.gcov.html#L20">_ZN8bayesnet3KDBD2Ev</a></td>
<td class="coverFnAliasHi">18</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,103 +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 - coverage.info - BayesNet/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">top level</a> - <a href="index.html">BayesNet/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">coverage.info</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-04-30 13:17:26</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><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">_ZNK8bayesnet5KDBLd5graphERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE</a></td>
<td class="coverFnHi">2</td>
</tr>
<tr>
<td class="coverFn"><a href="KDBLd.cc.gcov.html#L24">_ZN8bayesnet5KDBLd7predictERN2at6TensorE</a></td>
<td class="coverFnHi">8</td>
</tr>
<tr>
<td class="coverFn"><a href="KDBLd.cc.gcov.html#L9">_ZN8bayesnet5KDBLd3fitERN2at6TensorES3_RKSt6vectorINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESaISA_EERKSA_RSt3mapISA_S4_IiSaIiEESt4lessISA_ESaISt4pairISF_SJ_EEE</a></td>
<td class="coverFnHi">10</td>
</tr>
<tr>
<td class="coverFn"><a href="KDBLd.cc.gcov.html#L8">_ZN8bayesnet5KDBLdC2Ei</a></td>
<td class="coverFnHi">34</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,103 +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 - coverage.info - BayesNet/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">top level</a> - <a href="index.html">BayesNet/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">coverage.info</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-04-30 13:17:26</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><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#L9">_ZN8bayesnet5KDBLd3fitERN2at6TensorES3_RKSt6vectorINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESaISA_EERKSA_RSt3mapISA_S4_IiSaIiEESt4lessISA_ESaISt4pairISF_SJ_EEE</a></td>
<td class="coverFnHi">10</td>
</tr>
<tr>
<td class="coverFn"><a href="KDBLd.cc.gcov.html#L24">_ZN8bayesnet5KDBLd7predictERN2at6TensorE</a></td>
<td class="coverFnHi">8</td>
</tr>
<tr>
<td class="coverFn"><a href="KDBLd.cc.gcov.html#L8">_ZN8bayesnet5KDBLdC2Ei</a></td>
<td class="coverFnHi">34</td>
</tr>
<tr>
<td class="coverFn"><a href="KDBLd.cc.gcov.html#L29">_ZNK8bayesnet5KDBLd5graphERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE</a></td>
<td class="coverFnHi">2</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 - coverage.info - BayesNet/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">top level</a> - <a href="index.html">BayesNet/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">coverage.info</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-04-30 13:17:26</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><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"> 34 : KDBLd::KDBLd(int k) : KDB(k), Proposal(dataset, features, className) {}</span></span>
<span id="L11"><span class="lineNum"> 11</span> <span class="tlaGNC"> 10 : 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"> 10 : checkInput(X_, y_);</span></span>
<span id="L14"><span class="lineNum"> 14</span> <span class="tlaGNC"> 10 : features = features_;</span></span>
<span id="L15"><span class="lineNum"> 15</span> <span class="tlaGNC"> 10 : className = className_;</span></span>
<span id="L16"><span class="lineNum"> 16</span> <span class="tlaGNC"> 10 : Xf = X_;</span></span>
<span id="L17"><span class="lineNum"> 17</span> <span class="tlaGNC"> 10 : 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"> 10 : 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"> 10 : KDB::fit(dataset, features, className, states);</span></span>
<span id="L23"><span class="lineNum"> 23</span> <span class="tlaGNC"> 10 : states = localDiscretizationProposal(states, model);</span></span>
<span id="L24"><span class="lineNum"> 24</span> <span class="tlaGNC"> 10 : return *this;</span></span>
<span id="L25"><span class="lineNum"> 25</span> : }</span>
<span id="L26"><span class="lineNum"> 26</span> <span class="tlaGNC"> 8 : 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"> 8 : auto Xt = prepareX(X);</span></span>
<span id="L29"><span class="lineNum"> 29</span> <span class="tlaGNC"> 16 : return KDB::predict(Xt);</span></span>
<span id="L30"><span class="lineNum"> 30</span> <span class="tlaGNC"> 8 : }</span></span>
<span id="L31"><span class="lineNum"> 31</span> <span class="tlaGNC"> 2 : 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"> 2 : 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,96 +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 - coverage.info - BayesNet/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">top level</a> - <a href="index.html">BayesNet/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">coverage.info</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-04-30 13:17:26</td>
<td></td>
<td class="headerItem">Functions:</td>
<td class="headerCovTableEntryHi">100.0&nbsp;%</td>
<td class="headerCovTableEntry">2</td>
<td class="headerCovTableEntry">2</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">_ZN8bayesnet5KDBLdD0Ev</a></td>
<td class="coverFnHi">10</td>
</tr>
<tr>
<td class="coverFnAlias"><a href="KDBLd.h.gcov.html#L15">_ZN8bayesnet5KDBLdD0Ev</a></td>
<td class="coverFnAliasHi">4</td>
</tr>
<tr>
<td class="coverFnAlias"><a href="KDBLd.h.gcov.html#L15">_ZN8bayesnet5KDBLdD2Ev</a></td>
<td class="coverFnAliasHi">6</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,96 +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 - coverage.info - BayesNet/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">top level</a> - <a href="index.html">BayesNet/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">coverage.info</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-04-30 13:17:26</td>
<td></td>
<td class="headerItem">Functions:</td>
<td class="headerCovTableEntryHi">100.0&nbsp;%</td>
<td class="headerCovTableEntry">2</td>
<td class="headerCovTableEntry">2</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">_ZN8bayesnet5KDBLdD0Ev</a></td>
<td class="coverFnHi">10</td>
</tr>
<tr>
<td class="coverFnAlias"><a href="KDBLd.h.gcov.html#L15">_ZN8bayesnet5KDBLdD0Ev</a></td>
<td class="coverFnAliasHi">4</td>
</tr>
<tr>
<td class="coverFnAlias"><a href="KDBLd.h.gcov.html#L15">_ZN8bayesnet5KDBLdD2Ev</a></td>
<td class="coverFnAliasHi">6</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,100 +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 - coverage.info - BayesNet/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">top level</a> - <a href="index.html">BayesNet/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">coverage.info</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-04-30 13:17:26</td>
<td></td>
<td class="headerItem">Functions:</td>
<td class="headerCovTableEntryHi">100.0&nbsp;%</td>
<td class="headerCovTableEntry">2</td>
<td class="headerCovTableEntry">2</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"> 10 : 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,145 +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 - coverage.info - BayesNet/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">top level</a> - <a href="index.html">BayesNet/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">coverage.info</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-04-30 13:17:26</td>
<td></td>
<td class="headerItem">Functions:</td>
<td class="headerCovTableEntryMed">88.9&nbsp;%</td>
<td class="headerCovTableEntry">9</td>
<td class="headerCovTableEntry">8</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">_ZN8bayesnet8Proposal8prepareXERN2at6TensorE</a></td>
<td class="coverFnHi">84</td>
</tr>
<tr>
<td class="coverFn"><a href="Proposal.cc.gcov.html#L10">_ZN8bayesnet8ProposalD0Ev</a></td>
<td class="coverFnHi">100</td>
</tr>
<tr>
<td class="coverFnAlias"><a href="Proposal.cc.gcov.html#L10">_ZN8bayesnet8ProposalD0Ev</a></td>
<td class="coverFnAliasLo">0</td>
</tr>
<tr>
<td class="coverFnAlias"><a href="Proposal.cc.gcov.html#L10">_ZN8bayesnet8ProposalD2Ev</a></td>
<td class="coverFnAliasHi">100</td>
</tr>
<tr>
<td class="coverFn"><a href="Proposal.cc.gcov.html#L25">_ZN8bayesnet8Proposal27localDiscretizationProposalERKSt3mapINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESt6vectorIiSaIiEESt4lessIS7_ESaISt4pairIKS7_SA_EEERNS_7NetworkE</a></td>
<td class="coverFnHi">106</td>
</tr>
<tr>
<td class="coverFn"><a href="Proposal.cc.gcov.html#L16">_ZN8bayesnet8Proposal10checkInputERKN2at6TensorES4_</a></td>
<td class="coverFnHi">114</td>
</tr>
<tr>
<td class="coverFn"><a href="Proposal.cc.gcov.html#L77">_ZN8bayesnet8Proposal24fit_local_discretizationB5cxx11ERKN2at6TensorE</a></td>
<td class="coverFnHi">116</td>
</tr>
<tr>
<td class="coverFn"><a href="Proposal.cc.gcov.html#L9">_ZN8bayesnet8ProposalC2ERN2at6TensorERSt6vectorINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESaISA_EERSA_</a></td>
<td class="coverFnHi">212</td>
</tr>
<tr>
<td class="coverFn"><a href="Proposal.cc.gcov.html#L47">_ZZN8bayesnet8Proposal27localDiscretizationProposalERKSt3mapINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESt6vectorIiSaIiEESt4lessIS7_ESaISt4pairIKS7_SA_EEERNS_7NetworkEENKUlRKT_E0_clIS7_EEDaSO_</a></td>
<td class="coverFnHi">686</td>
</tr>
<tr>
<td class="coverFn"><a href="Proposal.cc.gcov.html#L41">_ZZN8bayesnet8Proposal27localDiscretizationProposalERKSt3mapINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESt6vectorIiSaIiEESt4lessIS7_ESaISt4pairIKS7_SA_EEERNS_7NetworkEENKUlRKT_E_clIPNS_4NodeEEEDaSO_</a></td>
<td class="coverFnHi">1348</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,145 +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 - coverage.info - BayesNet/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">top level</a> - <a href="index.html">BayesNet/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">coverage.info</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-04-30 13:17:26</td>
<td></td>
<td class="headerItem">Functions:</td>
<td class="headerCovTableEntryMed">88.9&nbsp;%</td>
<td class="headerCovTableEntry">9</td>
<td class="headerCovTableEntry">8</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#L16">_ZN8bayesnet8Proposal10checkInputERKN2at6TensorES4_</a></td>
<td class="coverFnHi">114</td>
</tr>
<tr>
<td class="coverFn"><a href="Proposal.cc.gcov.html#L77">_ZN8bayesnet8Proposal24fit_local_discretizationB5cxx11ERKN2at6TensorE</a></td>
<td class="coverFnHi">116</td>
</tr>
<tr>
<td class="coverFn"><a href="Proposal.cc.gcov.html#L25">_ZN8bayesnet8Proposal27localDiscretizationProposalERKSt3mapINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESt6vectorIiSaIiEESt4lessIS7_ESaISt4pairIKS7_SA_EEERNS_7NetworkE</a></td>
<td class="coverFnHi">106</td>
</tr>
<tr>
<td class="coverFn"><a href="Proposal.cc.gcov.html#L104">_ZN8bayesnet8Proposal8prepareXERN2at6TensorE</a></td>
<td class="coverFnHi">84</td>
</tr>
<tr>
<td class="coverFn"><a href="Proposal.cc.gcov.html#L9">_ZN8bayesnet8ProposalC2ERN2at6TensorERSt6vectorINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESaISA_EERSA_</a></td>
<td class="coverFnHi">212</td>
</tr>
<tr>
<td class="coverFn"><a href="Proposal.cc.gcov.html#L10">_ZN8bayesnet8ProposalD0Ev</a></td>
<td class="coverFnHi">100</td>
</tr>
<tr>
<td class="coverFnAlias"><a href="Proposal.cc.gcov.html#L10">_ZN8bayesnet8ProposalD0Ev</a></td>
<td class="coverFnAliasLo">0</td>
</tr>
<tr>
<td class="coverFnAlias"><a href="Proposal.cc.gcov.html#L10">_ZN8bayesnet8ProposalD2Ev</a></td>
<td class="coverFnAliasHi">100</td>
</tr>
<tr>
<td class="coverFn"><a href="Proposal.cc.gcov.html#L47">_ZZN8bayesnet8Proposal27localDiscretizationProposalERKSt3mapINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESt6vectorIiSaIiEESt4lessIS7_ESaISt4pairIKS7_SA_EEERNS_7NetworkEENKUlRKT_E0_clIS7_EEDaSO_</a></td>
<td class="coverFnHi">686</td>
</tr>
<tr>
<td class="coverFn"><a href="Proposal.cc.gcov.html#L41">_ZZN8bayesnet8Proposal27localDiscretizationProposalERKSt3mapINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESt6vectorIiSaIiEESt4lessIS7_ESaISt4pairIKS7_SA_EEERNS_7NetworkEENKUlRKT_E_clIPNS_4NodeEEEDaSO_</a></td>
<td class="coverFnHi">1348</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,192 +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 - coverage.info - BayesNet/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">top level</a> - <a href="index.html">BayesNet/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">coverage.info</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-04-30 13:17:26</td>
<td></td>
<td class="headerItem">Functions:</td>
<td class="headerCovTableEntryMed">88.9&nbsp;%</td>
<td class="headerCovTableEntry">9</td>
<td class="headerCovTableEntry">8</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"> 212 : 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"> 100 : Proposal::~Proposal()</span></span>
<span id="L13"><span class="lineNum"> 13</span> : {</span>
<span id="L14"><span class="lineNum"> 14</span> <span class="tlaGNC"> 948 : for (auto&amp; [key, value] : discretizers) {</span></span>
<span id="L15"><span class="lineNum"> 15</span> <span class="tlaGNC"> 848 : delete value;</span></span>
<span id="L16"><span class="lineNum"> 16</span> : }</span>
<span id="L17"><span class="lineNum"> 17</span> <span class="tlaGNC"> 100 : }</span></span>
<span id="L18"><span class="lineNum"> 18</span> <span class="tlaGNC"> 114 : 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"> 114 : 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"> 114 : 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"> 114 : }</span></span>
<span id="L27"><span class="lineNum"> 27</span> <span class="tlaGNC"> 106 : 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"> 106 : auto order = model.topological_sort();</span></span>
<span id="L32"><span class="lineNum"> 32</span> <span class="tlaGNC"> 106 : auto&amp; nodes = model.getNodes();</span></span>
<span id="L33"><span class="lineNum"> 33</span> <span class="tlaGNC"> 106 : 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"> 106 : std::vector&lt;int&gt; indicesToReDiscretize;</span></span>
<span id="L35"><span class="lineNum"> 35</span> <span class="tlaGNC"> 106 : 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"> 888 : for (auto feature : order) {</span></span>
<span id="L37"><span class="lineNum"> 37</span> <span class="tlaGNC"> 782 : auto nodeParents = nodes[feature]-&gt;getParents();</span></span>
<span id="L38"><span class="lineNum"> 38</span> <span class="tlaGNC"> 782 : if (nodeParents.size() &lt; 2) continue; // Only has class as parent</span></span>
<span id="L39"><span class="lineNum"> 39</span> <span class="tlaGNC"> 662 : upgrade = true;</span></span>
<span id="L40"><span class="lineNum"> 40</span> <span class="tlaGNC"> 662 : int index = find(pFeatures.begin(), pFeatures.end(), feature) - pFeatures.begin();</span></span>
<span id="L41"><span class="lineNum"> 41</span> <span class="tlaGNC"> 662 : indicesToReDiscretize.push_back(index); // We need to re-discretize this feature</span></span>
<span id="L42"><span class="lineNum"> 42</span> <span class="tlaGNC"> 662 : std::vector&lt;std::string&gt; parents;</span></span>
<span id="L43"><span class="lineNum"> 43</span> <span class="tlaGNC"> 2010 : 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"> 662 : 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"> 662 : std::vector&lt;int&gt; indices;</span></span>
<span id="L48"><span class="lineNum"> 48</span> <span class="tlaGNC"> 662 : indices.push_back(-1); // Add class index</span></span>
<span id="L49"><span class="lineNum"> 49</span> <span class="tlaGNC"> 1348 : 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"> 662 : std::vector&lt;std::string&gt; yJoinParents(Xf.size(1));</span></span>
<span id="L52"><span class="lineNum"> 52</span> <span class="tlaGNC"> 2010 : for (auto idx : indices) {</span></span>
<span id="L53"><span class="lineNum"> 53</span> <span class="tlaGNC"> 479320 : for (int i = 0; i &lt; Xf.size(1); ++i) {</span></span>
<span id="L54"><span class="lineNum"> 54</span> <span class="tlaGNC"> 1433916 : 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"> 662 : auto arff = ArffFiles();</span></span>
<span id="L58"><span class="lineNum"> 58</span> <span class="tlaGNC"> 662 : auto yxv = arff.factorize(yJoinParents);</span></span>
<span id="L59"><span class="lineNum"> 59</span> <span class="tlaGNC"> 1324 : auto xvf_ptr = Xf.index({ index }).data_ptr&lt;float&gt;();</span></span>
<span id="L60"><span class="lineNum"> 60</span> <span class="tlaGNC"> 662 : 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"> 662 : discretizers[feature]-&gt;fit(xvf, yxv);</span></span>
<span id="L62"><span class="lineNum"> 62</span> <span class="tlaGNC"> 902 : }</span></span>
<span id="L63"><span class="lineNum"> 63</span> <span class="tlaGNC"> 106 : 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"> 768 : for (auto index : indicesToReDiscretize) {</span></span>
<span id="L66"><span class="lineNum"> 66</span> <span class="tlaGNC"> 1324 : auto Xt_ptr = Xf.index({ index }).data_ptr&lt;float&gt;();</span></span>
<span id="L67"><span class="lineNum"> 67</span> <span class="tlaGNC"> 662 : 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"> 2648 : 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"> 662 : 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"> 662 : 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"> 662 : states[pFeatures[index]] = xStates;</span></span>
<span id="L73"><span class="lineNum"> 73</span> <span class="tlaGNC"> 662 : }</span></span>
<span id="L74"><span class="lineNum"> 74</span> <span class="tlaGNC"> 106 : 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"> 106 : model.fit(pDataset, weights, pFeatures, pClassName, states);</span></span>
<span id="L76"><span class="lineNum"> 76</span> <span class="tlaGNC"> 106 : }</span></span>
<span id="L77"><span class="lineNum"> 77</span> <span class="tlaGNC"> 212 : return states;</span></span>
<span id="L78"><span class="lineNum"> 78</span> <span class="tlaGNC"> 480064 : }</span></span>
<span id="L79"><span class="lineNum"> 79</span> <span class="tlaGNC"> 116 : 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"> 116 : int m = Xf.size(1);</span></span>
<span id="L83"><span class="lineNum"> 83</span> <span class="tlaGNC"> 116 : int n = Xf.size(0);</span></span>
<span id="L84"><span class="lineNum"> 84</span> <span class="tlaGNC"> 116 : map&lt;std::string, std::vector&lt;int&gt;&gt; states;</span></span>
<span id="L85"><span class="lineNum"> 85</span> <span class="tlaGNC"> 116 : pDataset = torch::zeros({ n + 1, m }, torch::kInt32);</span></span>
<span id="L86"><span class="lineNum"> 86</span> <span class="tlaGNC"> 116 : 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"> 972 : for (auto i = 0; i &lt; pFeatures.size(); ++i) {</span></span>
<span id="L89"><span class="lineNum"> 89</span> <span class="tlaGNC"> 856 : auto* discretizer = new mdlp::CPPFImdlp();</span></span>
<span id="L90"><span class="lineNum"> 90</span> <span class="tlaGNC"> 1712 : auto Xt_ptr = Xf.index({ i }).data_ptr&lt;float&gt;();</span></span>
<span id="L91"><span class="lineNum"> 91</span> <span class="tlaGNC"> 856 : 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"> 856 : discretizer-&gt;fit(Xt, yv);</span></span>
<span id="L93"><span class="lineNum"> 93</span> <span class="tlaGNC"> 3424 : 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"> 856 : 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"> 856 : iota(xStates.begin(), xStates.end(), 0);</span></span>
<span id="L96"><span class="lineNum"> 96</span> <span class="tlaGNC"> 856 : states[pFeatures[i]] = xStates;</span></span>
<span id="L97"><span class="lineNum"> 97</span> <span class="tlaGNC"> 856 : discretizers[pFeatures[i]] = discretizer;</span></span>
<span id="L98"><span class="lineNum"> 98</span> <span class="tlaGNC"> 856 : }</span></span>
<span id="L99"><span class="lineNum"> 99</span> <span class="tlaGNC"> 116 : int n_classes = torch::max(y).item&lt;int&gt;() + 1;</span></span>
<span id="L100"><span class="lineNum"> 100</span> <span class="tlaGNC"> 116 : auto yStates = std::vector&lt;int&gt;(n_classes);</span></span>
<span id="L101"><span class="lineNum"> 101</span> <span class="tlaGNC"> 116 : iota(yStates.begin(), yStates.end(), 0);</span></span>
<span id="L102"><span class="lineNum"> 102</span> <span class="tlaGNC"> 116 : states[pClassName] = yStates;</span></span>
<span id="L103"><span class="lineNum"> 103</span> <span class="tlaGNC"> 348 : pDataset.index_put_({ n, &quot;...&quot; }, y);</span></span>
<span id="L104"><span class="lineNum"> 104</span> <span class="tlaGNC"> 232 : return states;</span></span>
<span id="L105"><span class="lineNum"> 105</span> <span class="tlaGNC"> 1944 : }</span></span>
<span id="L106"><span class="lineNum"> 106</span> <span class="tlaGNC"> 84 : 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"> 84 : auto Xtd = torch::zeros_like(X, torch::kInt32);</span></span>
<span id="L109"><span class="lineNum"> 109</span> <span class="tlaGNC"> 688 : for (int i = 0; i &lt; X.size(0); ++i) {</span></span>
<span id="L110"><span class="lineNum"> 110</span> <span class="tlaGNC"> 604 : 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"> 604 : auto Xd = discretizers[pFeatures[i]]-&gt;transform(Xt);</span></span>
<span id="L112"><span class="lineNum"> 112</span> <span class="tlaGNC"> 1812 : Xtd.index_put_({ i }, torch::tensor(Xd, torch::kInt32));</span></span>
<span id="L113"><span class="lineNum"> 113</span> <span class="tlaGNC"> 604 : }</span></span>
<span id="L114"><span class="lineNum"> 114</span> <span class="tlaGNC"> 84 : return Xtd;</span></span>
<span id="L115"><span class="lineNum"> 115</span> <span class="tlaGNC"> 604 : }</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,96 +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 - coverage.info - BayesNet/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">top level</a> - <a href="index.html">BayesNet/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">coverage.info</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-04-30 13:17:26</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><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">_ZNK8bayesnet5SPODE5graphERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE</a></td>
<td class="coverFnHi">34</td>
</tr>
<tr>
<td class="coverFn"><a href="SPODE.cc.gcov.html#L11">_ZN8bayesnet5SPODE10buildModelERKN2at6TensorE</a></td>
<td class="coverFnHi">508</td>
</tr>
<tr>
<td class="coverFn"><a href="SPODE.cc.gcov.html#L9">_ZN8bayesnet5SPODEC2Ei</a></td>
<td class="coverFnHi">562</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,96 +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 - coverage.info - BayesNet/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">top level</a> - <a href="index.html">BayesNet/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">coverage.info</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-04-30 13:17:26</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><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#L11">_ZN8bayesnet5SPODE10buildModelERKN2at6TensorE</a></td>
<td class="coverFnHi">508</td>
</tr>
<tr>
<td class="coverFn"><a href="SPODE.cc.gcov.html#L9">_ZN8bayesnet5SPODEC2Ei</a></td>
<td class="coverFnHi">562</td>
</tr>
<tr>
<td class="coverFn"><a href="SPODE.cc.gcov.html#L24">_ZNK8bayesnet5SPODE5graphERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE</a></td>
<td class="coverFnHi">34</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,96 +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 - coverage.info - BayesNet/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">top level</a> - <a href="index.html">BayesNet/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">coverage.info</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-04-30 13:17:26</td>
<td></td>
<td class="headerItem">Functions:</td>
<td class="headerCovTableEntryHi">100.0&nbsp;%</td>
<td class="headerCovTableEntry">2</td>
<td class="headerCovTableEntry">2</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">_ZN8bayesnet5SPODED0Ev</a></td>
<td class="coverFnHi">918</td>
</tr>
<tr>
<td class="coverFnAlias"><a href="SPODE.h.gcov.html#L17">_ZN8bayesnet5SPODED0Ev</a></td>
<td class="coverFnAliasHi">418</td>
</tr>
<tr>
<td class="coverFnAlias"><a href="SPODE.h.gcov.html#L17">_ZN8bayesnet5SPODED2Ev</a></td>
<td class="coverFnAliasHi">500</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,96 +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 - coverage.info - BayesNet/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">top level</a> - <a href="index.html">BayesNet/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">coverage.info</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-04-30 13:17:26</td>
<td></td>
<td class="headerItem">Functions:</td>
<td class="headerCovTableEntryHi">100.0&nbsp;%</td>
<td class="headerCovTableEntry">2</td>
<td class="headerCovTableEntry">2</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">_ZN8bayesnet5SPODED0Ev</a></td>
<td class="coverFnHi">918</td>
</tr>
<tr>
<td class="coverFnAlias"><a href="SPODE.h.gcov.html#L17">_ZN8bayesnet5SPODED0Ev</a></td>
<td class="coverFnAliasHi">418</td>
</tr>
<tr>
<td class="coverFnAlias"><a href="SPODE.h.gcov.html#L17">_ZN8bayesnet5SPODED2Ev</a></td>
<td class="coverFnAliasHi">500</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,99 +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 - coverage.info - BayesNet/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">top level</a> - <a href="index.html">BayesNet/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">coverage.info</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-04-30 13:17:26</td>
<td></td>
<td class="headerItem">Functions:</td>
<td class="headerCovTableEntryHi">100.0&nbsp;%</td>
<td class="headerCovTableEntry">2</td>
<td class="headerCovTableEntry">2</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"> 918 : 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,117 +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 - coverage.info - BayesNet/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">top level</a> - <a href="index.html">BayesNet/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">coverage.info</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-04-30 13:17:26</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><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">_ZN8bayesnet7SPODELd3fitERN2at6TensorERKSt6vectorINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESaISA_EERKSA_RSt3mapISA_S4_IiSaIiEESt4lessISA_ESaISt4pairISF_SJ_EEE</a></td>
<td class="coverFnHi">4</td>
</tr>
<tr>
<td class="coverFn"><a href="SPODELd.cc.gcov.html#L44">_ZNK8bayesnet7SPODELd5graphERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE</a></td>
<td class="coverFnHi">18</td>
</tr>
<tr>
<td class="coverFn"><a href="SPODELd.cc.gcov.html#L39">_ZN8bayesnet7SPODELd7predictERN2at6TensorE</a></td>
<td class="coverFnHi">68</td>
</tr>
<tr>
<td class="coverFn"><a href="SPODELd.cc.gcov.html#L9">_ZN8bayesnet7SPODELd3fitERN2at6TensorES3_RKSt6vectorINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESaISA_EERKSA_RSt3mapISA_S4_IiSaIiEESt4lessISA_ESaISt4pairISF_SJ_EEE</a></td>
<td class="coverFnHi">84</td>
</tr>
<tr>
<td class="coverFn"><a href="SPODELd.cc.gcov.html#L27">_ZN8bayesnet7SPODELd9commonFitERKSt6vectorINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESaIS7_EERKS7_RSt3mapIS7_S1_IiSaIiEESt4lessIS7_ESaISt4pairISC_SG_EEE</a></td>
<td class="coverFnHi">86</td>
</tr>
<tr>
<td class="coverFn"><a href="SPODELd.cc.gcov.html#L8">_ZN8bayesnet7SPODELdC2Ei</a></td>
<td class="coverFnHi">110</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,117 +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 - coverage.info - BayesNet/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">top level</a> - <a href="index.html">BayesNet/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">coverage.info</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-04-30 13:17:26</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><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#L17">_ZN8bayesnet7SPODELd3fitERN2at6TensorERKSt6vectorINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESaISA_EERKSA_RSt3mapISA_S4_IiSaIiEESt4lessISA_ESaISt4pairISF_SJ_EEE</a></td>
<td class="coverFnHi">4</td>
</tr>
<tr>
<td class="coverFn"><a href="SPODELd.cc.gcov.html#L9">_ZN8bayesnet7SPODELd3fitERN2at6TensorES3_RKSt6vectorINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESaISA_EERKSA_RSt3mapISA_S4_IiSaIiEESt4lessISA_ESaISt4pairISF_SJ_EEE</a></td>
<td class="coverFnHi">84</td>
</tr>
<tr>
<td class="coverFn"><a href="SPODELd.cc.gcov.html#L39">_ZN8bayesnet7SPODELd7predictERN2at6TensorE</a></td>
<td class="coverFnHi">68</td>
</tr>
<tr>
<td class="coverFn"><a href="SPODELd.cc.gcov.html#L27">_ZN8bayesnet7SPODELd9commonFitERKSt6vectorINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESaIS7_EERKS7_RSt3mapIS7_S1_IiSaIiEESt4lessIS7_ESaISt4pairISC_SG_EEE</a></td>
<td class="coverFnHi">86</td>
</tr>
<tr>
<td class="coverFn"><a href="SPODELd.cc.gcov.html#L8">_ZN8bayesnet7SPODELdC2Ei</a></td>
<td class="coverFnHi">110</td>
</tr>
<tr>
<td class="coverFn"><a href="SPODELd.cc.gcov.html#L44">_ZNK8bayesnet7SPODELd5graphERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE</a></td>
<td class="coverFnHi">18</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,126 +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 - coverage.info - BayesNet/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">top level</a> - <a href="index.html">BayesNet/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">coverage.info</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-04-30 13:17:26</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><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"> 110 : SPODELd::SPODELd(int root) : SPODE(root), Proposal(dataset, features, className) {}</span></span>
<span id="L11"><span class="lineNum"> 11</span> <span class="tlaGNC"> 84 : 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"> 84 : checkInput(X_, y_);</span></span>
<span id="L14"><span class="lineNum"> 14</span> <span class="tlaGNC"> 84 : Xf = X_;</span></span>
<span id="L15"><span class="lineNum"> 15</span> <span class="tlaGNC"> 84 : y = y_;</span></span>
<span id="L16"><span class="lineNum"> 16</span> <span class="tlaGNC"> 84 : 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"> 4 : 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"> 4 : if (!torch::is_floating_point(dataset)) {</span></span>
<span id="L22"><span class="lineNum"> 22</span> <span class="tlaGNC"> 2 : 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"> 8 : 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"> 6 : y = dataset.index({ -1, &quot;...&quot; }).clone().to(torch::kInt32);</span></span>
<span id="L26"><span class="lineNum"> 26</span> <span class="tlaGNC"> 2 : return commonFit(features_, className_, states_);</span></span>
<span id="L27"><span class="lineNum"> 27</span> <span class="tlaGNC"> 6 : }</span></span>
<span id="L28"><span class="lineNum"> 28</span> : </span>
<span id="L29"><span class="lineNum"> 29</span> <span class="tlaGNC"> 86 : 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"> 86 : features = features_;</span></span>
<span id="L32"><span class="lineNum"> 32</span> <span class="tlaGNC"> 86 : 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"> 86 : 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"> 86 : SPODE::fit(dataset, features, className, states);</span></span>
<span id="L38"><span class="lineNum"> 38</span> <span class="tlaGNC"> 86 : states = localDiscretizationProposal(states, model);</span></span>
<span id="L39"><span class="lineNum"> 39</span> <span class="tlaGNC"> 86 : return *this;</span></span>
<span id="L40"><span class="lineNum"> 40</span> : }</span>
<span id="L41"><span class="lineNum"> 41</span> <span class="tlaGNC"> 68 : 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"> 68 : auto Xt = prepareX(X);</span></span>
<span id="L44"><span class="lineNum"> 44</span> <span class="tlaGNC"> 136 : return SPODE::predict(Xt);</span></span>
<span id="L45"><span class="lineNum"> 45</span> <span class="tlaGNC"> 68 : }</span></span>
<span id="L46"><span class="lineNum"> 46</span> <span class="tlaGNC"> 18 : 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"> 18 : 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,96 +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 - coverage.info - BayesNet/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">top level</a> - <a href="index.html">BayesNet/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">coverage.info</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-04-30 13:17:26</td>
<td></td>
<td class="headerItem">Functions:</td>
<td class="headerCovTableEntryHi">100.0&nbsp;%</td>
<td class="headerCovTableEntry">2</td>
<td class="headerCovTableEntry">2</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">_ZN8bayesnet7SPODELdD0Ev</a></td>
<td class="coverFnHi">160</td>
</tr>
<tr>
<td class="coverFnAlias"><a href="SPODELd.h.gcov.html#L14">_ZN8bayesnet7SPODELdD0Ev</a></td>
<td class="coverFnAliasHi">78</td>
</tr>
<tr>
<td class="coverFnAlias"><a href="SPODELd.h.gcov.html#L14">_ZN8bayesnet7SPODELdD2Ev</a></td>
<td class="coverFnAliasHi">82</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,96 +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 - coverage.info - BayesNet/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">top level</a> - <a href="index.html">BayesNet/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">coverage.info</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-04-30 13:17:26</td>
<td></td>
<td class="headerItem">Functions:</td>
<td class="headerCovTableEntryHi">100.0&nbsp;%</td>
<td class="headerCovTableEntry">2</td>
<td class="headerCovTableEntry">2</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">_ZN8bayesnet7SPODELdD0Ev</a></td>
<td class="coverFnHi">160</td>
</tr>
<tr>
<td class="coverFnAlias"><a href="SPODELd.h.gcov.html#L14">_ZN8bayesnet7SPODELdD0Ev</a></td>
<td class="coverFnAliasHi">78</td>
</tr>
<tr>
<td class="coverFnAlias"><a href="SPODELd.h.gcov.html#L14">_ZN8bayesnet7SPODELdD2Ev</a></td>
<td class="coverFnAliasHi">82</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,101 +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 - coverage.info - BayesNet/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">top level</a> - <a href="index.html">BayesNet/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">coverage.info</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-04-30 13:17:26</td>
<td></td>
<td class="headerItem">Functions:</td>
<td class="headerCovTableEntryHi">100.0&nbsp;%</td>
<td class="headerCovTableEntry">2</td>
<td class="headerCovTableEntry">2</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"> 160 : 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,103 +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 - coverage.info - BayesNet/bayesnet/classifiers/TAN.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">top level</a> - <a href="index.html">BayesNet/bayesnet/classifiers</a> - TAN.cc<span style="font-size: 80%;"> (<a href="TAN.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">coverage.info</td>
<td></td>
<td class="headerItem">Lines:</td>
<td class="headerCovTableEntryHi">100.0&nbsp;%</td>
<td class="headerCovTableEntry">23</td>
<td class="headerCovTableEntry">23</td>
</tr>
<tr>
<td class="headerItem">Test Date:</td>
<td class="headerValue">2024-04-30 13:17:26</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><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="TAN.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="TAN.cc.gcov.html#L39">_ZNK8bayesnet3TAN5graphERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE</a></td>
<td class="coverFnHi">4</td>
</tr>
<tr>
<td class="coverFn"><a href="TAN.cc.gcov.html#L10">_ZN8bayesnet3TAN10buildModelERKN2at6TensorE</a></td>
<td class="coverFnHi">26</td>
</tr>
<tr>
<td class="coverFn"><a href="TAN.cc.gcov.html#L8">_ZN8bayesnet3TANC2Ev</a></td>
<td class="coverFnHi">94</td>
</tr>
<tr>
<td class="coverFn"><a href="TAN.cc.gcov.html#L23">_ZZN8bayesnet3TAN10buildModelERKN2at6TensorEENKUlRKT_RKT0_E_clISt4pairIifESE_EEDaS7_SA_</a></td>
<td class="coverFnHi">324</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,103 +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 - coverage.info - BayesNet/bayesnet/classifiers/TAN.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">top level</a> - <a href="index.html">BayesNet/bayesnet/classifiers</a> - TAN.cc<span style="font-size: 80%;"> (<a href="TAN.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">coverage.info</td>
<td></td>
<td class="headerItem">Lines:</td>
<td class="headerCovTableEntryHi">100.0&nbsp;%</td>
<td class="headerCovTableEntry">23</td>
<td class="headerCovTableEntry">23</td>
</tr>
<tr>
<td class="headerItem">Test Date:</td>
<td class="headerValue">2024-04-30 13:17:26</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><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="TAN.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="TAN.cc.gcov.html#L10">_ZN8bayesnet3TAN10buildModelERKN2at6TensorE</a></td>
<td class="coverFnHi">26</td>
</tr>
<tr>
<td class="coverFn"><a href="TAN.cc.gcov.html#L8">_ZN8bayesnet3TANC2Ev</a></td>
<td class="coverFnHi">94</td>
</tr>
<tr>
<td class="coverFn"><a href="TAN.cc.gcov.html#L39">_ZNK8bayesnet3TAN5graphERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE</a></td>
<td class="coverFnHi">4</td>
</tr>
<tr>
<td class="coverFn"><a href="TAN.cc.gcov.html#L23">_ZZN8bayesnet3TAN10buildModelERKN2at6TensorEENKUlRKT_RKT0_E_clISt4pairIifESE_EEDaS7_SA_</a></td>
<td class="coverFnHi">324</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,121 +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 - coverage.info - BayesNet/bayesnet/classifiers/TAN.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">top level</a> - <a href="index.html">BayesNet/bayesnet/classifiers</a> - TAN.cc<span style="font-size: 80%;"> (source / <a href="TAN.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">coverage.info</td>
<td></td>
<td class="headerItem">Lines:</td>
<td class="headerCovTableEntryHi">100.0&nbsp;%</td>
<td class="headerCovTableEntry">23</td>
<td class="headerCovTableEntry">23</td>
</tr>
<tr>
<td class="headerItem">Test Date:</td>
<td class="headerValue">2024-04-30 13:17:26</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><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;TAN.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"> 94 : TAN::TAN() : Classifier(Network()) {}</span></span>
<span id="L11"><span class="lineNum"> 11</span> : </span>
<span id="L12"><span class="lineNum"> 12</span> <span class="tlaGNC"> 26 : void TAN::buildModel(const torch::Tensor&amp; weights)</span></span>
<span id="L13"><span class="lineNum"> 13</span> : {</span>
<span id="L14"><span class="lineNum"> 14</span> : // 0. Add all nodes to the model</span>
<span id="L15"><span class="lineNum"> 15</span> <span class="tlaGNC"> 26 : addNodes();</span></span>
<span id="L16"><span class="lineNum"> 16</span> : // 1. Compute mutual information between each feature and the class and set the root node</span>
<span id="L17"><span class="lineNum"> 17</span> : // as the highest mutual information with the class</span>
<span id="L18"><span class="lineNum"> 18</span> <span class="tlaGNC"> 26 : auto mi = std::vector &lt;std::pair&lt;int, float &gt;&gt;();</span></span>
<span id="L19"><span class="lineNum"> 19</span> <span class="tlaGNC"> 78 : torch::Tensor class_dataset = dataset.index({ -1, &quot;...&quot; });</span></span>
<span id="L20"><span class="lineNum"> 20</span> <span class="tlaGNC"> 178 : for (int i = 0; i &lt; static_cast&lt;int&gt;(features.size()); ++i) {</span></span>
<span id="L21"><span class="lineNum"> 21</span> <span class="tlaGNC"> 456 : torch::Tensor feature_dataset = dataset.index({ i, &quot;...&quot; });</span></span>
<span id="L22"><span class="lineNum"> 22</span> <span class="tlaGNC"> 152 : auto mi_value = metrics.mutualInformation(class_dataset, feature_dataset, weights);</span></span>
<span id="L23"><span class="lineNum"> 23</span> <span class="tlaGNC"> 152 : mi.push_back({ i, mi_value });</span></span>
<span id="L24"><span class="lineNum"> 24</span> <span class="tlaGNC"> 152 : }</span></span>
<span id="L25"><span class="lineNum"> 25</span> <span class="tlaGNC"> 350 : sort(mi.begin(), mi.end(), [](const auto&amp; left, const auto&amp; right) {return left.second &lt; right.second;});</span></span>
<span id="L26"><span class="lineNum"> 26</span> <span class="tlaGNC"> 26 : auto root = mi[mi.size() - 1].first;</span></span>
<span id="L27"><span class="lineNum"> 27</span> : // 2. Compute mutual information between each feature and the class</span>
<span id="L28"><span class="lineNum"> 28</span> <span class="tlaGNC"> 26 : auto weights_matrix = metrics.conditionalEdge(weights);</span></span>
<span id="L29"><span class="lineNum"> 29</span> : // 3. Compute the maximum spanning tree</span>
<span id="L30"><span class="lineNum"> 30</span> <span class="tlaGNC"> 26 : auto mst = metrics.maximumSpanningTree(features, weights_matrix, root);</span></span>
<span id="L31"><span class="lineNum"> 31</span> : // 4. Add edges from the maximum spanning tree to the model</span>
<span id="L32"><span class="lineNum"> 32</span> <span class="tlaGNC"> 152 : for (auto i = 0; i &lt; mst.size(); ++i) {</span></span>
<span id="L33"><span class="lineNum"> 33</span> <span class="tlaGNC"> 126 : auto [from, to] = mst[i];</span></span>
<span id="L34"><span class="lineNum"> 34</span> <span class="tlaGNC"> 126 : model.addEdge(features[from], features[to]);</span></span>
<span id="L35"><span class="lineNum"> 35</span> : }</span>
<span id="L36"><span class="lineNum"> 36</span> : // 5. Add edges from the class to all features</span>
<span id="L37"><span class="lineNum"> 37</span> <span class="tlaGNC"> 178 : for (auto feature : features) {</span></span>
<span id="L38"><span class="lineNum"> 38</span> <span class="tlaGNC"> 152 : model.addEdge(className, feature);</span></span>
<span id="L39"><span class="lineNum"> 39</span> <span class="tlaGNC"> 152 : }</span></span>
<span id="L40"><span class="lineNum"> 40</span> <span class="tlaGNC"> 204 : }</span></span>
<span id="L41"><span class="lineNum"> 41</span> <span class="tlaGNC"> 4 : std::vector&lt;std::string&gt; TAN::graph(const std::string&amp; title) const</span></span>
<span id="L42"><span class="lineNum"> 42</span> : {</span>
<span id="L43"><span class="lineNum"> 43</span> <span class="tlaGNC"> 4 : return model.graph(title);</span></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,96 +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 - coverage.info - BayesNet/bayesnet/classifiers/TAN.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">top level</a> - <a href="index.html">BayesNet/bayesnet/classifiers</a> - TAN.h<span style="font-size: 80%;"> (<a href="TAN.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">coverage.info</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-04-30 13:17:26</td>
<td></td>
<td class="headerItem">Functions:</td>
<td class="headerCovTableEntryHi">100.0&nbsp;%</td>
<td class="headerCovTableEntry">2</td>
<td class="headerCovTableEntry">2</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="TAN.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="TAN.h.gcov.html#L15">_ZN8bayesnet3TAND0Ev</a></td>
<td class="coverFnHi">38</td>
</tr>
<tr>
<td class="coverFnAlias"><a href="TAN.h.gcov.html#L15">_ZN8bayesnet3TAND0Ev</a></td>
<td class="coverFnAliasHi">6</td>
</tr>
<tr>
<td class="coverFnAlias"><a href="TAN.h.gcov.html#L15">_ZN8bayesnet3TAND2Ev</a></td>
<td class="coverFnAliasHi">32</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,96 +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 - coverage.info - BayesNet/bayesnet/classifiers/TAN.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">top level</a> - <a href="index.html">BayesNet/bayesnet/classifiers</a> - TAN.h<span style="font-size: 80%;"> (<a href="TAN.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">coverage.info</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-04-30 13:17:26</td>
<td></td>
<td class="headerItem">Functions:</td>
<td class="headerCovTableEntryHi">100.0&nbsp;%</td>
<td class="headerCovTableEntry">2</td>
<td class="headerCovTableEntry">2</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="TAN.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="TAN.h.gcov.html#L15">_ZN8bayesnet3TAND0Ev</a></td>
<td class="coverFnHi">38</td>
</tr>
<tr>
<td class="coverFnAlias"><a href="TAN.h.gcov.html#L15">_ZN8bayesnet3TAND0Ev</a></td>
<td class="coverFnAliasHi">6</td>
</tr>
<tr>
<td class="coverFnAlias"><a href="TAN.h.gcov.html#L15">_ZN8bayesnet3TAND2Ev</a></td>
<td class="coverFnAliasHi">32</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,97 +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 - coverage.info - BayesNet/bayesnet/classifiers/TAN.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">top level</a> - <a href="index.html">BayesNet/bayesnet/classifiers</a> - TAN.h<span style="font-size: 80%;"> (source / <a href="TAN.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">coverage.info</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-04-30 13:17:26</td>
<td></td>
<td class="headerItem">Functions:</td>
<td class="headerCovTableEntryHi">100.0&nbsp;%</td>
<td class="headerCovTableEntry">2</td>
<td class="headerCovTableEntry">2</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 TAN_H</span>
<span id="L8"><span class="lineNum"> 8</span> : #define TAN_H</span>
<span id="L9"><span class="lineNum"> 9</span> : #include &quot;Classifier.h&quot;</span>
<span id="L10"><span class="lineNum"> 10</span> : namespace bayesnet {</span>
<span id="L11"><span class="lineNum"> 11</span> : class TAN : public Classifier {</span>
<span id="L12"><span class="lineNum"> 12</span> : private:</span>
<span id="L13"><span class="lineNum"> 13</span> : protected:</span>
<span id="L14"><span class="lineNum"> 14</span> : void buildModel(const torch::Tensor&amp; weights) override;</span>
<span id="L15"><span class="lineNum"> 15</span> : public:</span>
<span id="L16"><span class="lineNum"> 16</span> : TAN();</span>
<span id="L17"><span class="lineNum"> 17</span> <span class="tlaGNC tlaBgGNC"> 38 : virtual ~TAN() = default;</span></span>
<span id="L18"><span class="lineNum"> 18</span> : std::vector&lt;std::string&gt; graph(const std::string&amp; name = &quot;TAN&quot;) const override;</span>
<span id="L19"><span class="lineNum"> 19</span> : };</span>
<span id="L20"><span class="lineNum"> 20</span> : }</span>
<span id="L21"><span class="lineNum"> 21</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,103 +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 - coverage.info - BayesNet/bayesnet/classifiers/TANLd.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">top level</a> - <a href="index.html">BayesNet/bayesnet/classifiers</a> - TANLd.cc<span style="font-size: 80%;"> (<a href="TANLd.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">coverage.info</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-04-30 13:17:26</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><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="TANLd.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="TANLd.cc.gcov.html#L30">_ZNK8bayesnet5TANLd5graphERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE</a></td>
<td class="coverFnHi">2</td>
</tr>
<tr>
<td class="coverFn"><a href="TANLd.cc.gcov.html#L25">_ZN8bayesnet5TANLd7predictERN2at6TensorE</a></td>
<td class="coverFnHi">8</td>
</tr>
<tr>
<td class="coverFn"><a href="TANLd.cc.gcov.html#L9">_ZN8bayesnet5TANLd3fitERN2at6TensorES3_RKSt6vectorINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESaISA_EERKSA_RSt3mapISA_S4_IiSaIiEESt4lessISA_ESaISt4pairISF_SJ_EEE</a></td>
<td class="coverFnHi">10</td>
</tr>
<tr>
<td class="coverFn"><a href="TANLd.cc.gcov.html#L8">_ZN8bayesnet5TANLdC2Ev</a></td>
<td class="coverFnHi">34</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,103 +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 - coverage.info - BayesNet/bayesnet/classifiers/TANLd.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">top level</a> - <a href="index.html">BayesNet/bayesnet/classifiers</a> - TANLd.cc<span style="font-size: 80%;"> (<a href="TANLd.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">coverage.info</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-04-30 13:17:26</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><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="TANLd.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="TANLd.cc.gcov.html#L9">_ZN8bayesnet5TANLd3fitERN2at6TensorES3_RKSt6vectorINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESaISA_EERKSA_RSt3mapISA_S4_IiSaIiEESt4lessISA_ESaISt4pairISF_SJ_EEE</a></td>
<td class="coverFnHi">10</td>
</tr>
<tr>
<td class="coverFn"><a href="TANLd.cc.gcov.html#L25">_ZN8bayesnet5TANLd7predictERN2at6TensorE</a></td>
<td class="coverFnHi">8</td>
</tr>
<tr>
<td class="coverFn"><a href="TANLd.cc.gcov.html#L8">_ZN8bayesnet5TANLdC2Ev</a></td>
<td class="coverFnHi">34</td>
</tr>
<tr>
<td class="coverFn"><a href="TANLd.cc.gcov.html#L30">_ZNK8bayesnet5TANLd5graphERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE</a></td>
<td class="coverFnHi">2</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,112 +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 - coverage.info - BayesNet/bayesnet/classifiers/TANLd.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">top level</a> - <a href="index.html">BayesNet/bayesnet/classifiers</a> - TANLd.cc<span style="font-size: 80%;"> (source / <a href="TANLd.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">coverage.info</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-04-30 13:17:26</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><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;TANLd.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"> 34 : TANLd::TANLd() : TAN(), Proposal(dataset, features, className) {}</span></span>
<span id="L11"><span class="lineNum"> 11</span> <span class="tlaGNC"> 10 : TANLd&amp; TANLd::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"> 10 : checkInput(X_, y_);</span></span>
<span id="L14"><span class="lineNum"> 14</span> <span class="tlaGNC"> 10 : features = features_;</span></span>
<span id="L15"><span class="lineNum"> 15</span> <span class="tlaGNC"> 10 : className = className_;</span></span>
<span id="L16"><span class="lineNum"> 16</span> <span class="tlaGNC"> 10 : Xf = X_;</span></span>
<span id="L17"><span class="lineNum"> 17</span> <span class="tlaGNC"> 10 : 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"> 10 : 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 TAN structure, TAN::fit initializes the base Bayesian network</span>
<span id="L22"><span class="lineNum"> 22</span> <span class="tlaGNC"> 10 : TAN::fit(dataset, features, className, states);</span></span>
<span id="L23"><span class="lineNum"> 23</span> <span class="tlaGNC"> 10 : states = localDiscretizationProposal(states, model);</span></span>
<span id="L24"><span class="lineNum"> 24</span> <span class="tlaGNC"> 10 : return *this;</span></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> <span class="tlaGNC"> 8 : torch::Tensor TANLd::predict(torch::Tensor&amp; X)</span></span>
<span id="L28"><span class="lineNum"> 28</span> : {</span>
<span id="L29"><span class="lineNum"> 29</span> <span class="tlaGNC"> 8 : auto Xt = prepareX(X);</span></span>
<span id="L30"><span class="lineNum"> 30</span> <span class="tlaGNC"> 16 : return TAN::predict(Xt);</span></span>
<span id="L31"><span class="lineNum"> 31</span> <span class="tlaGNC"> 8 : }</span></span>
<span id="L32"><span class="lineNum"> 32</span> <span class="tlaGNC"> 2 : std::vector&lt;std::string&gt; TANLd::graph(const std::string&amp; name) const</span></span>
<span id="L33"><span class="lineNum"> 33</span> : {</span>
<span id="L34"><span class="lineNum"> 34</span> <span class="tlaGNC"> 2 : return TAN::graph(name);</span></span>
<span id="L35"><span class="lineNum"> 35</span> : }</span>
<span id="L36"><span class="lineNum"> 36</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,96 +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 - coverage.info - BayesNet/bayesnet/classifiers/TANLd.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">top level</a> - <a href="index.html">BayesNet/bayesnet/classifiers</a> - TANLd.h<span style="font-size: 80%;"> (<a href="TANLd.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">coverage.info</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-04-30 13:17:26</td>
<td></td>
<td class="headerItem">Functions:</td>
<td class="headerCovTableEntryHi">100.0&nbsp;%</td>
<td class="headerCovTableEntry">2</td>
<td class="headerCovTableEntry">2</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="TANLd.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="TANLd.h.gcov.html#L15">_ZN8bayesnet5TANLdD0Ev</a></td>
<td class="coverFnHi">10</td>
</tr>
<tr>
<td class="coverFnAlias"><a href="TANLd.h.gcov.html#L15">_ZN8bayesnet5TANLdD0Ev</a></td>
<td class="coverFnAliasHi">4</td>
</tr>
<tr>
<td class="coverFnAlias"><a href="TANLd.h.gcov.html#L15">_ZN8bayesnet5TANLdD2Ev</a></td>
<td class="coverFnAliasHi">6</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,96 +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 - coverage.info - BayesNet/bayesnet/classifiers/TANLd.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">top level</a> - <a href="index.html">BayesNet/bayesnet/classifiers</a> - TANLd.h<span style="font-size: 80%;"> (<a href="TANLd.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">coverage.info</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-04-30 13:17:26</td>
<td></td>
<td class="headerItem">Functions:</td>
<td class="headerCovTableEntryHi">100.0&nbsp;%</td>
<td class="headerCovTableEntry">2</td>
<td class="headerCovTableEntry">2</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="TANLd.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="TANLd.h.gcov.html#L15">_ZN8bayesnet5TANLdD0Ev</a></td>
<td class="coverFnHi">10</td>
</tr>
<tr>
<td class="coverFnAlias"><a href="TANLd.h.gcov.html#L15">_ZN8bayesnet5TANLdD0Ev</a></td>
<td class="coverFnAliasHi">4</td>
</tr>
<tr>
<td class="coverFnAlias"><a href="TANLd.h.gcov.html#L15">_ZN8bayesnet5TANLdD2Ev</a></td>
<td class="coverFnAliasHi">6</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,100 +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 - coverage.info - BayesNet/bayesnet/classifiers/TANLd.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">top level</a> - <a href="index.html">BayesNet/bayesnet/classifiers</a> - TANLd.h<span style="font-size: 80%;"> (source / <a href="TANLd.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">coverage.info</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-04-30 13:17:26</td>
<td></td>
<td class="headerItem">Functions:</td>
<td class="headerCovTableEntryHi">100.0&nbsp;%</td>
<td class="headerCovTableEntry">2</td>
<td class="headerCovTableEntry">2</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 TANLD_H</span>
<span id="L8"><span class="lineNum"> 8</span> : #define TANLD_H</span>
<span id="L9"><span class="lineNum"> 9</span> : #include &quot;TAN.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 TANLd : public TAN, 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> : TANLd();</span>
<span id="L17"><span class="lineNum"> 17</span> <span class="tlaGNC tlaBgGNC"> 10 : virtual ~TANLd() = default;</span></span>
<span id="L18"><span class="lineNum"> 18</span> : TANLd&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;TAN&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 // !TANLD_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,103 +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 - coverage.info - BayesNet/bayesnet/ensembles/AODE.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">top level</a> - <a href="index.html">BayesNet/bayesnet/ensembles</a> - AODE.cc<span style="font-size: 80%;"> (<a href="AODE.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">coverage.info</td>
<td></td>
<td class="headerItem">Lines:</td>
<td class="headerCovTableEntryHi">100.0&nbsp;%</td>
<td class="headerCovTableEntry">20</td>
<td class="headerCovTableEntry">20</td>
</tr>
<tr>
<td class="headerItem">Test Date:</td>
<td class="headerValue">2024-04-30 13:17:26</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><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="AODE.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="AODE.cc.gcov.html#L13">_ZN8bayesnet4AODE18setHyperparametersERKN8nlohmann16json_abi_v3_11_310basic_jsonISt3mapSt6vectorNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEblmdSaNS2_14adl_serializerES5_IhSaIhEEvEE</a></td>
<td class="coverFnHi">2</td>
</tr>
<tr>
<td class="coverFn"><a href="AODE.cc.gcov.html#L32">_ZNK8bayesnet4AODE5graphERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE</a></td>
<td class="coverFnHi">2</td>
</tr>
<tr>
<td class="coverFn"><a href="AODE.cc.gcov.html#L22">_ZN8bayesnet4AODE10buildModelERKN2at6TensorE</a></td>
<td class="coverFnHi">12</td>
</tr>
<tr>
<td class="coverFn"><a href="AODE.cc.gcov.html#L8">_ZN8bayesnet4AODEC2Eb</a></td>
<td class="coverFnHi">38</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,103 +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 - coverage.info - BayesNet/bayesnet/ensembles/AODE.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">top level</a> - <a href="index.html">BayesNet/bayesnet/ensembles</a> - AODE.cc<span style="font-size: 80%;"> (<a href="AODE.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">coverage.info</td>
<td></td>
<td class="headerItem">Lines:</td>
<td class="headerCovTableEntryHi">100.0&nbsp;%</td>
<td class="headerCovTableEntry">20</td>
<td class="headerCovTableEntry">20</td>
</tr>
<tr>
<td class="headerItem">Test Date:</td>
<td class="headerValue">2024-04-30 13:17:26</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><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="AODE.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="AODE.cc.gcov.html#L22">_ZN8bayesnet4AODE10buildModelERKN2at6TensorE</a></td>
<td class="coverFnHi">12</td>
</tr>
<tr>
<td class="coverFn"><a href="AODE.cc.gcov.html#L13">_ZN8bayesnet4AODE18setHyperparametersERKN8nlohmann16json_abi_v3_11_310basic_jsonISt3mapSt6vectorNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEblmdSaNS2_14adl_serializerES5_IhSaIhEEvEE</a></td>
<td class="coverFnHi">2</td>
</tr>
<tr>
<td class="coverFn"><a href="AODE.cc.gcov.html#L8">_ZN8bayesnet4AODEC2Eb</a></td>
<td class="coverFnHi">38</td>
</tr>
<tr>
<td class="coverFn"><a href="AODE.cc.gcov.html#L32">_ZNK8bayesnet4AODE5graphERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE</a></td>
<td class="coverFnHi">2</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,96 +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 - coverage.info - BayesNet/bayesnet/ensembles/AODE.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">top level</a> - <a href="index.html">BayesNet/bayesnet/ensembles</a> - AODE.h<span style="font-size: 80%;"> (<a href="AODE.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">coverage.info</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-04-30 13:17:26</td>
<td></td>
<td class="headerItem">Functions:</td>
<td class="headerCovTableEntryHi">100.0&nbsp;%</td>
<td class="headerCovTableEntry">2</td>
<td class="headerCovTableEntry">2</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="AODE.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="AODE.h.gcov.html#L13">_ZN8bayesnet4AODED0Ev</a></td>
<td class="coverFnHi">14</td>
</tr>
<tr>
<td class="coverFnAlias"><a href="AODE.h.gcov.html#L13">_ZN8bayesnet4AODED0Ev</a></td>
<td class="coverFnAliasHi">4</td>
</tr>
<tr>
<td class="coverFnAlias"><a href="AODE.h.gcov.html#L13">_ZN8bayesnet4AODED2Ev</a></td>
<td class="coverFnAliasHi">10</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,96 +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 - coverage.info - BayesNet/bayesnet/ensembles/AODE.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">top level</a> - <a href="index.html">BayesNet/bayesnet/ensembles</a> - AODE.h<span style="font-size: 80%;"> (<a href="AODE.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">coverage.info</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-04-30 13:17:26</td>
<td></td>
<td class="headerItem">Functions:</td>
<td class="headerCovTableEntryHi">100.0&nbsp;%</td>
<td class="headerCovTableEntry">2</td>
<td class="headerCovTableEntry">2</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="AODE.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="AODE.h.gcov.html#L13">_ZN8bayesnet4AODED0Ev</a></td>
<td class="coverFnHi">14</td>
</tr>
<tr>
<td class="coverFnAlias"><a href="AODE.h.gcov.html#L13">_ZN8bayesnet4AODED0Ev</a></td>
<td class="coverFnAliasHi">4</td>
</tr>
<tr>
<td class="coverFnAlias"><a href="AODE.h.gcov.html#L13">_ZN8bayesnet4AODED2Ev</a></td>
<td class="coverFnAliasHi">10</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,110 +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 - coverage.info - BayesNet/bayesnet/ensembles/AODELd.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">top level</a> - <a href="index.html">BayesNet/bayesnet/ensembles</a> - AODELd.cc<span style="font-size: 80%;"> (<a href="AODELd.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">coverage.info</td>
<td></td>
<td class="headerItem">Lines:</td>
<td class="headerCovTableEntryHi">100.0&nbsp;%</td>
<td class="headerCovTableEntry">24</td>
<td class="headerCovTableEntry">24</td>
</tr>
<tr>
<td class="headerItem">Test Date:</td>
<td class="headerValue">2024-04-30 13:17:26</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><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="AODELd.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="AODELd.cc.gcov.html#L41">_ZNK8bayesnet6AODELd5graphERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE</a></td>
<td class="coverFnHi">2</td>
</tr>
<tr>
<td class="coverFn"><a href="AODELd.cc.gcov.html#L26">_ZN8bayesnet6AODELd10buildModelERKN2at6TensorE</a></td>
<td class="coverFnHi">10</td>
</tr>
<tr>
<td class="coverFn"><a href="AODELd.cc.gcov.html#L35">_ZN8bayesnet6AODELd10trainModelERKN2at6TensorE</a></td>
<td class="coverFnHi">10</td>
</tr>
<tr>
<td class="coverFn"><a href="AODELd.cc.gcov.html#L11">_ZN8bayesnet6AODELd3fitERN2at6TensorES3_RKSt6vectorINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESaISA_EERKSA_RSt3mapISA_S4_IiSaIiEESt4lessISA_ESaISt4pairISF_SJ_EEE</a></td>
<td class="coverFnHi">10</td>
</tr>
<tr>
<td class="coverFn"><a href="AODELd.cc.gcov.html#L8">_ZN8bayesnet6AODELdC2Eb</a></td>
<td class="coverFnHi">34</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,110 +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 - coverage.info - BayesNet/bayesnet/ensembles/AODELd.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">top level</a> - <a href="index.html">BayesNet/bayesnet/ensembles</a> - AODELd.cc<span style="font-size: 80%;"> (<a href="AODELd.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">coverage.info</td>
<td></td>
<td class="headerItem">Lines:</td>
<td class="headerCovTableEntryHi">100.0&nbsp;%</td>
<td class="headerCovTableEntry">24</td>
<td class="headerCovTableEntry">24</td>
</tr>
<tr>
<td class="headerItem">Test Date:</td>
<td class="headerValue">2024-04-30 13:17:26</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><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="AODELd.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="AODELd.cc.gcov.html#L26">_ZN8bayesnet6AODELd10buildModelERKN2at6TensorE</a></td>
<td class="coverFnHi">10</td>
</tr>
<tr>
<td class="coverFn"><a href="AODELd.cc.gcov.html#L35">_ZN8bayesnet6AODELd10trainModelERKN2at6TensorE</a></td>
<td class="coverFnHi">10</td>
</tr>
<tr>
<td class="coverFn"><a href="AODELd.cc.gcov.html#L11">_ZN8bayesnet6AODELd3fitERN2at6TensorES3_RKSt6vectorINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESaISA_EERKSA_RSt3mapISA_S4_IiSaIiEESt4lessISA_ESaISt4pairISF_SJ_EEE</a></td>
<td class="coverFnHi">10</td>
</tr>
<tr>
<td class="coverFn"><a href="AODELd.cc.gcov.html#L8">_ZN8bayesnet6AODELdC2Eb</a></td>
<td class="coverFnHi">34</td>
</tr>
<tr>
<td class="coverFn"><a href="AODELd.cc.gcov.html#L41">_ZNK8bayesnet6AODELd5graphERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE</a></td>
<td class="coverFnHi">2</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,123 +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 - coverage.info - BayesNet/bayesnet/ensembles/AODELd.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">top level</a> - <a href="index.html">BayesNet/bayesnet/ensembles</a> - AODELd.cc<span style="font-size: 80%;"> (source / <a href="AODELd.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">coverage.info</td>
<td></td>
<td class="headerItem">Lines:</td>
<td class="headerCovTableEntryHi">100.0&nbsp;%</td>
<td class="headerCovTableEntry">24</td>
<td class="headerCovTableEntry">24</td>
</tr>
<tr>
<td class="headerItem">Test Date:</td>
<td class="headerValue">2024-04-30 13:17:26</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><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;AODELd.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"> 34 : AODELd::AODELd(bool predict_voting) : Ensemble(predict_voting), Proposal(dataset, features, className)</span></span>
<span id="L11"><span class="lineNum"> 11</span> : {</span>
<span id="L12"><span class="lineNum"> 12</span> <span class="tlaGNC"> 34 : }</span></span>
<span id="L13"><span class="lineNum"> 13</span> <span class="tlaGNC"> 10 : AODELd&amp; AODELd::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="L14"><span class="lineNum"> 14</span> : {</span>
<span id="L15"><span class="lineNum"> 15</span> <span class="tlaGNC"> 10 : checkInput(X_, y_);</span></span>
<span id="L16"><span class="lineNum"> 16</span> <span class="tlaGNC"> 10 : features = features_;</span></span>
<span id="L17"><span class="lineNum"> 17</span> <span class="tlaGNC"> 10 : className = className_;</span></span>
<span id="L18"><span class="lineNum"> 18</span> <span class="tlaGNC"> 10 : Xf = X_;</span></span>
<span id="L19"><span class="lineNum"> 19</span> <span class="tlaGNC"> 10 : y = y_;</span></span>
<span id="L20"><span class="lineNum"> 20</span> : // Fills std::vectors Xv &amp; yv with the data from tensors X_ (discretized) &amp; y</span>
<span id="L21"><span class="lineNum"> 21</span> <span class="tlaGNC"> 10 : states = fit_local_discretization(y);</span></span>
<span id="L22"><span class="lineNum"> 22</span> : // We have discretized the input data</span>
<span id="L23"><span class="lineNum"> 23</span> : // 1st we need to fit the model to build the normal TAN structure, TAN::fit initializes the base Bayesian network</span>
<span id="L24"><span class="lineNum"> 24</span> <span class="tlaGNC"> 10 : Ensemble::fit(dataset, features, className, states);</span></span>
<span id="L25"><span class="lineNum"> 25</span> <span class="tlaGNC"> 10 : return *this;</span></span>
<span id="L26"><span class="lineNum"> 26</span> : </span>
<span id="L27"><span class="lineNum"> 27</span> : }</span>
<span id="L28"><span class="lineNum"> 28</span> <span class="tlaGNC"> 10 : void AODELd::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 class="tlaGNC"> 10 : models.clear();</span></span>
<span id="L31"><span class="lineNum"> 31</span> <span class="tlaGNC"> 84 : for (int i = 0; i &lt; features.size(); ++i) {</span></span>
<span id="L32"><span class="lineNum"> 32</span> <span class="tlaGNC"> 74 : models.push_back(std::make_unique&lt;SPODELd&gt;(i));</span></span>
<span id="L33"><span class="lineNum"> 33</span> : }</span>
<span id="L34"><span class="lineNum"> 34</span> <span class="tlaGNC"> 10 : n_models = models.size();</span></span>
<span id="L35"><span class="lineNum"> 35</span> <span class="tlaGNC"> 10 : significanceModels = std::vector&lt;double&gt;(n_models, 1.0);</span></span>
<span id="L36"><span class="lineNum"> 36</span> <span class="tlaGNC"> 10 : }</span></span>
<span id="L37"><span class="lineNum"> 37</span> <span class="tlaGNC"> 10 : void AODELd::trainModel(const torch::Tensor&amp; weights)</span></span>
<span id="L38"><span class="lineNum"> 38</span> : {</span>
<span id="L39"><span class="lineNum"> 39</span> <span class="tlaGNC"> 84 : for (const auto&amp; model : models) {</span></span>
<span id="L40"><span class="lineNum"> 40</span> <span class="tlaGNC"> 74 : model-&gt;fit(Xf, y, features, className, states);</span></span>
<span id="L41"><span class="lineNum"> 41</span> : }</span>
<span id="L42"><span class="lineNum"> 42</span> <span class="tlaGNC"> 10 : }</span></span>
<span id="L43"><span class="lineNum"> 43</span> <span class="tlaGNC"> 2 : std::vector&lt;std::string&gt; AODELd::graph(const std::string&amp; name) const</span></span>
<span id="L44"><span class="lineNum"> 44</span> : {</span>
<span id="L45"><span class="lineNum"> 45</span> <span class="tlaGNC"> 2 : return Ensemble::graph(name);</span></span>
<span id="L46"><span class="lineNum"> 46</span> : }</span>
<span id="L47"><span class="lineNum"> 47</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,96 +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 - coverage.info - BayesNet/bayesnet/ensembles/AODELd.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">top level</a> - <a href="index.html">BayesNet/bayesnet/ensembles</a> - AODELd.h<span style="font-size: 80%;"> (<a href="AODELd.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">coverage.info</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-04-30 13:17:26</td>
<td></td>
<td class="headerItem">Functions:</td>
<td class="headerCovTableEntryHi">100.0&nbsp;%</td>
<td class="headerCovTableEntry">2</td>
<td class="headerCovTableEntry">2</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="AODELd.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="AODELd.h.gcov.html#L15">_ZN8bayesnet6AODELdD0Ev</a></td>
<td class="coverFnHi">10</td>
</tr>
<tr>
<td class="coverFnAlias"><a href="AODELd.h.gcov.html#L15">_ZN8bayesnet6AODELdD0Ev</a></td>
<td class="coverFnAliasHi">4</td>
</tr>
<tr>
<td class="coverFnAlias"><a href="AODELd.h.gcov.html#L15">_ZN8bayesnet6AODELdD2Ev</a></td>
<td class="coverFnAliasHi">6</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,96 +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 - coverage.info - BayesNet/bayesnet/ensembles/AODELd.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">top level</a> - <a href="index.html">BayesNet/bayesnet/ensembles</a> - AODELd.h<span style="font-size: 80%;"> (<a href="AODELd.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">coverage.info</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-04-30 13:17:26</td>
<td></td>
<td class="headerItem">Functions:</td>
<td class="headerCovTableEntryHi">100.0&nbsp;%</td>
<td class="headerCovTableEntry">2</td>
<td class="headerCovTableEntry">2</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="AODELd.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="AODELd.h.gcov.html#L15">_ZN8bayesnet6AODELdD0Ev</a></td>
<td class="coverFnHi">10</td>
</tr>
<tr>
<td class="coverFnAlias"><a href="AODELd.h.gcov.html#L15">_ZN8bayesnet6AODELdD0Ev</a></td>
<td class="coverFnAliasHi">4</td>
</tr>
<tr>
<td class="coverFnAlias"><a href="AODELd.h.gcov.html#L15">_ZN8bayesnet6AODELdD2Ev</a></td>
<td class="coverFnAliasHi">6</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,101 +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 - coverage.info - BayesNet/bayesnet/ensembles/AODELd.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">top level</a> - <a href="index.html">BayesNet/bayesnet/ensembles</a> - AODELd.h<span style="font-size: 80%;"> (source / <a href="AODELd.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">coverage.info</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-04-30 13:17:26</td>
<td></td>
<td class="headerItem">Functions:</td>
<td class="headerCovTableEntryHi">100.0&nbsp;%</td>
<td class="headerCovTableEntry">2</td>
<td class="headerCovTableEntry">2</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 AODELD_H</span>
<span id="L8"><span class="lineNum"> 8</span> : #define AODELD_H</span>
<span id="L9"><span class="lineNum"> 9</span> : #include &quot;bayesnet/classifiers/Proposal.h&quot;</span>
<span id="L10"><span class="lineNum"> 10</span> : #include &quot;bayesnet/classifiers/SPODELd.h&quot;</span>
<span id="L11"><span class="lineNum"> 11</span> : #include &quot;Ensemble.h&quot;</span>
<span id="L12"><span class="lineNum"> 12</span> : </span>
<span id="L13"><span class="lineNum"> 13</span> : namespace bayesnet {</span>
<span id="L14"><span class="lineNum"> 14</span> : class AODELd : public Ensemble, public Proposal {</span>
<span id="L15"><span class="lineNum"> 15</span> : public:</span>
<span id="L16"><span class="lineNum"> 16</span> : AODELd(bool predict_voting = true);</span>
<span id="L17"><span class="lineNum"> 17</span> <span class="tlaGNC tlaBgGNC"> 10 : virtual ~AODELd() = default;</span></span>
<span id="L18"><span class="lineNum"> 18</span> : AODELd&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;AODELd&quot;) const override;</span>
<span id="L20"><span class="lineNum"> 20</span> : protected:</span>
<span id="L21"><span class="lineNum"> 21</span> : void trainModel(const torch::Tensor&amp; weights) override;</span>
<span id="L22"><span class="lineNum"> 22</span> : void buildModel(const torch::Tensor&amp; weights) override;</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 // !AODELD_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,138 +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 - coverage.info - BayesNet/bayesnet/ensembles/BoostAODE.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">top level</a> - <a href="index.html">BayesNet/bayesnet/ensembles</a> - BoostAODE.cc<span style="font-size: 80%;"> (<a href="BoostAODE.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">coverage.info</td>
<td></td>
<td class="headerItem">Lines:</td>
<td class="headerCovTableEntryHi">98.3&nbsp;%</td>
<td class="headerCovTableEntry">237</td>
<td class="headerCovTableEntry">233</td>
</tr>
<tr>
<td class="headerItem">Test Date:</td>
<td class="headerValue">2024-04-30 13:17:26</td>
<td></td>
<td class="headerItem">Functions:</td>
<td class="headerCovTableEntryHi">100.0&nbsp;%</td>
<td class="headerCovTableEntry">9</td>
<td class="headerCovTableEntry">9</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="BoostAODE.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="BoostAODE.cc.gcov.html#L390">_ZNK8bayesnet9BoostAODE5graphERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE</a></td>
<td class="coverFnHi">2</td>
</tr>
<tr>
<td class="coverFn"><a href="BoostAODE.cc.gcov.html#L137">_ZN8bayesnet9BoostAODE20update_weights_blockEiRN2at6TensorES3_</a></td>
<td class="coverFnHi">14</td>
</tr>
<tr>
<td class="coverFn"><a href="BoostAODE.cc.gcov.html#L233">_ZN8bayesnet9BoostAODE16initializeModelsEv</a></td>
<td class="coverFnHi">16</td>
</tr>
<tr>
<td class="coverFn"><a href="BoostAODE.cc.gcov.html#L57">_ZN8bayesnet9BoostAODE18setHyperparametersERKN8nlohmann16json_abi_v3_11_310basic_jsonISt3mapSt6vectorNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEblmdSaNS2_14adl_serializerES5_IhSaIhEEvEE</a></td>
<td class="coverFnHi">44</td>
</tr>
<tr>
<td class="coverFn"><a href="BoostAODE.cc.gcov.html#L26">_ZN8bayesnet9BoostAODE10buildModelERKN2at6TensorE</a></td>
<td class="coverFnHi">46</td>
</tr>
<tr>
<td class="coverFn"><a href="BoostAODE.cc.gcov.html#L266">_ZN8bayesnet9BoostAODE10trainModelERKN2at6TensorE</a></td>
<td class="coverFnHi">46</td>
</tr>
<tr>
<td class="coverFn"><a href="BoostAODE.cc.gcov.html#L18">_ZN8bayesnet9BoostAODEC2Eb</a></td>
<td class="coverFnHi">84</td>
</tr>
<tr>
<td class="coverFn"><a href="BoostAODE.cc.gcov.html#L110">_ZN8bayesnet14update_weightsERN2at6TensorES2_S2_</a></td>
<td class="coverFnHi">272</td>
</tr>
<tr>
<td class="coverFn"><a href="BoostAODE.cc.gcov.html#L313">_ZZN8bayesnet9BoostAODE10trainModelERKN2at6TensorEENKUlT_E_clIiEEDaS5_</a></td>
<td class="coverFnHi">4850</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,138 +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 - coverage.info - BayesNet/bayesnet/ensembles/BoostAODE.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">top level</a> - <a href="index.html">BayesNet/bayesnet/ensembles</a> - BoostAODE.cc<span style="font-size: 80%;"> (<a href="BoostAODE.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">coverage.info</td>
<td></td>
<td class="headerItem">Lines:</td>
<td class="headerCovTableEntryHi">98.3&nbsp;%</td>
<td class="headerCovTableEntry">237</td>
<td class="headerCovTableEntry">233</td>
</tr>
<tr>
<td class="headerItem">Test Date:</td>
<td class="headerValue">2024-04-30 13:17:26</td>
<td></td>
<td class="headerItem">Functions:</td>
<td class="headerCovTableEntryHi">100.0&nbsp;%</td>
<td class="headerCovTableEntry">9</td>
<td class="headerCovTableEntry">9</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="BoostAODE.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="BoostAODE.cc.gcov.html#L110">_ZN8bayesnet14update_weightsERN2at6TensorES2_S2_</a></td>
<td class="coverFnHi">272</td>
</tr>
<tr>
<td class="coverFn"><a href="BoostAODE.cc.gcov.html#L26">_ZN8bayesnet9BoostAODE10buildModelERKN2at6TensorE</a></td>
<td class="coverFnHi">46</td>
</tr>
<tr>
<td class="coverFn"><a href="BoostAODE.cc.gcov.html#L266">_ZN8bayesnet9BoostAODE10trainModelERKN2at6TensorE</a></td>
<td class="coverFnHi">46</td>
</tr>
<tr>
<td class="coverFn"><a href="BoostAODE.cc.gcov.html#L233">_ZN8bayesnet9BoostAODE16initializeModelsEv</a></td>
<td class="coverFnHi">16</td>
</tr>
<tr>
<td class="coverFn"><a href="BoostAODE.cc.gcov.html#L57">_ZN8bayesnet9BoostAODE18setHyperparametersERKN8nlohmann16json_abi_v3_11_310basic_jsonISt3mapSt6vectorNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEblmdSaNS2_14adl_serializerES5_IhSaIhEEvEE</a></td>
<td class="coverFnHi">44</td>
</tr>
<tr>
<td class="coverFn"><a href="BoostAODE.cc.gcov.html#L137">_ZN8bayesnet9BoostAODE20update_weights_blockEiRN2at6TensorES3_</a></td>
<td class="coverFnHi">14</td>
</tr>
<tr>
<td class="coverFn"><a href="BoostAODE.cc.gcov.html#L18">_ZN8bayesnet9BoostAODEC2Eb</a></td>
<td class="coverFnHi">84</td>
</tr>
<tr>
<td class="coverFn"><a href="BoostAODE.cc.gcov.html#L390">_ZNK8bayesnet9BoostAODE5graphERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE</a></td>
<td class="coverFnHi">2</td>
</tr>
<tr>
<td class="coverFn"><a href="BoostAODE.cc.gcov.html#L313">_ZZN8bayesnet9BoostAODE10trainModelERKN2at6TensorEENKUlT_E_clIiEEDaS5_</a></td>
<td class="coverFnHi">4850</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,472 +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 - coverage.info - BayesNet/bayesnet/ensembles/BoostAODE.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">top level</a> - <a href="index.html">BayesNet/bayesnet/ensembles</a> - BoostAODE.cc<span style="font-size: 80%;"> (source / <a href="BoostAODE.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">coverage.info</td>
<td></td>
<td class="headerItem">Lines:</td>
<td class="headerCovTableEntryHi">98.3&nbsp;%</td>
<td class="headerCovTableEntry">237</td>
<td class="headerCovTableEntry">233</td>
</tr>
<tr>
<td class="headerItem">Test Date:</td>
<td class="headerValue">2024-04-30 13:17:26</td>
<td></td>
<td class="headerItem">Functions:</td>
<td class="headerCovTableEntryHi">100.0&nbsp;%</td>
<td class="headerCovTableEntry">9</td>
<td class="headerCovTableEntry">9</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;set&gt;</span>
<span id="L8"><span class="lineNum"> 8</span> : #include &lt;functional&gt;</span>
<span id="L9"><span class="lineNum"> 9</span> : #include &lt;limits.h&gt;</span>
<span id="L10"><span class="lineNum"> 10</span> : #include &lt;tuple&gt;</span>
<span id="L11"><span class="lineNum"> 11</span> : #include &lt;folding.hpp&gt;</span>
<span id="L12"><span class="lineNum"> 12</span> : #include &quot;bayesnet/feature_selection/CFS.h&quot;</span>
<span id="L13"><span class="lineNum"> 13</span> : #include &quot;bayesnet/feature_selection/FCBF.h&quot;</span>
<span id="L14"><span class="lineNum"> 14</span> : #include &quot;bayesnet/feature_selection/IWSS.h&quot;</span>
<span id="L15"><span class="lineNum"> 15</span> : #include &quot;BoostAODE.h&quot;</span>
<span id="L16"><span class="lineNum"> 16</span> : #include &quot;lib/log/loguru.cpp&quot;</span>
<span id="L17"><span class="lineNum"> 17</span> : </span>
<span id="L18"><span class="lineNum"> 18</span> : namespace bayesnet {</span>
<span id="L19"><span class="lineNum"> 19</span> : </span>
<span id="L20"><span class="lineNum"> 20</span> <span class="tlaGNC tlaBgGNC"> 84 : BoostAODE::BoostAODE(bool predict_voting) : Ensemble(predict_voting)</span></span>
<span id="L21"><span class="lineNum"> 21</span> : {</span>
<span id="L22"><span class="lineNum"> 22</span> <span class="tlaGNC"> 924 : validHyperparameters = {</span></span>
<span id="L23"><span class="lineNum"> 23</span> : &quot;maxModels&quot;, &quot;bisection&quot;, &quot;order&quot;, &quot;convergence&quot;, &quot;convergence_best&quot;, &quot;threshold&quot;,</span>
<span id="L24"><span class="lineNum"> 24</span> : &quot;select_features&quot;, &quot;maxTolerance&quot;, &quot;predict_voting&quot;, &quot;block_update&quot;</span>
<span id="L25"><span class="lineNum"> 25</span> <span class="tlaGNC"> 924 : };</span></span>
<span id="L26"><span class="lineNum"> 26</span> : </span>
<span id="L27"><span class="lineNum"> 27</span> <span class="tlaGNC"> 252 : }</span></span>
<span id="L28"><span class="lineNum"> 28</span> <span class="tlaGNC"> 46 : void BoostAODE::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> : // Models shall be built in trainModel</span>
<span id="L31"><span class="lineNum"> 31</span> <span class="tlaGNC"> 46 : models.clear();</span></span>
<span id="L32"><span class="lineNum"> 32</span> <span class="tlaGNC"> 46 : significanceModels.clear();</span></span>
<span id="L33"><span class="lineNum"> 33</span> <span class="tlaGNC"> 46 : n_models = 0;</span></span>
<span id="L34"><span class="lineNum"> 34</span> : // Prepare the validation dataset</span>
<span id="L35"><span class="lineNum"> 35</span> <span class="tlaGNC"> 138 : auto y_ = dataset.index({ -1, &quot;...&quot; });</span></span>
<span id="L36"><span class="lineNum"> 36</span> <span class="tlaGNC"> 46 : if (convergence) {</span></span>
<span id="L37"><span class="lineNum"> 37</span> : // Prepare train &amp; validation sets from train data</span>
<span id="L38"><span class="lineNum"> 38</span> <span class="tlaGNC"> 38 : auto fold = folding::StratifiedKFold(5, y_, 271);</span></span>
<span id="L39"><span class="lineNum"> 39</span> <span class="tlaGNC"> 38 : auto [train, test] = fold.getFold(0);</span></span>
<span id="L40"><span class="lineNum"> 40</span> <span class="tlaGNC"> 38 : auto train_t = torch::tensor(train);</span></span>
<span id="L41"><span class="lineNum"> 41</span> <span class="tlaGNC"> 38 : auto test_t = torch::tensor(test);</span></span>
<span id="L42"><span class="lineNum"> 42</span> : // Get train and validation sets</span>
<span id="L43"><span class="lineNum"> 43</span> <span class="tlaGNC"> 190 : X_train = dataset.index({ torch::indexing::Slice(0, dataset.size(0) - 1), train_t });</span></span>
<span id="L44"><span class="lineNum"> 44</span> <span class="tlaGNC"> 114 : y_train = dataset.index({ -1, train_t });</span></span>
<span id="L45"><span class="lineNum"> 45</span> <span class="tlaGNC"> 190 : X_test = dataset.index({ torch::indexing::Slice(0, dataset.size(0) - 1), test_t });</span></span>
<span id="L46"><span class="lineNum"> 46</span> <span class="tlaGNC"> 114 : y_test = dataset.index({ -1, test_t });</span></span>
<span id="L47"><span class="lineNum"> 47</span> <span class="tlaGNC"> 38 : dataset = X_train;</span></span>
<span id="L48"><span class="lineNum"> 48</span> <span class="tlaGNC"> 38 : m = X_train.size(1);</span></span>
<span id="L49"><span class="lineNum"> 49</span> <span class="tlaGNC"> 38 : auto n_classes = states.at(className).size();</span></span>
<span id="L50"><span class="lineNum"> 50</span> : // Build dataset with train data</span>
<span id="L51"><span class="lineNum"> 51</span> <span class="tlaGNC"> 38 : buildDataset(y_train);</span></span>
<span id="L52"><span class="lineNum"> 52</span> <span class="tlaGNC"> 38 : metrics = Metrics(dataset, features, className, n_classes);</span></span>
<span id="L53"><span class="lineNum"> 53</span> <span class="tlaGNC"> 38 : } else {</span></span>
<span id="L54"><span class="lineNum"> 54</span> : // Use all data to train</span>
<span id="L55"><span class="lineNum"> 55</span> <span class="tlaGNC"> 32 : X_train = dataset.index({ torch::indexing::Slice(0, dataset.size(0) - 1), &quot;...&quot; });</span></span>
<span id="L56"><span class="lineNum"> 56</span> <span class="tlaGNC"> 8 : y_train = y_;</span></span>
<span id="L57"><span class="lineNum"> 57</span> : }</span>
<span id="L58"><span class="lineNum"> 58</span> <span class="tlaGNC"> 450 : }</span></span>
<span id="L59"><span class="lineNum"> 59</span> <span class="tlaGNC"> 44 : void BoostAODE::setHyperparameters(const nlohmann::json&amp; hyperparameters_)</span></span>
<span id="L60"><span class="lineNum"> 60</span> : {</span>
<span id="L61"><span class="lineNum"> 61</span> <span class="tlaGNC"> 44 : auto hyperparameters = hyperparameters_;</span></span>
<span id="L62"><span class="lineNum"> 62</span> <span class="tlaGNC"> 44 : if (hyperparameters.contains(&quot;order&quot;)) {</span></span>
<span id="L63"><span class="lineNum"> 63</span> <span class="tlaGNC"> 50 : std::vector&lt;std::string&gt; algos = { Orders.ASC, Orders.DESC, Orders.RAND };</span></span>
<span id="L64"><span class="lineNum"> 64</span> <span class="tlaGNC"> 10 : order_algorithm = hyperparameters[&quot;order&quot;];</span></span>
<span id="L65"><span class="lineNum"> 65</span> <span class="tlaGNC"> 10 : if (std::find(algos.begin(), algos.end(), order_algorithm) == algos.end()) {</span></span>
<span id="L66"><span class="lineNum"> 66</span> <span class="tlaGNC"> 2 : throw std::invalid_argument(&quot;Invalid order algorithm, valid values [&quot; + Orders.ASC + &quot;, &quot; + Orders.DESC + &quot;, &quot; + Orders.RAND + &quot;]&quot;);</span></span>
<span id="L67"><span class="lineNum"> 67</span> : }</span>
<span id="L68"><span class="lineNum"> 68</span> <span class="tlaGNC"> 8 : hyperparameters.erase(&quot;order&quot;);</span></span>
<span id="L69"><span class="lineNum"> 69</span> <span class="tlaGNC"> 10 : }</span></span>
<span id="L70"><span class="lineNum"> 70</span> <span class="tlaGNC"> 42 : if (hyperparameters.contains(&quot;convergence&quot;)) {</span></span>
<span id="L71"><span class="lineNum"> 71</span> <span class="tlaGNC"> 18 : convergence = hyperparameters[&quot;convergence&quot;];</span></span>
<span id="L72"><span class="lineNum"> 72</span> <span class="tlaGNC"> 18 : hyperparameters.erase(&quot;convergence&quot;);</span></span>
<span id="L73"><span class="lineNum"> 73</span> : }</span>
<span id="L74"><span class="lineNum"> 74</span> <span class="tlaGNC"> 42 : if (hyperparameters.contains(&quot;convergence_best&quot;)) {</span></span>
<span id="L75"><span class="lineNum"> 75</span> <span class="tlaGNC"> 6 : convergence_best = hyperparameters[&quot;convergence_best&quot;];</span></span>
<span id="L76"><span class="lineNum"> 76</span> <span class="tlaGNC"> 6 : hyperparameters.erase(&quot;convergence_best&quot;);</span></span>
<span id="L77"><span class="lineNum"> 77</span> : }</span>
<span id="L78"><span class="lineNum"> 78</span> <span class="tlaGNC"> 42 : if (hyperparameters.contains(&quot;bisection&quot;)) {</span></span>
<span id="L79"><span class="lineNum"> 79</span> <span class="tlaGNC"> 16 : bisection = hyperparameters[&quot;bisection&quot;];</span></span>
<span id="L80"><span class="lineNum"> 80</span> <span class="tlaGNC"> 16 : hyperparameters.erase(&quot;bisection&quot;);</span></span>
<span id="L81"><span class="lineNum"> 81</span> : }</span>
<span id="L82"><span class="lineNum"> 82</span> <span class="tlaGNC"> 42 : if (hyperparameters.contains(&quot;threshold&quot;)) {</span></span>
<span id="L83"><span class="lineNum"> 83</span> <span class="tlaGNC"> 12 : threshold = hyperparameters[&quot;threshold&quot;];</span></span>
<span id="L84"><span class="lineNum"> 84</span> <span class="tlaGNC"> 12 : hyperparameters.erase(&quot;threshold&quot;);</span></span>
<span id="L85"><span class="lineNum"> 85</span> : }</span>
<span id="L86"><span class="lineNum"> 86</span> <span class="tlaGNC"> 42 : if (hyperparameters.contains(&quot;maxTolerance&quot;)) {</span></span>
<span id="L87"><span class="lineNum"> 87</span> <span class="tlaGNC"> 22 : maxTolerance = hyperparameters[&quot;maxTolerance&quot;];</span></span>
<span id="L88"><span class="lineNum"> 88</span> <span class="tlaGNC"> 22 : if (maxTolerance &lt; 1 || maxTolerance &gt; 4)</span></span>
<span id="L89"><span class="lineNum"> 89</span> <span class="tlaGNC"> 6 : throw std::invalid_argument(&quot;Invalid maxTolerance value, must be greater in [1, 4]&quot;);</span></span>
<span id="L90"><span class="lineNum"> 90</span> <span class="tlaGNC"> 16 : hyperparameters.erase(&quot;maxTolerance&quot;);</span></span>
<span id="L91"><span class="lineNum"> 91</span> : }</span>
<span id="L92"><span class="lineNum"> 92</span> <span class="tlaGNC"> 36 : if (hyperparameters.contains(&quot;predict_voting&quot;)) {</span></span>
<span id="L93"><span class="lineNum"> 93</span> <span class="tlaGNC"> 2 : predict_voting = hyperparameters[&quot;predict_voting&quot;];</span></span>
<span id="L94"><span class="lineNum"> 94</span> <span class="tlaGNC"> 2 : hyperparameters.erase(&quot;predict_voting&quot;);</span></span>
<span id="L95"><span class="lineNum"> 95</span> : }</span>
<span id="L96"><span class="lineNum"> 96</span> <span class="tlaGNC"> 36 : if (hyperparameters.contains(&quot;select_features&quot;)) {</span></span>
<span id="L97"><span class="lineNum"> 97</span> <span class="tlaGNC"> 18 : auto selectedAlgorithm = hyperparameters[&quot;select_features&quot;];</span></span>
<span id="L98"><span class="lineNum"> 98</span> <span class="tlaGNC"> 90 : std::vector&lt;std::string&gt; algos = { SelectFeatures.IWSS, SelectFeatures.CFS, SelectFeatures.FCBF };</span></span>
<span id="L99"><span class="lineNum"> 99</span> <span class="tlaGNC"> 18 : selectFeatures = true;</span></span>
<span id="L100"><span class="lineNum"> 100</span> <span class="tlaGNC"> 18 : select_features_algorithm = selectedAlgorithm;</span></span>
<span id="L101"><span class="lineNum"> 101</span> <span class="tlaGNC"> 18 : if (std::find(algos.begin(), algos.end(), selectedAlgorithm) == algos.end()) {</span></span>
<span id="L102"><span class="lineNum"> 102</span> <span class="tlaGNC"> 2 : throw std::invalid_argument(&quot;Invalid selectFeatures value, valid values [&quot; + SelectFeatures.IWSS + &quot;, &quot; + SelectFeatures.CFS + &quot;, &quot; + SelectFeatures.FCBF + &quot;]&quot;);</span></span>
<span id="L103"><span class="lineNum"> 103</span> : }</span>
<span id="L104"><span class="lineNum"> 104</span> <span class="tlaGNC"> 16 : hyperparameters.erase(&quot;select_features&quot;);</span></span>
<span id="L105"><span class="lineNum"> 105</span> <span class="tlaGNC"> 20 : }</span></span>
<span id="L106"><span class="lineNum"> 106</span> <span class="tlaGNC"> 34 : if (hyperparameters.contains(&quot;block_update&quot;)) {</span></span>
<span id="L107"><span class="lineNum"> 107</span> <span class="tlaGNC"> 4 : block_update = hyperparameters[&quot;block_update&quot;];</span></span>
<span id="L108"><span class="lineNum"> 108</span> <span class="tlaGNC"> 4 : hyperparameters.erase(&quot;block_update&quot;);</span></span>
<span id="L109"><span class="lineNum"> 109</span> : }</span>
<span id="L110"><span class="lineNum"> 110</span> <span class="tlaGNC"> 34 : Classifier::setHyperparameters(hyperparameters);</span></span>
<span id="L111"><span class="lineNum"> 111</span> <span class="tlaGNC"> 72 : }</span></span>
<span id="L112"><span class="lineNum"> 112</span> <span class="tlaGNC"> 272 : std::tuple&lt;torch::Tensor&amp;, double, bool&gt; update_weights(torch::Tensor&amp; ytrain, torch::Tensor&amp; ypred, torch::Tensor&amp; weights)</span></span>
<span id="L113"><span class="lineNum"> 113</span> : {</span>
<span id="L114"><span class="lineNum"> 114</span> <span class="tlaGNC"> 272 : bool terminate = false;</span></span>
<span id="L115"><span class="lineNum"> 115</span> <span class="tlaGNC"> 272 : double alpha_t = 0;</span></span>
<span id="L116"><span class="lineNum"> 116</span> <span class="tlaGNC"> 272 : auto mask_wrong = ypred != ytrain;</span></span>
<span id="L117"><span class="lineNum"> 117</span> <span class="tlaGNC"> 272 : auto mask_right = ypred == ytrain;</span></span>
<span id="L118"><span class="lineNum"> 118</span> <span class="tlaGNC"> 272 : auto masked_weights = weights * mask_wrong.to(weights.dtype());</span></span>
<span id="L119"><span class="lineNum"> 119</span> <span class="tlaGNC"> 272 : double epsilon_t = masked_weights.sum().item&lt;double&gt;();</span></span>
<span id="L120"><span class="lineNum"> 120</span> <span class="tlaGNC"> 272 : if (epsilon_t &gt; 0.5) {</span></span>
<span id="L121"><span class="lineNum"> 121</span> : // Inverse the weights policy (plot ln(wt))</span>
<span id="L122"><span class="lineNum"> 122</span> : // &quot;In each round of AdaBoost, there is a sanity check to ensure that the current base </span>
<span id="L123"><span class="lineNum"> 123</span> : // learner is better than random guess&quot; (Zhi-Hua Zhou, 2012)</span>
<span id="L124"><span class="lineNum"> 124</span> <span class="tlaGNC"> 8 : terminate = true;</span></span>
<span id="L125"><span class="lineNum"> 125</span> : } else {</span>
<span id="L126"><span class="lineNum"> 126</span> <span class="tlaGNC"> 264 : double wt = (1 - epsilon_t) / epsilon_t;</span></span>
<span id="L127"><span class="lineNum"> 127</span> <span class="tlaGNC"> 264 : alpha_t = epsilon_t == 0 ? 1 : 0.5 * log(wt);</span></span>
<span id="L128"><span class="lineNum"> 128</span> : // Step 3.2: Update weights for next classifier</span>
<span id="L129"><span class="lineNum"> 129</span> : // Step 3.2.1: Update weights of wrong samples</span>
<span id="L130"><span class="lineNum"> 130</span> <span class="tlaGNC"> 264 : weights += mask_wrong.to(weights.dtype()) * exp(alpha_t) * weights;</span></span>
<span id="L131"><span class="lineNum"> 131</span> : // Step 3.2.2: Update weights of right samples</span>
<span id="L132"><span class="lineNum"> 132</span> <span class="tlaGNC"> 264 : weights += mask_right.to(weights.dtype()) * exp(-alpha_t) * weights;</span></span>
<span id="L133"><span class="lineNum"> 133</span> : // Step 3.3: Normalise the weights</span>
<span id="L134"><span class="lineNum"> 134</span> <span class="tlaGNC"> 264 : double totalWeights = torch::sum(weights).item&lt;double&gt;();</span></span>
<span id="L135"><span class="lineNum"> 135</span> <span class="tlaGNC"> 264 : weights = weights / totalWeights;</span></span>
<span id="L136"><span class="lineNum"> 136</span> : }</span>
<span id="L137"><span class="lineNum"> 137</span> <span class="tlaGNC"> 544 : return { weights, alpha_t, terminate };</span></span>
<span id="L138"><span class="lineNum"> 138</span> <span class="tlaGNC"> 272 : }</span></span>
<span id="L139"><span class="lineNum"> 139</span> <span class="tlaGNC"> 14 : std::tuple&lt;torch::Tensor&amp;, double, bool&gt; BoostAODE::update_weights_block(int k, torch::Tensor&amp; ytrain, torch::Tensor&amp; weights)</span></span>
<span id="L140"><span class="lineNum"> 140</span> : {</span>
<span id="L141"><span class="lineNum"> 141</span> : /* Update Block algorithm</span>
<span id="L142"><span class="lineNum"> 142</span> : k = # of models in block</span>
<span id="L143"><span class="lineNum"> 143</span> : n_models = # of models in ensemble to make predictions</span>
<span id="L144"><span class="lineNum"> 144</span> : n_models_bak = # models saved</span>
<span id="L145"><span class="lineNum"> 145</span> : models = vector of models to make predictions</span>
<span id="L146"><span class="lineNum"> 146</span> : models_bak = models not used to make predictions</span>
<span id="L147"><span class="lineNum"> 147</span> : significances_bak = backup of significances vector</span>
<span id="L148"><span class="lineNum"> 148</span> : </span>
<span id="L149"><span class="lineNum"> 149</span> : Case list</span>
<span id="L150"><span class="lineNum"> 150</span> : A) k = 1, n_models = 1 =&gt; n = 0 , n_models = n + k</span>
<span id="L151"><span class="lineNum"> 151</span> : B) k = 1, n_models = n + 1 =&gt; n_models = n + k</span>
<span id="L152"><span class="lineNum"> 152</span> : C) k &gt; 1, n_models = k + 1 =&gt; n= 1, n_models = n + k</span>
<span id="L153"><span class="lineNum"> 153</span> : D) k &gt; 1, n_models = k =&gt; n = 0, n_models = n + k</span>
<span id="L154"><span class="lineNum"> 154</span> : E) k &gt; 1, n_models = k + n =&gt; n_models = n + k</span>
<span id="L155"><span class="lineNum"> 155</span> : </span>
<span id="L156"><span class="lineNum"> 156</span> : A, D) n=0, k &gt; 0, n_models == k</span>
<span id="L157"><span class="lineNum"> 157</span> : 1. n_models_bak &lt;- n_models</span>
<span id="L158"><span class="lineNum"> 158</span> : 2. significances_bak &lt;- significances</span>
<span id="L159"><span class="lineNum"> 159</span> : 3. significances = vector(k, 1)</span>
<span id="L160"><span class="lineNum"> 160</span> : 4. Dont move any classifiers out of models</span>
<span id="L161"><span class="lineNum"> 161</span> : 5. n_models &lt;- k</span>
<span id="L162"><span class="lineNum"> 162</span> : 6. Make prediction, compute alpha, update weights</span>
<span id="L163"><span class="lineNum"> 163</span> : 7. Dont restore any classifiers to models</span>
<span id="L164"><span class="lineNum"> 164</span> : 8. significances &lt;- significances_bak</span>
<span id="L165"><span class="lineNum"> 165</span> : 9. Update last k significances</span>
<span id="L166"><span class="lineNum"> 166</span> : 10. n_models &lt;- n_models_bak</span>
<span id="L167"><span class="lineNum"> 167</span> : </span>
<span id="L168"><span class="lineNum"> 168</span> : B, C, E) n &gt; 0, k &gt; 0, n_models == n + k</span>
<span id="L169"><span class="lineNum"> 169</span> : 1. n_models_bak &lt;- n_models</span>
<span id="L170"><span class="lineNum"> 170</span> : 2. significances_bak &lt;- significances</span>
<span id="L171"><span class="lineNum"> 171</span> : 3. significances = vector(k, 1)</span>
<span id="L172"><span class="lineNum"> 172</span> : 4. Move first n classifiers to models_bak</span>
<span id="L173"><span class="lineNum"> 173</span> : 5. n_models &lt;- k</span>
<span id="L174"><span class="lineNum"> 174</span> : 6. Make prediction, compute alpha, update weights</span>
<span id="L175"><span class="lineNum"> 175</span> : 7. Insert classifiers in models_bak to be the first n models</span>
<span id="L176"><span class="lineNum"> 176</span> : 8. significances &lt;- significances_bak</span>
<span id="L177"><span class="lineNum"> 177</span> : 9. Update last k significances</span>
<span id="L178"><span class="lineNum"> 178</span> : 10. n_models &lt;- n_models_bak</span>
<span id="L179"><span class="lineNum"> 179</span> : */</span>
<span id="L180"><span class="lineNum"> 180</span> : //</span>
<span id="L181"><span class="lineNum"> 181</span> : // Make predict with only the last k models</span>
<span id="L182"><span class="lineNum"> 182</span> : //</span>
<span id="L183"><span class="lineNum"> 183</span> <span class="tlaGNC"> 14 : std::unique_ptr&lt;Classifier&gt; model;</span></span>
<span id="L184"><span class="lineNum"> 184</span> <span class="tlaGNC"> 14 : std::vector&lt;std::unique_ptr&lt;Classifier&gt;&gt; models_bak;</span></span>
<span id="L185"><span class="lineNum"> 185</span> : // 1. n_models_bak &lt;- n_models 2. significances_bak &lt;- significances</span>
<span id="L186"><span class="lineNum"> 186</span> <span class="tlaGNC"> 14 : auto significance_bak = significanceModels;</span></span>
<span id="L187"><span class="lineNum"> 187</span> <span class="tlaGNC"> 14 : auto n_models_bak = n_models;</span></span>
<span id="L188"><span class="lineNum"> 188</span> : // 3. significances = vector(k, 1)</span>
<span id="L189"><span class="lineNum"> 189</span> <span class="tlaGNC"> 14 : significanceModels = std::vector&lt;double&gt;(k, 1.0);</span></span>
<span id="L190"><span class="lineNum"> 190</span> : // 4. Move first n classifiers to models_bak</span>
<span id="L191"><span class="lineNum"> 191</span> : // backup the first n_models - k models (if n_models == k, don't backup any)</span>
<span id="L192"><span class="lineNum"> 192</span> <span class="tlaGNC"> 74 : for (int i = 0; i &lt; n_models - k; ++i) {</span></span>
<span id="L193"><span class="lineNum"> 193</span> <span class="tlaGNC"> 60 : model = std::move(models[0]);</span></span>
<span id="L194"><span class="lineNum"> 194</span> <span class="tlaGNC"> 60 : models.erase(models.begin());</span></span>
<span id="L195"><span class="lineNum"> 195</span> <span class="tlaGNC"> 60 : models_bak.push_back(std::move(model));</span></span>
<span id="L196"><span class="lineNum"> 196</span> : }</span>
<span id="L197"><span class="lineNum"> 197</span> <span class="tlaGNC"> 14 : assert(models.size() == k);</span></span>
<span id="L198"><span class="lineNum"> 198</span> : // 5. n_models &lt;- k</span>
<span id="L199"><span class="lineNum"> 199</span> <span class="tlaGNC"> 14 : n_models = k;</span></span>
<span id="L200"><span class="lineNum"> 200</span> : // 6. Make prediction, compute alpha, update weights</span>
<span id="L201"><span class="lineNum"> 201</span> <span class="tlaGNC"> 14 : auto ypred = predict(X_train);</span></span>
<span id="L202"><span class="lineNum"> 202</span> : //</span>
<span id="L203"><span class="lineNum"> 203</span> : // Update weights</span>
<span id="L204"><span class="lineNum"> 204</span> : //</span>
<span id="L205"><span class="lineNum"> 205</span> : double alpha_t;</span>
<span id="L206"><span class="lineNum"> 206</span> : bool terminate;</span>
<span id="L207"><span class="lineNum"> 207</span> <span class="tlaGNC"> 14 : std::tie(weights, alpha_t, terminate) = update_weights(y_train, ypred, weights);</span></span>
<span id="L208"><span class="lineNum"> 208</span> : //</span>
<span id="L209"><span class="lineNum"> 209</span> : // Restore the models if needed</span>
<span id="L210"><span class="lineNum"> 210</span> : //</span>
<span id="L211"><span class="lineNum"> 211</span> : // 7. Insert classifiers in models_bak to be the first n models</span>
<span id="L212"><span class="lineNum"> 212</span> : // if n_models_bak == k, don't restore any, because none of them were moved</span>
<span id="L213"><span class="lineNum"> 213</span> <span class="tlaGNC"> 14 : if (k != n_models_bak) {</span></span>
<span id="L214"><span class="lineNum"> 214</span> : // Insert in the same order as they were extracted</span>
<span id="L215"><span class="lineNum"> 215</span> <span class="tlaGNC"> 12 : int bak_size = models_bak.size();</span></span>
<span id="L216"><span class="lineNum"> 216</span> <span class="tlaGNC"> 72 : for (int i = 0; i &lt; bak_size; ++i) {</span></span>
<span id="L217"><span class="lineNum"> 217</span> <span class="tlaGNC"> 60 : model = std::move(models_bak[bak_size - 1 - i]);</span></span>
<span id="L218"><span class="lineNum"> 218</span> <span class="tlaGNC"> 60 : models_bak.erase(models_bak.end() - 1);</span></span>
<span id="L219"><span class="lineNum"> 219</span> <span class="tlaGNC"> 60 : models.insert(models.begin(), std::move(model));</span></span>
<span id="L220"><span class="lineNum"> 220</span> : }</span>
<span id="L221"><span class="lineNum"> 221</span> : }</span>
<span id="L222"><span class="lineNum"> 222</span> : // 8. significances &lt;- significances_bak</span>
<span id="L223"><span class="lineNum"> 223</span> <span class="tlaGNC"> 14 : significanceModels = significance_bak;</span></span>
<span id="L224"><span class="lineNum"> 224</span> : //</span>
<span id="L225"><span class="lineNum"> 225</span> : // Update the significance of the last k models</span>
<span id="L226"><span class="lineNum"> 226</span> : //</span>
<span id="L227"><span class="lineNum"> 227</span> : // 9. Update last k significances</span>
<span id="L228"><span class="lineNum"> 228</span> <span class="tlaGNC"> 52 : for (int i = 0; i &lt; k; ++i) {</span></span>
<span id="L229"><span class="lineNum"> 229</span> <span class="tlaGNC"> 38 : significanceModels[n_models_bak - k + i] = alpha_t;</span></span>
<span id="L230"><span class="lineNum"> 230</span> : }</span>
<span id="L231"><span class="lineNum"> 231</span> : // 10. n_models &lt;- n_models_bak</span>
<span id="L232"><span class="lineNum"> 232</span> <span class="tlaGNC"> 14 : n_models = n_models_bak;</span></span>
<span id="L233"><span class="lineNum"> 233</span> <span class="tlaGNC"> 28 : return { weights, alpha_t, terminate };</span></span>
<span id="L234"><span class="lineNum"> 234</span> <span class="tlaGNC"> 14 : }</span></span>
<span id="L235"><span class="lineNum"> 235</span> <span class="tlaGNC"> 16 : std::vector&lt;int&gt; BoostAODE::initializeModels()</span></span>
<span id="L236"><span class="lineNum"> 236</span> : {</span>
<span id="L237"><span class="lineNum"> 237</span> <span class="tlaGNC"> 16 : std::vector&lt;int&gt; featuresUsed;</span></span>
<span id="L238"><span class="lineNum"> 238</span> <span class="tlaGNC"> 16 : torch::Tensor weights_ = torch::full({ m }, 1.0 / m, torch::kFloat64);</span></span>
<span id="L239"><span class="lineNum"> 239</span> <span class="tlaGNC"> 16 : int maxFeatures = 0;</span></span>
<span id="L240"><span class="lineNum"> 240</span> <span class="tlaGNC"> 16 : if (select_features_algorithm == SelectFeatures.CFS) {</span></span>
<span id="L241"><span class="lineNum"> 241</span> <span class="tlaGNC"> 4 : featureSelector = new CFS(dataset, features, className, maxFeatures, states.at(className).size(), weights_);</span></span>
<span id="L242"><span class="lineNum"> 242</span> <span class="tlaGNC"> 12 : } else if (select_features_algorithm == SelectFeatures.IWSS) {</span></span>
<span id="L243"><span class="lineNum"> 243</span> <span class="tlaGNC"> 6 : if (threshold &lt; 0 || threshold &gt;0.5) {</span></span>
<span id="L244"><span class="lineNum"> 244</span> <span class="tlaGNC"> 4 : throw std::invalid_argument(&quot;Invalid threshold value for &quot; + SelectFeatures.IWSS + &quot; [0, 0.5]&quot;);</span></span>
<span id="L245"><span class="lineNum"> 245</span> : }</span>
<span id="L246"><span class="lineNum"> 246</span> <span class="tlaGNC"> 2 : featureSelector = new IWSS(dataset, features, className, maxFeatures, states.at(className).size(), weights_, threshold);</span></span>
<span id="L247"><span class="lineNum"> 247</span> <span class="tlaGNC"> 6 : } else if (select_features_algorithm == SelectFeatures.FCBF) {</span></span>
<span id="L248"><span class="lineNum"> 248</span> <span class="tlaGNC"> 6 : if (threshold &lt; 1e-7 || threshold &gt; 1) {</span></span>
<span id="L249"><span class="lineNum"> 249</span> <span class="tlaGNC"> 4 : throw std::invalid_argument(&quot;Invalid threshold value for &quot; + SelectFeatures.FCBF + &quot; [1e-7, 1]&quot;);</span></span>
<span id="L250"><span class="lineNum"> 250</span> : }</span>
<span id="L251"><span class="lineNum"> 251</span> <span class="tlaGNC"> 2 : featureSelector = new FCBF(dataset, features, className, maxFeatures, states.at(className).size(), weights_, threshold);</span></span>
<span id="L252"><span class="lineNum"> 252</span> : }</span>
<span id="L253"><span class="lineNum"> 253</span> <span class="tlaGNC"> 8 : featureSelector-&gt;fit();</span></span>
<span id="L254"><span class="lineNum"> 254</span> <span class="tlaGNC"> 8 : auto cfsFeatures = featureSelector-&gt;getFeatures();</span></span>
<span id="L255"><span class="lineNum"> 255</span> <span class="tlaGNC"> 8 : auto scores = featureSelector-&gt;getScores();</span></span>
<span id="L256"><span class="lineNum"> 256</span> <span class="tlaGNC"> 50 : for (const int&amp; feature : cfsFeatures) {</span></span>
<span id="L257"><span class="lineNum"> 257</span> <span class="tlaGNC"> 42 : featuresUsed.push_back(feature);</span></span>
<span id="L258"><span class="lineNum"> 258</span> <span class="tlaGNC"> 42 : std::unique_ptr&lt;Classifier&gt; model = std::make_unique&lt;SPODE&gt;(feature);</span></span>
<span id="L259"><span class="lineNum"> 259</span> <span class="tlaGNC"> 42 : model-&gt;fit(dataset, features, className, states, weights_);</span></span>
<span id="L260"><span class="lineNum"> 260</span> <span class="tlaGNC"> 42 : models.push_back(std::move(model));</span></span>
<span id="L261"><span class="lineNum"> 261</span> <span class="tlaGNC"> 42 : significanceModels.push_back(1.0); // They will be updated later in trainModel</span></span>
<span id="L262"><span class="lineNum"> 262</span> <span class="tlaGNC"> 42 : n_models++;</span></span>
<span id="L263"><span class="lineNum"> 263</span> <span class="tlaGNC"> 42 : }</span></span>
<span id="L264"><span class="lineNum"> 264</span> <span class="tlaGNC"> 8 : notes.push_back(&quot;Used features in initialization: &quot; + std::to_string(featuresUsed.size()) + &quot; of &quot; + std::to_string(features.size()) + &quot; with &quot; + select_features_algorithm);</span></span>
<span id="L265"><span class="lineNum"> 265</span> <span class="tlaGNC"> 8 : delete featureSelector;</span></span>
<span id="L266"><span class="lineNum"> 266</span> <span class="tlaGNC"> 16 : return featuresUsed;</span></span>
<span id="L267"><span class="lineNum"> 267</span> <span class="tlaGNC"> 24 : }</span></span>
<span id="L268"><span class="lineNum"> 268</span> <span class="tlaGNC"> 46 : void BoostAODE::trainModel(const torch::Tensor&amp; weights)</span></span>
<span id="L269"><span class="lineNum"> 269</span> : {</span>
<span id="L270"><span class="lineNum"> 270</span> : //</span>
<span id="L271"><span class="lineNum"> 271</span> : // Logging setup</span>
<span id="L272"><span class="lineNum"> 272</span> : //</span>
<span id="L273"><span class="lineNum"> 273</span> <span class="tlaGNC"> 46 : loguru::set_thread_name(&quot;BoostAODE&quot;);</span></span>
<span id="L274"><span class="lineNum"> 274</span> <span class="tlaGNC"> 46 : loguru::g_stderr_verbosity = loguru::Verbosity_OFF;</span></span>
<span id="L275"><span class="lineNum"> 275</span> <span class="tlaGNC"> 46 : loguru::add_file(&quot;boostAODE.log&quot;, loguru::Truncate, loguru::Verbosity_MAX);</span></span>
<span id="L276"><span class="lineNum"> 276</span> : </span>
<span id="L277"><span class="lineNum"> 277</span> : // Algorithm based on the adaboost algorithm for classification</span>
<span id="L278"><span class="lineNum"> 278</span> : // as explained in Ensemble methods (Zhi-Hua Zhou, 2012)</span>
<span id="L279"><span class="lineNum"> 279</span> <span class="tlaGNC"> 46 : fitted = true;</span></span>
<span id="L280"><span class="lineNum"> 280</span> <span class="tlaGNC"> 46 : double alpha_t = 0;</span></span>
<span id="L281"><span class="lineNum"> 281</span> <span class="tlaGNC"> 46 : torch::Tensor weights_ = torch::full({ m }, 1.0 / m, torch::kFloat64);</span></span>
<span id="L282"><span class="lineNum"> 282</span> <span class="tlaGNC"> 46 : bool finished = false;</span></span>
<span id="L283"><span class="lineNum"> 283</span> <span class="tlaGNC"> 46 : std::vector&lt;int&gt; featuresUsed;</span></span>
<span id="L284"><span class="lineNum"> 284</span> <span class="tlaGNC"> 46 : if (selectFeatures) {</span></span>
<span id="L285"><span class="lineNum"> 285</span> <span class="tlaGNC"> 16 : featuresUsed = initializeModels();</span></span>
<span id="L286"><span class="lineNum"> 286</span> <span class="tlaGNC"> 8 : auto ypred = predict(X_train);</span></span>
<span id="L287"><span class="lineNum"> 287</span> <span class="tlaGNC"> 8 : std::tie(weights_, alpha_t, finished) = update_weights(y_train, ypred, weights_);</span></span>
<span id="L288"><span class="lineNum"> 288</span> : // Update significance of the models</span>
<span id="L289"><span class="lineNum"> 289</span> <span class="tlaGNC"> 50 : for (int i = 0; i &lt; n_models; ++i) {</span></span>
<span id="L290"><span class="lineNum"> 290</span> <span class="tlaGNC"> 42 : significanceModels[i] = alpha_t;</span></span>
<span id="L291"><span class="lineNum"> 291</span> : }</span>
<span id="L292"><span class="lineNum"> 292</span> <span class="tlaGNC"> 8 : if (finished) {</span></span>
<span id="L293"><span class="lineNum"> 293</span> <span class="tlaUNC tlaBgUNC"> 0 : return;</span></span>
<span id="L294"><span class="lineNum"> 294</span> : }</span>
<span id="L295"><span class="lineNum"> 295</span> <span class="tlaGNC tlaBgGNC"> 8 : }</span></span>
<span id="L296"><span class="lineNum"> 296</span> <span class="tlaGNC"> 38 : int numItemsPack = 0; // The counter of the models inserted in the current pack</span></span>
<span id="L297"><span class="lineNum"> 297</span> : // Variables to control the accuracy finish condition</span>
<span id="L298"><span class="lineNum"> 298</span> <span class="tlaGNC"> 38 : double priorAccuracy = 0.0;</span></span>
<span id="L299"><span class="lineNum"> 299</span> <span class="tlaGNC"> 38 : double improvement = 1.0;</span></span>
<span id="L300"><span class="lineNum"> 300</span> <span class="tlaGNC"> 38 : double convergence_threshold = 1e-4;</span></span>
<span id="L301"><span class="lineNum"> 301</span> <span class="tlaGNC"> 38 : int tolerance = 0; // number of times the accuracy is lower than the convergence_threshold</span></span>
<span id="L302"><span class="lineNum"> 302</span> : // Step 0: Set the finish condition</span>
<span id="L303"><span class="lineNum"> 303</span> : // epsilon sub t &gt; 0.5 =&gt; inverse the weights policy</span>
<span id="L304"><span class="lineNum"> 304</span> : // validation error is not decreasing</span>
<span id="L305"><span class="lineNum"> 305</span> : // run out of features</span>
<span id="L306"><span class="lineNum"> 306</span> <span class="tlaGNC"> 38 : bool ascending = order_algorithm == Orders.ASC;</span></span>
<span id="L307"><span class="lineNum"> 307</span> <span class="tlaGNC"> 38 : std::mt19937 g{ 173 };</span></span>
<span id="L308"><span class="lineNum"> 308</span> <span class="tlaGNC"> 252 : while (!finished) {</span></span>
<span id="L309"><span class="lineNum"> 309</span> : // Step 1: Build ranking with mutual information</span>
<span id="L310"><span class="lineNum"> 310</span> <span class="tlaGNC"> 214 : auto featureSelection = metrics.SelectKBestWeighted(weights_, ascending, n); // Get all the features sorted</span></span>
<span id="L311"><span class="lineNum"> 311</span> <span class="tlaGNC"> 214 : if (order_algorithm == Orders.RAND) {</span></span>
<span id="L312"><span class="lineNum"> 312</span> <span class="tlaGNC"> 18 : std::shuffle(featureSelection.begin(), featureSelection.end(), g);</span></span>
<span id="L313"><span class="lineNum"> 313</span> : }</span>
<span id="L314"><span class="lineNum"> 314</span> : // Remove used features</span>
<span id="L315"><span class="lineNum"> 315</span> <span class="tlaGNC"> 428 : featureSelection.erase(remove_if(begin(featureSelection), end(featureSelection), [&amp;](auto x)</span></span>
<span id="L316"><span class="lineNum"> 316</span> <span class="tlaGNC"> 19400 : { return std::find(begin(featuresUsed), end(featuresUsed), x) != end(featuresUsed);}),</span></span>
<span id="L317"><span class="lineNum"> 317</span> <span class="tlaGNC"> 214 : end(featureSelection)</span></span>
<span id="L318"><span class="lineNum"> 318</span> : );</span>
<span id="L319"><span class="lineNum"> 319</span> <span class="tlaGNC"> 214 : int k = bisection ? pow(2, tolerance) : 1;</span></span>
<span id="L320"><span class="lineNum"> 320</span> <span class="tlaGNC"> 214 : int counter = 0; // The model counter of the current pack</span></span>
<span id="L321"><span class="lineNum"> 321</span> <span class="tlaGNC"> 214 : VLOG_SCOPE_F(1, &quot;counter=%d k=%d featureSelection.size: %zu&quot;, counter, k, featureSelection.size());</span></span>
<span id="L322"><span class="lineNum"> 322</span> <span class="tlaGNC"> 502 : while (counter++ &lt; k &amp;&amp; featureSelection.size() &gt; 0) {</span></span>
<span id="L323"><span class="lineNum"> 323</span> <span class="tlaGNC"> 288 : auto feature = featureSelection[0];</span></span>
<span id="L324"><span class="lineNum"> 324</span> <span class="tlaGNC"> 288 : featureSelection.erase(featureSelection.begin());</span></span>
<span id="L325"><span class="lineNum"> 325</span> <span class="tlaGNC"> 288 : std::unique_ptr&lt;Classifier&gt; model;</span></span>
<span id="L326"><span class="lineNum"> 326</span> <span class="tlaGNC"> 288 : model = std::make_unique&lt;SPODE&gt;(feature);</span></span>
<span id="L327"><span class="lineNum"> 327</span> <span class="tlaGNC"> 288 : model-&gt;fit(dataset, features, className, states, weights_);</span></span>
<span id="L328"><span class="lineNum"> 328</span> <span class="tlaGNC"> 288 : alpha_t = 0.0;</span></span>
<span id="L329"><span class="lineNum"> 329</span> <span class="tlaGNC"> 288 : if (!block_update) {</span></span>
<span id="L330"><span class="lineNum"> 330</span> <span class="tlaGNC"> 250 : auto ypred = model-&gt;predict(X_train);</span></span>
<span id="L331"><span class="lineNum"> 331</span> : // Step 3.1: Compute the classifier amout of say</span>
<span id="L332"><span class="lineNum"> 332</span> <span class="tlaGNC"> 250 : std::tie(weights_, alpha_t, finished) = update_weights(y_train, ypred, weights_);</span></span>
<span id="L333"><span class="lineNum"> 333</span> <span class="tlaGNC"> 250 : }</span></span>
<span id="L334"><span class="lineNum"> 334</span> : // Step 3.4: Store classifier and its accuracy to weigh its future vote</span>
<span id="L335"><span class="lineNum"> 335</span> <span class="tlaGNC"> 288 : numItemsPack++;</span></span>
<span id="L336"><span class="lineNum"> 336</span> <span class="tlaGNC"> 288 : featuresUsed.push_back(feature);</span></span>
<span id="L337"><span class="lineNum"> 337</span> <span class="tlaGNC"> 288 : models.push_back(std::move(model));</span></span>
<span id="L338"><span class="lineNum"> 338</span> <span class="tlaGNC"> 288 : significanceModels.push_back(alpha_t);</span></span>
<span id="L339"><span class="lineNum"> 339</span> <span class="tlaGNC"> 288 : n_models++;</span></span>
<span id="L340"><span class="lineNum"> 340</span> <span class="tlaGNC"> 288 : VLOG_SCOPE_F(2, &quot;numItemsPack: %d n_models: %d featuresUsed: %zu&quot;, numItemsPack, n_models, featuresUsed.size());</span></span>
<span id="L341"><span class="lineNum"> 341</span> <span class="tlaGNC"> 288 : }</span></span>
<span id="L342"><span class="lineNum"> 342</span> <span class="tlaGNC"> 214 : if (block_update) {</span></span>
<span id="L343"><span class="lineNum"> 343</span> <span class="tlaGNC"> 14 : std::tie(weights_, alpha_t, finished) = update_weights_block(k, y_train, weights_);</span></span>
<span id="L344"><span class="lineNum"> 344</span> : }</span>
<span id="L345"><span class="lineNum"> 345</span> <span class="tlaGNC"> 214 : if (convergence &amp;&amp; !finished) {</span></span>
<span id="L346"><span class="lineNum"> 346</span> <span class="tlaGNC"> 148 : auto y_val_predict = predict(X_test);</span></span>
<span id="L347"><span class="lineNum"> 347</span> <span class="tlaGNC"> 148 : double accuracy = (y_val_predict == y_test).sum().item&lt;double&gt;() / (double)y_test.size(0);</span></span>
<span id="L348"><span class="lineNum"> 348</span> <span class="tlaGNC"> 148 : if (priorAccuracy == 0) {</span></span>
<span id="L349"><span class="lineNum"> 349</span> <span class="tlaGNC"> 30 : priorAccuracy = accuracy;</span></span>
<span id="L350"><span class="lineNum"> 350</span> : } else {</span>
<span id="L351"><span class="lineNum"> 351</span> <span class="tlaGNC"> 118 : improvement = accuracy - priorAccuracy;</span></span>
<span id="L352"><span class="lineNum"> 352</span> : }</span>
<span id="L353"><span class="lineNum"> 353</span> <span class="tlaGNC"> 148 : if (improvement &lt; convergence_threshold) {</span></span>
<span id="L354"><span class="lineNum"> 354</span> <span class="tlaGNC"> 88 : VLOG_SCOPE_F(3, &quot; (improvement&lt;threshold) tolerance: %d numItemsPack: %d improvement: %f prior: %f current: %f&quot;, tolerance, numItemsPack, improvement, priorAccuracy, accuracy);</span></span>
<span id="L355"><span class="lineNum"> 355</span> <span class="tlaGNC"> 88 : tolerance++;</span></span>
<span id="L356"><span class="lineNum"> 356</span> <span class="tlaGNC"> 88 : } else {</span></span>
<span id="L357"><span class="lineNum"> 357</span> <span class="tlaGNC"> 60 : VLOG_SCOPE_F(3, &quot;* (improvement&gt;=threshold) Reset. tolerance: %d numItemsPack: %d improvement: %f prior: %f current: %f&quot;, tolerance, numItemsPack, improvement, priorAccuracy, accuracy);</span></span>
<span id="L358"><span class="lineNum"> 358</span> <span class="tlaGNC"> 60 : tolerance = 0; // Reset the counter if the model performs better</span></span>
<span id="L359"><span class="lineNum"> 359</span> <span class="tlaGNC"> 60 : numItemsPack = 0;</span></span>
<span id="L360"><span class="lineNum"> 360</span> <span class="tlaGNC"> 60 : }</span></span>
<span id="L361"><span class="lineNum"> 361</span> <span class="tlaGNC"> 148 : if (convergence_best) {</span></span>
<span id="L362"><span class="lineNum"> 362</span> : // Keep the best accuracy until now as the prior accuracy</span>
<span id="L363"><span class="lineNum"> 363</span> <span class="tlaGNC"> 16 : priorAccuracy = std::max(accuracy, priorAccuracy);</span></span>
<span id="L364"><span class="lineNum"> 364</span> : } else {</span>
<span id="L365"><span class="lineNum"> 365</span> : // Keep the last accuray obtained as the prior accuracy</span>
<span id="L366"><span class="lineNum"> 366</span> <span class="tlaGNC"> 132 : priorAccuracy = accuracy;</span></span>
<span id="L367"><span class="lineNum"> 367</span> : }</span>
<span id="L368"><span class="lineNum"> 368</span> <span class="tlaGNC"> 148 : }</span></span>
<span id="L369"><span class="lineNum"> 369</span> <span class="tlaGNC"> 214 : VLOG_SCOPE_F(1, &quot;tolerance: %d featuresUsed.size: %zu features.size: %zu&quot;, tolerance, featuresUsed.size(), features.size());</span></span>
<span id="L370"><span class="lineNum"> 370</span> <span class="tlaGNC"> 214 : finished = finished || tolerance &gt; maxTolerance || featuresUsed.size() == features.size();</span></span>
<span id="L371"><span class="lineNum"> 371</span> <span class="tlaGNC"> 214 : }</span></span>
<span id="L372"><span class="lineNum"> 372</span> <span class="tlaGNC"> 38 : if (tolerance &gt; maxTolerance) {</span></span>
<span id="L373"><span class="lineNum"> 373</span> <span class="tlaGNC"> 4 : if (numItemsPack &lt; n_models) {</span></span>
<span id="L374"><span class="lineNum"> 374</span> <span class="tlaGNC"> 4 : notes.push_back(&quot;Convergence threshold reached &amp; &quot; + std::to_string(numItemsPack) + &quot; models eliminated&quot;);</span></span>
<span id="L375"><span class="lineNum"> 375</span> <span class="tlaGNC"> 4 : VLOG_SCOPE_F(4, &quot;Convergence threshold reached &amp; %d models eliminated of %d&quot;, numItemsPack, n_models);</span></span>
<span id="L376"><span class="lineNum"> 376</span> <span class="tlaGNC"> 52 : for (int i = 0; i &lt; numItemsPack; ++i) {</span></span>
<span id="L377"><span class="lineNum"> 377</span> <span class="tlaGNC"> 48 : significanceModels.pop_back();</span></span>
<span id="L378"><span class="lineNum"> 378</span> <span class="tlaGNC"> 48 : models.pop_back();</span></span>
<span id="L379"><span class="lineNum"> 379</span> <span class="tlaGNC"> 48 : n_models--;</span></span>
<span id="L380"><span class="lineNum"> 380</span> : }</span>
<span id="L381"><span class="lineNum"> 381</span> <span class="tlaGNC"> 4 : } else {</span></span>
<span id="L382"><span class="lineNum"> 382</span> <span class="tlaUNC tlaBgUNC"> 0 : notes.push_back(&quot;Convergence threshold reached &amp; 0 models eliminated&quot;);</span></span>
<span id="L383"><span class="lineNum"> 383</span> <span class="tlaUNC"> 0 : VLOG_SCOPE_F(4, &quot;Convergence threshold reached &amp; 0 models eliminated n_models=%d numItemsPack=%d&quot;, n_models, numItemsPack);</span></span>
<span id="L384"><span class="lineNum"> 384</span> <span class="tlaUNC"> 0 : }</span></span>
<span id="L385"><span class="lineNum"> 385</span> : }</span>
<span id="L386"><span class="lineNum"> 386</span> <span class="tlaGNC tlaBgGNC"> 38 : if (featuresUsed.size() != features.size()) {</span></span>
<span id="L387"><span class="lineNum"> 387</span> <span class="tlaGNC"> 2 : notes.push_back(&quot;Used features in train: &quot; + std::to_string(featuresUsed.size()) + &quot; of &quot; + std::to_string(features.size()));</span></span>
<span id="L388"><span class="lineNum"> 388</span> <span class="tlaGNC"> 2 : status = WARNING;</span></span>
<span id="L389"><span class="lineNum"> 389</span> : }</span>
<span id="L390"><span class="lineNum"> 390</span> <span class="tlaGNC"> 38 : notes.push_back(&quot;Number of models: &quot; + std::to_string(n_models));</span></span>
<span id="L391"><span class="lineNum"> 391</span> <span class="tlaGNC"> 54 : }</span></span>
<span id="L392"><span class="lineNum"> 392</span> <span class="tlaGNC"> 2 : std::vector&lt;std::string&gt; BoostAODE::graph(const std::string&amp; title) const</span></span>
<span id="L393"><span class="lineNum"> 393</span> : {</span>
<span id="L394"><span class="lineNum"> 394</span> <span class="tlaGNC"> 2 : return Ensemble::graph(title);</span></span>
<span id="L395"><span class="lineNum"> 395</span> : }</span>
<span id="L396"><span class="lineNum"> 396</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,96 +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 - coverage.info - BayesNet/bayesnet/ensembles/BoostAODE.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">top level</a> - <a href="index.html">BayesNet/bayesnet/ensembles</a> - BoostAODE.h<span style="font-size: 80%;"> (<a href="BoostAODE.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">coverage.info</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-04-30 13:17:26</td>
<td></td>
<td class="headerItem">Functions:</td>
<td class="headerCovTableEntryHi">100.0&nbsp;%</td>
<td class="headerCovTableEntry">2</td>
<td class="headerCovTableEntry">2</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="BoostAODE.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="BoostAODE.h.gcov.html#L25">_ZN8bayesnet9BoostAODED0Ev</a></td>
<td class="coverFnHi">44</td>
</tr>
<tr>
<td class="coverFnAlias"><a href="BoostAODE.h.gcov.html#L25">_ZN8bayesnet9BoostAODED0Ev</a></td>
<td class="coverFnAliasHi">4</td>
</tr>
<tr>
<td class="coverFnAlias"><a href="BoostAODE.h.gcov.html#L25">_ZN8bayesnet9BoostAODED2Ev</a></td>
<td class="coverFnAliasHi">40</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,96 +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 - coverage.info - BayesNet/bayesnet/ensembles/BoostAODE.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">top level</a> - <a href="index.html">BayesNet/bayesnet/ensembles</a> - BoostAODE.h<span style="font-size: 80%;"> (<a href="BoostAODE.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">coverage.info</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-04-30 13:17:26</td>
<td></td>
<td class="headerItem">Functions:</td>
<td class="headerCovTableEntryHi">100.0&nbsp;%</td>
<td class="headerCovTableEntry">2</td>
<td class="headerCovTableEntry">2</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="BoostAODE.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="BoostAODE.h.gcov.html#L25">_ZN8bayesnet9BoostAODED0Ev</a></td>
<td class="coverFnHi">44</td>
</tr>
<tr>
<td class="coverFnAlias"><a href="BoostAODE.h.gcov.html#L25">_ZN8bayesnet9BoostAODED0Ev</a></td>
<td class="coverFnAliasHi">4</td>
</tr>
<tr>
<td class="coverFnAlias"><a href="BoostAODE.h.gcov.html#L25">_ZN8bayesnet9BoostAODED2Ev</a></td>
<td class="coverFnAliasHi">40</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,126 +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 - coverage.info - BayesNet/bayesnet/ensembles/BoostAODE.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">top level</a> - <a href="index.html">BayesNet/bayesnet/ensembles</a> - BoostAODE.h<span style="font-size: 80%;"> (source / <a href="BoostAODE.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">coverage.info</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-04-30 13:17:26</td>
<td></td>
<td class="headerItem">Functions:</td>
<td class="headerCovTableEntryHi">100.0&nbsp;%</td>
<td class="headerCovTableEntry">2</td>
<td class="headerCovTableEntry">2</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 BOOSTAODE_H</span>
<span id="L8"><span class="lineNum"> 8</span> : #define BOOSTAODE_H</span>
<span id="L9"><span class="lineNum"> 9</span> : #include &lt;map&gt;</span>
<span id="L10"><span class="lineNum"> 10</span> : #include &quot;bayesnet/classifiers/SPODE.h&quot;</span>
<span id="L11"><span class="lineNum"> 11</span> : #include &quot;bayesnet/feature_selection/FeatureSelect.h&quot;</span>
<span id="L12"><span class="lineNum"> 12</span> : #include &quot;Ensemble.h&quot;</span>
<span id="L13"><span class="lineNum"> 13</span> : namespace bayesnet {</span>
<span id="L14"><span class="lineNum"> 14</span> : const struct {</span>
<span id="L15"><span class="lineNum"> 15</span> : std::string CFS = &quot;CFS&quot;;</span>
<span id="L16"><span class="lineNum"> 16</span> : std::string FCBF = &quot;FCBF&quot;;</span>
<span id="L17"><span class="lineNum"> 17</span> : std::string IWSS = &quot;IWSS&quot;;</span>
<span id="L18"><span class="lineNum"> 18</span> : }SelectFeatures;</span>
<span id="L19"><span class="lineNum"> 19</span> : const struct {</span>
<span id="L20"><span class="lineNum"> 20</span> : std::string ASC = &quot;asc&quot;;</span>
<span id="L21"><span class="lineNum"> 21</span> : std::string DESC = &quot;desc&quot;;</span>
<span id="L22"><span class="lineNum"> 22</span> : std::string RAND = &quot;rand&quot;;</span>
<span id="L23"><span class="lineNum"> 23</span> : }Orders;</span>
<span id="L24"><span class="lineNum"> 24</span> : class BoostAODE : public Ensemble {</span>
<span id="L25"><span class="lineNum"> 25</span> : public:</span>
<span id="L26"><span class="lineNum"> 26</span> : explicit BoostAODE(bool predict_voting = false);</span>
<span id="L27"><span class="lineNum"> 27</span> <span class="tlaGNC tlaBgGNC"> 44 : virtual ~BoostAODE() = default;</span></span>
<span id="L28"><span class="lineNum"> 28</span> : std::vector&lt;std::string&gt; graph(const std::string&amp; title = &quot;BoostAODE&quot;) const override;</span>
<span id="L29"><span class="lineNum"> 29</span> : void setHyperparameters(const nlohmann::json&amp; hyperparameters_) override;</span>
<span id="L30"><span class="lineNum"> 30</span> : protected:</span>
<span id="L31"><span class="lineNum"> 31</span> : void buildModel(const torch::Tensor&amp; weights) override;</span>
<span id="L32"><span class="lineNum"> 32</span> : void trainModel(const torch::Tensor&amp; weights) override;</span>
<span id="L33"><span class="lineNum"> 33</span> : private:</span>
<span id="L34"><span class="lineNum"> 34</span> : std::tuple&lt;torch::Tensor&amp;, double, bool&gt; update_weights_block(int k, torch::Tensor&amp; ytrain, torch::Tensor&amp; weights);</span>
<span id="L35"><span class="lineNum"> 35</span> : std::vector&lt;int&gt; initializeModels();</span>
<span id="L36"><span class="lineNum"> 36</span> : torch::Tensor X_train, y_train, X_test, y_test;</span>
<span id="L37"><span class="lineNum"> 37</span> : // Hyperparameters</span>
<span id="L38"><span class="lineNum"> 38</span> : bool bisection = true; // if true, use bisection stratety to add k models at once to the ensemble</span>
<span id="L39"><span class="lineNum"> 39</span> : int maxTolerance = 3;</span>
<span id="L40"><span class="lineNum"> 40</span> : std::string order_algorithm; // order to process the KBest features asc, desc, rand</span>
<span id="L41"><span class="lineNum"> 41</span> : bool convergence = true; //if true, stop when the model does not improve</span>
<span id="L42"><span class="lineNum"> 42</span> : bool convergence_best = false; // wether to keep the best accuracy to the moment or the last accuracy as prior accuracy</span>
<span id="L43"><span class="lineNum"> 43</span> : bool selectFeatures = false; // if true, use feature selection</span>
<span id="L44"><span class="lineNum"> 44</span> : std::string select_features_algorithm = Orders.DESC; // Selected feature selection algorithm</span>
<span id="L45"><span class="lineNum"> 45</span> : FeatureSelect* featureSelector = nullptr;</span>
<span id="L46"><span class="lineNum"> 46</span> : double threshold = -1;</span>
<span id="L47"><span class="lineNum"> 47</span> : bool block_update = false;</span>
<span id="L48"><span class="lineNum"> 48</span> : };</span>
<span id="L49"><span class="lineNum"> 49</span> : }</span>
<span id="L50"><span class="lineNum"> 50</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,250 +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 - coverage.info - BayesNet/bayesnet/ensembles/Ensemble.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">top level</a> - <a href="index.html">BayesNet/bayesnet/ensembles</a> - Ensemble.cc<span style="font-size: 80%;"> (<a href="Ensemble.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">coverage.info</td>
<td></td>
<td class="headerItem">Lines:</td>
<td class="headerCovTableEntryHi">98.1&nbsp;%</td>
<td class="headerCovTableEntry">154</td>
<td class="headerCovTableEntry">151</td>
</tr>
<tr>
<td class="headerItem">Test Date:</td>
<td class="headerValue">2024-04-30 13:17:26</td>
<td></td>
<td class="headerItem">Functions:</td>
<td class="headerCovTableEntryHi">100.0&nbsp;%</td>
<td class="headerCovTableEntry">25</td>
<td class="headerCovTableEntry">25</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="Ensemble.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="Ensemble.cc.gcov.html#L212">_ZNK8bayesnet8Ensemble17getNumberOfStatesEv</a></td>
<td class="coverFnHi">2</td>
</tr>
<tr>
<td class="coverFn"><a href="Ensemble.cc.gcov.html#L178">_ZNK8bayesnet8Ensemble4showB5cxx11Ev</a></td>
<td class="coverFnHi">2</td>
</tr>
<tr>
<td class="coverFn"><a href="Ensemble.cc.gcov.html#L187">_ZNK8bayesnet8Ensemble5graphERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE</a></td>
<td class="coverFnHi">6</td>
</tr>
<tr>
<td class="coverFn"><a href="Ensemble.cc.gcov.html#L14">_ZN8bayesnet8Ensemble10trainModelERKN2at6TensorE</a></td>
<td class="coverFnHi">12</td>
</tr>
<tr>
<td class="coverFn"><a href="Ensemble.cc.gcov.html#L204">_ZNK8bayesnet8Ensemble16getNumberOfEdgesEv</a></td>
<td class="coverFnHi">12</td>
</tr>
<tr>
<td class="coverFn"><a href="Ensemble.cc.gcov.html#L196">_ZNK8bayesnet8Ensemble16getNumberOfNodesEv</a></td>
<td class="coverFnHi">12</td>
</tr>
<tr>
<td class="coverFn"><a href="Ensemble.cc.gcov.html#L131">_ZN8bayesnet8Ensemble22predict_average_votingERSt6vectorIS1_IiSaIiEESaIS3_EE</a></td>
<td class="coverFnHi">14</td>
</tr>
<tr>
<td class="coverFn"><a href="Ensemble.cc.gcov.html#L102">_ZN8bayesnet8Ensemble21predict_average_probaERSt6vectorIS1_IiSaIiEESaIS3_EE</a></td>
<td class="coverFnHi">18</td>
</tr>
<tr>
<td class="coverFn"><a href="Ensemble.cc.gcov.html#L167">_ZN8bayesnet8Ensemble5scoreERSt6vectorIS1_IiSaIiEESaIS3_EERS3_</a></td>
<td class="coverFnHi">20</td>
</tr>
<tr>
<td class="coverFn"><a href="Ensemble.cc.gcov.html#L22">_ZN8bayesnet8Ensemble15compute_arg_maxERSt6vectorIS1_IdSaIdEESaIS3_EE</a></td>
<td class="coverFnHi">22</td>
</tr>
<tr>
<td class="coverFn"><a href="Ensemble.cc.gcov.html#L72">_ZN8bayesnet8Ensemble7predictERSt6vectorIS1_IiSaIiEESaIS3_EE</a></td>
<td class="coverFnHi">28</td>
</tr>
<tr>
<td class="coverFn"><a href="Ensemble.cc.gcov.html#L156">_ZN8bayesnet8Ensemble5scoreERN2at6TensorES3_</a></td>
<td class="coverFnHi">40</td>
</tr>
<tr>
<td class="coverFn"><a href="Ensemble.cc.gcov.html#L58">_ZN8bayesnet8Ensemble13predict_probaERSt6vectorIS1_IiSaIiEESaIS3_EE</a></td>
<td class="coverFnHi">44</td>
</tr>
<tr>
<td class="coverFn"><a href="Ensemble.cc.gcov.html#L138">_ZN8bayesnet8Ensemble22predict_average_votingERN2at6TensorE</a></td>
<td class="coverFnHi">80</td>
</tr>
<tr>
<td class="coverFn"><a href="Ensemble.cc.gcov.html#L36">_ZN8bayesnet8Ensemble6votingERN2at6TensorE</a></td>
<td class="coverFnHi">80</td>
</tr>
<tr>
<td class="coverFn"><a href="Ensemble.cc.gcov.html#L109">_ZZN8bayesnet8Ensemble21predict_average_probaERSt6vectorIS1_IiSaIiEESaIS3_EEENKUlvE_clEv</a></td>
<td class="coverFnHi">122</td>
</tr>
<tr>
<td class="coverFn"><a href="Ensemble.cc.gcov.html#L82">_ZN8bayesnet8Ensemble21predict_average_probaERN2at6TensorE</a></td>
<td class="coverFnHi">148</td>
</tr>
<tr>
<td class="coverFn"><a href="Ensemble.cc.gcov.html#L9">_ZN8bayesnet8EnsembleC2Eb</a></td>
<td class="coverFnHi">156</td>
</tr>
<tr>
<td class="coverFn"><a href="Ensemble.cc.gcov.html#L31">_ZN8bayesnet8Ensemble15compute_arg_maxERN2at6TensorE</a></td>
<td class="coverFnHi">212</td>
</tr>
<tr>
<td class="coverFn"><a href="Ensemble.cc.gcov.html#L77">_ZN8bayesnet8Ensemble7predictERN2at6TensorE</a></td>
<td class="coverFnHi">218</td>
</tr>
<tr>
<td class="coverFn"><a href="Ensemble.cc.gcov.html#L65">_ZN8bayesnet8Ensemble13predict_probaERN2at6TensorE</a></td>
<td class="coverFnHi">226</td>
</tr>
<tr>
<td class="coverFn"><a href="Ensemble.cc.gcov.html#L145">_ZZN8bayesnet8Ensemble22predict_average_votingERN2at6TensorEENKUlvE_clEv</a></td>
<td class="coverFnHi">536</td>
</tr>
<tr>
<td class="coverFn"><a href="Ensemble.cc.gcov.html#L89">_ZZN8bayesnet8Ensemble21predict_average_probaERN2at6TensorEENKUlvE_clEv</a></td>
<td class="coverFnHi">734</td>
</tr>
<tr>
<td class="coverFn"><a href="Ensemble.cc.gcov.html#L127">_ZZN8bayesnet8Ensemble21predict_average_probaERSt6vectorIS1_IiSaIiEESaIS3_EEENKUldE_clEd</a></td>
<td class="coverFnHi">16440</td>
</tr>
<tr>
<td class="coverFn"><a href="Ensemble.cc.gcov.html#L117">_ZZZN8bayesnet8Ensemble21predict_average_probaERSt6vectorIS1_IiSaIiEESaIS3_EEENKUlvE_clEvENKUlddE_clEdd</a></td>
<td class="coverFnHi">129960</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,250 +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 - coverage.info - BayesNet/bayesnet/ensembles/Ensemble.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">top level</a> - <a href="index.html">BayesNet/bayesnet/ensembles</a> - Ensemble.cc<span style="font-size: 80%;"> (<a href="Ensemble.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">coverage.info</td>
<td></td>
<td class="headerItem">Lines:</td>
<td class="headerCovTableEntryHi">98.1&nbsp;%</td>
<td class="headerCovTableEntry">154</td>
<td class="headerCovTableEntry">151</td>
</tr>
<tr>
<td class="headerItem">Test Date:</td>
<td class="headerValue">2024-04-30 13:17:26</td>
<td></td>
<td class="headerItem">Functions:</td>
<td class="headerCovTableEntryHi">100.0&nbsp;%</td>
<td class="headerCovTableEntry">25</td>
<td class="headerCovTableEntry">25</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="Ensemble.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="Ensemble.cc.gcov.html#L14">_ZN8bayesnet8Ensemble10trainModelERKN2at6TensorE</a></td>
<td class="coverFnHi">12</td>
</tr>
<tr>
<td class="coverFn"><a href="Ensemble.cc.gcov.html#L65">_ZN8bayesnet8Ensemble13predict_probaERN2at6TensorE</a></td>
<td class="coverFnHi">226</td>
</tr>
<tr>
<td class="coverFn"><a href="Ensemble.cc.gcov.html#L58">_ZN8bayesnet8Ensemble13predict_probaERSt6vectorIS1_IiSaIiEESaIS3_EE</a></td>
<td class="coverFnHi">44</td>
</tr>
<tr>
<td class="coverFn"><a href="Ensemble.cc.gcov.html#L31">_ZN8bayesnet8Ensemble15compute_arg_maxERN2at6TensorE</a></td>
<td class="coverFnHi">212</td>
</tr>
<tr>
<td class="coverFn"><a href="Ensemble.cc.gcov.html#L22">_ZN8bayesnet8Ensemble15compute_arg_maxERSt6vectorIS1_IdSaIdEESaIS3_EE</a></td>
<td class="coverFnHi">22</td>
</tr>
<tr>
<td class="coverFn"><a href="Ensemble.cc.gcov.html#L82">_ZN8bayesnet8Ensemble21predict_average_probaERN2at6TensorE</a></td>
<td class="coverFnHi">148</td>
</tr>
<tr>
<td class="coverFn"><a href="Ensemble.cc.gcov.html#L102">_ZN8bayesnet8Ensemble21predict_average_probaERSt6vectorIS1_IiSaIiEESaIS3_EE</a></td>
<td class="coverFnHi">18</td>
</tr>
<tr>
<td class="coverFn"><a href="Ensemble.cc.gcov.html#L138">_ZN8bayesnet8Ensemble22predict_average_votingERN2at6TensorE</a></td>
<td class="coverFnHi">80</td>
</tr>
<tr>
<td class="coverFn"><a href="Ensemble.cc.gcov.html#L131">_ZN8bayesnet8Ensemble22predict_average_votingERSt6vectorIS1_IiSaIiEESaIS3_EE</a></td>
<td class="coverFnHi">14</td>
</tr>
<tr>
<td class="coverFn"><a href="Ensemble.cc.gcov.html#L156">_ZN8bayesnet8Ensemble5scoreERN2at6TensorES3_</a></td>
<td class="coverFnHi">40</td>
</tr>
<tr>
<td class="coverFn"><a href="Ensemble.cc.gcov.html#L167">_ZN8bayesnet8Ensemble5scoreERSt6vectorIS1_IiSaIiEESaIS3_EERS3_</a></td>
<td class="coverFnHi">20</td>
</tr>
<tr>
<td class="coverFn"><a href="Ensemble.cc.gcov.html#L36">_ZN8bayesnet8Ensemble6votingERN2at6TensorE</a></td>
<td class="coverFnHi">80</td>
</tr>
<tr>
<td class="coverFn"><a href="Ensemble.cc.gcov.html#L77">_ZN8bayesnet8Ensemble7predictERN2at6TensorE</a></td>
<td class="coverFnHi">218</td>
</tr>
<tr>
<td class="coverFn"><a href="Ensemble.cc.gcov.html#L72">_ZN8bayesnet8Ensemble7predictERSt6vectorIS1_IiSaIiEESaIS3_EE</a></td>
<td class="coverFnHi">28</td>
</tr>
<tr>
<td class="coverFn"><a href="Ensemble.cc.gcov.html#L9">_ZN8bayesnet8EnsembleC2Eb</a></td>
<td class="coverFnHi">156</td>
</tr>
<tr>
<td class="coverFn"><a href="Ensemble.cc.gcov.html#L204">_ZNK8bayesnet8Ensemble16getNumberOfEdgesEv</a></td>
<td class="coverFnHi">12</td>
</tr>
<tr>
<td class="coverFn"><a href="Ensemble.cc.gcov.html#L196">_ZNK8bayesnet8Ensemble16getNumberOfNodesEv</a></td>
<td class="coverFnHi">12</td>
</tr>
<tr>
<td class="coverFn"><a href="Ensemble.cc.gcov.html#L212">_ZNK8bayesnet8Ensemble17getNumberOfStatesEv</a></td>
<td class="coverFnHi">2</td>
</tr>
<tr>
<td class="coverFn"><a href="Ensemble.cc.gcov.html#L178">_ZNK8bayesnet8Ensemble4showB5cxx11Ev</a></td>
<td class="coverFnHi">2</td>
</tr>
<tr>
<td class="coverFn"><a href="Ensemble.cc.gcov.html#L187">_ZNK8bayesnet8Ensemble5graphERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE</a></td>
<td class="coverFnHi">6</td>
</tr>
<tr>
<td class="coverFn"><a href="Ensemble.cc.gcov.html#L89">_ZZN8bayesnet8Ensemble21predict_average_probaERN2at6TensorEENKUlvE_clEv</a></td>
<td class="coverFnHi">734</td>
</tr>
<tr>
<td class="coverFn"><a href="Ensemble.cc.gcov.html#L127">_ZZN8bayesnet8Ensemble21predict_average_probaERSt6vectorIS1_IiSaIiEESaIS3_EEENKUldE_clEd</a></td>
<td class="coverFnHi">16440</td>
</tr>
<tr>
<td class="coverFn"><a href="Ensemble.cc.gcov.html#L109">_ZZN8bayesnet8Ensemble21predict_average_probaERSt6vectorIS1_IiSaIiEESaIS3_EEENKUlvE_clEv</a></td>
<td class="coverFnHi">122</td>
</tr>
<tr>
<td class="coverFn"><a href="Ensemble.cc.gcov.html#L145">_ZZN8bayesnet8Ensemble22predict_average_votingERN2at6TensorEENKUlvE_clEv</a></td>
<td class="coverFnHi">536</td>
</tr>
<tr>
<td class="coverFn"><a href="Ensemble.cc.gcov.html#L117">_ZZZN8bayesnet8Ensemble21predict_average_probaERSt6vectorIS1_IiSaIiEESaIS3_EEENKUlvE_clEvENKUlddE_clEdd</a></td>
<td class="coverFnHi">129960</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,298 +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 - coverage.info - BayesNet/bayesnet/ensembles/Ensemble.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">top level</a> - <a href="index.html">BayesNet/bayesnet/ensembles</a> - Ensemble.cc<span style="font-size: 80%;"> (source / <a href="Ensemble.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">coverage.info</td>
<td></td>
<td class="headerItem">Lines:</td>
<td class="headerCovTableEntryHi">98.1&nbsp;%</td>
<td class="headerCovTableEntry">154</td>
<td class="headerCovTableEntry">151</td>
</tr>
<tr>
<td class="headerItem">Test Date:</td>
<td class="headerValue">2024-04-30 13:17:26</td>
<td></td>
<td class="headerItem">Functions:</td>
<td class="headerCovTableEntryHi">100.0&nbsp;%</td>
<td class="headerCovTableEntry">25</td>
<td class="headerCovTableEntry">25</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;Ensemble.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"> 156 : Ensemble::Ensemble(bool predict_voting) : Classifier(Network()), n_models(0), predict_voting(predict_voting)</span></span>
<span id="L12"><span class="lineNum"> 12</span> : {</span>
<span id="L13"><span class="lineNum"> 13</span> : </span>
<span id="L14"><span class="lineNum"> 14</span> <span class="tlaGNC"> 156 : };</span></span>
<span id="L15"><span class="lineNum"> 15</span> : const std::string ENSEMBLE_NOT_FITTED = &quot;Ensemble has not been fitted&quot;;</span>
<span id="L16"><span class="lineNum"> 16</span> <span class="tlaGNC"> 12 : void Ensemble::trainModel(const torch::Tensor&amp; weights)</span></span>
<span id="L17"><span class="lineNum"> 17</span> : {</span>
<span id="L18"><span class="lineNum"> 18</span> <span class="tlaGNC"> 12 : n_models = models.size();</span></span>
<span id="L19"><span class="lineNum"> 19</span> <span class="tlaGNC"> 94 : for (auto i = 0; i &lt; n_models; ++i) {</span></span>
<span id="L20"><span class="lineNum"> 20</span> : // fit with std::vectors</span>
<span id="L21"><span class="lineNum"> 21</span> <span class="tlaGNC"> 82 : models[i]-&gt;fit(dataset, features, className, states);</span></span>
<span id="L22"><span class="lineNum"> 22</span> : }</span>
<span id="L23"><span class="lineNum"> 23</span> <span class="tlaGNC"> 12 : }</span></span>
<span id="L24"><span class="lineNum"> 24</span> <span class="tlaGNC"> 22 : std::vector&lt;int&gt; Ensemble::compute_arg_max(std::vector&lt;std::vector&lt;double&gt;&gt;&amp; X)</span></span>
<span id="L25"><span class="lineNum"> 25</span> : {</span>
<span id="L26"><span class="lineNum"> 26</span> <span class="tlaGNC"> 22 : std::vector&lt;int&gt; y_pred;</span></span>
<span id="L27"><span class="lineNum"> 27</span> <span class="tlaGNC"> 4910 : for (auto i = 0; i &lt; X.size(); ++i) {</span></span>
<span id="L28"><span class="lineNum"> 28</span> <span class="tlaGNC"> 4888 : auto max = std::max_element(X[i].begin(), X[i].end());</span></span>
<span id="L29"><span class="lineNum"> 29</span> <span class="tlaGNC"> 9776 : y_pred.push_back(std::distance(X[i].begin(), max));</span></span>
<span id="L30"><span class="lineNum"> 30</span> : }</span>
<span id="L31"><span class="lineNum"> 31</span> <span class="tlaGNC"> 22 : return y_pred;</span></span>
<span id="L32"><span class="lineNum"> 32</span> <span class="tlaUNC tlaBgUNC"> 0 : }</span></span>
<span id="L33"><span class="lineNum"> 33</span> <span class="tlaGNC tlaBgGNC"> 212 : torch::Tensor Ensemble::compute_arg_max(torch::Tensor&amp; X)</span></span>
<span id="L34"><span class="lineNum"> 34</span> : {</span>
<span id="L35"><span class="lineNum"> 35</span> <span class="tlaGNC"> 212 : auto y_pred = torch::argmax(X, 1);</span></span>
<span id="L36"><span class="lineNum"> 36</span> <span class="tlaGNC"> 212 : return y_pred;</span></span>
<span id="L37"><span class="lineNum"> 37</span> : }</span>
<span id="L38"><span class="lineNum"> 38</span> <span class="tlaGNC"> 80 : torch::Tensor Ensemble::voting(torch::Tensor&amp; votes)</span></span>
<span id="L39"><span class="lineNum"> 39</span> : {</span>
<span id="L40"><span class="lineNum"> 40</span> : // Convert m x n_models tensor to a m x n_class_states with voting probabilities</span>
<span id="L41"><span class="lineNum"> 41</span> <span class="tlaGNC"> 80 : auto y_pred_ = votes.accessor&lt;int, 2&gt;();</span></span>
<span id="L42"><span class="lineNum"> 42</span> <span class="tlaGNC"> 80 : std::vector&lt;int&gt; y_pred_final;</span></span>
<span id="L43"><span class="lineNum"> 43</span> <span class="tlaGNC"> 80 : int numClasses = states.at(className).size();</span></span>
<span id="L44"><span class="lineNum"> 44</span> : // votes is m x n_models with the prediction of every model for each sample</span>
<span id="L45"><span class="lineNum"> 45</span> <span class="tlaGNC"> 80 : auto result = torch::zeros({ votes.size(0), numClasses }, torch::kFloat32);</span></span>
<span id="L46"><span class="lineNum"> 46</span> <span class="tlaGNC"> 80 : auto sum = std::reduce(significanceModels.begin(), significanceModels.end());</span></span>
<span id="L47"><span class="lineNum"> 47</span> <span class="tlaGNC"> 20612 : for (int i = 0; i &lt; votes.size(0); ++i) {</span></span>
<span id="L48"><span class="lineNum"> 48</span> : // n_votes store in each index (value of class) the significance added by each model</span>
<span id="L49"><span class="lineNum"> 49</span> : // i.e. n_votes[0] contains how much value has the value 0 of class. That value is generated by the models predictions</span>
<span id="L50"><span class="lineNum"> 50</span> <span class="tlaGNC"> 20532 : std::vector&lt;double&gt; n_votes(numClasses, 0.0);</span></span>
<span id="L51"><span class="lineNum"> 51</span> <span class="tlaGNC"> 171800 : for (int j = 0; j &lt; n_models; ++j) {</span></span>
<span id="L52"><span class="lineNum"> 52</span> <span class="tlaGNC"> 151268 : n_votes[y_pred_[i][j]] += significanceModels.at(j);</span></span>
<span id="L53"><span class="lineNum"> 53</span> : }</span>
<span id="L54"><span class="lineNum"> 54</span> <span class="tlaGNC"> 20532 : result[i] = torch::tensor(n_votes);</span></span>
<span id="L55"><span class="lineNum"> 55</span> <span class="tlaGNC"> 20532 : }</span></span>
<span id="L56"><span class="lineNum"> 56</span> : // To only do one division and gain precision</span>
<span id="L57"><span class="lineNum"> 57</span> <span class="tlaGNC"> 80 : result /= sum;</span></span>
<span id="L58"><span class="lineNum"> 58</span> <span class="tlaGNC"> 160 : return result;</span></span>
<span id="L59"><span class="lineNum"> 59</span> <span class="tlaGNC"> 80 : }</span></span>
<span id="L60"><span class="lineNum"> 60</span> <span class="tlaGNC"> 44 : std::vector&lt;std::vector&lt;double&gt;&gt; Ensemble::predict_proba(std::vector&lt;std::vector&lt;int&gt;&gt;&amp; X)</span></span>
<span id="L61"><span class="lineNum"> 61</span> : {</span>
<span id="L62"><span class="lineNum"> 62</span> <span class="tlaGNC"> 44 : if (!fitted) {</span></span>
<span id="L63"><span class="lineNum"> 63</span> <span class="tlaGNC"> 12 : throw std::logic_error(ENSEMBLE_NOT_FITTED);</span></span>
<span id="L64"><span class="lineNum"> 64</span> : }</span>
<span id="L65"><span class="lineNum"> 65</span> <span class="tlaGNC"> 32 : return predict_voting ? predict_average_voting(X) : predict_average_proba(X);</span></span>
<span id="L66"><span class="lineNum"> 66</span> : }</span>
<span id="L67"><span class="lineNum"> 67</span> <span class="tlaGNC"> 226 : torch::Tensor Ensemble::predict_proba(torch::Tensor&amp; X)</span></span>
<span id="L68"><span class="lineNum"> 68</span> : {</span>
<span id="L69"><span class="lineNum"> 69</span> <span class="tlaGNC"> 226 : if (!fitted) {</span></span>
<span id="L70"><span class="lineNum"> 70</span> <span class="tlaGNC"> 12 : throw std::logic_error(ENSEMBLE_NOT_FITTED);</span></span>
<span id="L71"><span class="lineNum"> 71</span> : }</span>
<span id="L72"><span class="lineNum"> 72</span> <span class="tlaGNC"> 214 : return predict_voting ? predict_average_voting(X) : predict_average_proba(X);</span></span>
<span id="L73"><span class="lineNum"> 73</span> : }</span>
<span id="L74"><span class="lineNum"> 74</span> <span class="tlaGNC"> 28 : std::vector&lt;int&gt; Ensemble::predict(std::vector&lt;std::vector&lt;int&gt;&gt;&amp; X)</span></span>
<span id="L75"><span class="lineNum"> 75</span> : {</span>
<span id="L76"><span class="lineNum"> 76</span> <span class="tlaGNC"> 28 : auto res = predict_proba(X);</span></span>
<span id="L77"><span class="lineNum"> 77</span> <span class="tlaGNC"> 40 : return compute_arg_max(res);</span></span>
<span id="L78"><span class="lineNum"> 78</span> <span class="tlaGNC"> 20 : }</span></span>
<span id="L79"><span class="lineNum"> 79</span> <span class="tlaGNC"> 218 : torch::Tensor Ensemble::predict(torch::Tensor&amp; X)</span></span>
<span id="L80"><span class="lineNum"> 80</span> : {</span>
<span id="L81"><span class="lineNum"> 81</span> <span class="tlaGNC"> 218 : auto res = predict_proba(X);</span></span>
<span id="L82"><span class="lineNum"> 82</span> <span class="tlaGNC"> 420 : return compute_arg_max(res);</span></span>
<span id="L83"><span class="lineNum"> 83</span> <span class="tlaGNC"> 210 : }</span></span>
<span id="L84"><span class="lineNum"> 84</span> <span class="tlaGNC"> 148 : torch::Tensor Ensemble::predict_average_proba(torch::Tensor&amp; X)</span></span>
<span id="L85"><span class="lineNum"> 85</span> : {</span>
<span id="L86"><span class="lineNum"> 86</span> <span class="tlaGNC"> 148 : auto n_states = models[0]-&gt;getClassNumStates();</span></span>
<span id="L87"><span class="lineNum"> 87</span> <span class="tlaGNC"> 148 : torch::Tensor y_pred = torch::zeros({ X.size(1), n_states }, torch::kFloat32);</span></span>
<span id="L88"><span class="lineNum"> 88</span> <span class="tlaGNC"> 148 : auto threads{ std::vector&lt;std::thread&gt;() };</span></span>
<span id="L89"><span class="lineNum"> 89</span> <span class="tlaGNC"> 148 : std::mutex mtx;</span></span>
<span id="L90"><span class="lineNum"> 90</span> <span class="tlaGNC"> 882 : for (auto i = 0; i &lt; n_models; ++i) {</span></span>
<span id="L91"><span class="lineNum"> 91</span> <span class="tlaGNC"> 734 : threads.push_back(std::thread([&amp;, i]() {</span></span>
<span id="L92"><span class="lineNum"> 92</span> <span class="tlaGNC"> 734 : auto ypredict = models[i]-&gt;predict_proba(X);</span></span>
<span id="L93"><span class="lineNum"> 93</span> <span class="tlaGNC"> 734 : std::lock_guard&lt;std::mutex&gt; lock(mtx);</span></span>
<span id="L94"><span class="lineNum"> 94</span> <span class="tlaGNC"> 734 : y_pred += ypredict * significanceModels[i];</span></span>
<span id="L95"><span class="lineNum"> 95</span> <span class="tlaGNC"> 734 : }));</span></span>
<span id="L96"><span class="lineNum"> 96</span> : }</span>
<span id="L97"><span class="lineNum"> 97</span> <span class="tlaGNC"> 882 : for (auto&amp; thread : threads) {</span></span>
<span id="L98"><span class="lineNum"> 98</span> <span class="tlaGNC"> 734 : thread.join();</span></span>
<span id="L99"><span class="lineNum"> 99</span> : }</span>
<span id="L100"><span class="lineNum"> 100</span> <span class="tlaGNC"> 148 : auto sum = std::reduce(significanceModels.begin(), significanceModels.end());</span></span>
<span id="L101"><span class="lineNum"> 101</span> <span class="tlaGNC"> 148 : y_pred /= sum;</span></span>
<span id="L102"><span class="lineNum"> 102</span> <span class="tlaGNC"> 296 : return y_pred;</span></span>
<span id="L103"><span class="lineNum"> 103</span> <span class="tlaGNC"> 148 : }</span></span>
<span id="L104"><span class="lineNum"> 104</span> <span class="tlaGNC"> 18 : std::vector&lt;std::vector&lt;double&gt;&gt; Ensemble::predict_average_proba(std::vector&lt;std::vector&lt;int&gt;&gt;&amp; X)</span></span>
<span id="L105"><span class="lineNum"> 105</span> : {</span>
<span id="L106"><span class="lineNum"> 106</span> <span class="tlaGNC"> 18 : auto n_states = models[0]-&gt;getClassNumStates();</span></span>
<span id="L107"><span class="lineNum"> 107</span> <span class="tlaGNC"> 18 : std::vector&lt;std::vector&lt;double&gt;&gt; y_pred(X[0].size(), std::vector&lt;double&gt;(n_states, 0.0));</span></span>
<span id="L108"><span class="lineNum"> 108</span> <span class="tlaGNC"> 18 : auto threads{ std::vector&lt;std::thread&gt;() };</span></span>
<span id="L109"><span class="lineNum"> 109</span> <span class="tlaGNC"> 18 : std::mutex mtx;</span></span>
<span id="L110"><span class="lineNum"> 110</span> <span class="tlaGNC"> 140 : for (auto i = 0; i &lt; n_models; ++i) {</span></span>
<span id="L111"><span class="lineNum"> 111</span> <span class="tlaGNC"> 122 : threads.push_back(std::thread([&amp;, i]() {</span></span>
<span id="L112"><span class="lineNum"> 112</span> <span class="tlaGNC"> 122 : auto ypredict = models[i]-&gt;predict_proba(X);</span></span>
<span id="L113"><span class="lineNum"> 113</span> <span class="tlaGNC"> 122 : assert(ypredict.size() == y_pred.size());</span></span>
<span id="L114"><span class="lineNum"> 114</span> <span class="tlaGNC"> 122 : assert(ypredict[0].size() == y_pred[0].size());</span></span>
<span id="L115"><span class="lineNum"> 115</span> <span class="tlaGNC"> 122 : std::lock_guard&lt;std::mutex&gt; lock(mtx);</span></span>
<span id="L116"><span class="lineNum"> 116</span> : // Multiply each prediction by the significance of the model and then add it to the final prediction</span>
<span id="L117"><span class="lineNum"> 117</span> <span class="tlaGNC"> 24182 : for (auto j = 0; j &lt; ypredict.size(); ++j) {</span></span>
<span id="L118"><span class="lineNum"> 118</span> <span class="tlaGNC"> 24060 : std::transform(y_pred[j].begin(), y_pred[j].end(), ypredict[j].begin(), y_pred[j].begin(),</span></span>
<span id="L119"><span class="lineNum"> 119</span> <span class="tlaGNC"> 154020 : [significanceModels = significanceModels[i]](double x, double y) { return x + y * significanceModels; });</span></span>
<span id="L120"><span class="lineNum"> 120</span> : }</span>
<span id="L121"><span class="lineNum"> 121</span> <span class="tlaGNC"> 122 : }));</span></span>
<span id="L122"><span class="lineNum"> 122</span> : }</span>
<span id="L123"><span class="lineNum"> 123</span> <span class="tlaGNC"> 140 : for (auto&amp; thread : threads) {</span></span>
<span id="L124"><span class="lineNum"> 124</span> <span class="tlaGNC"> 122 : thread.join();</span></span>
<span id="L125"><span class="lineNum"> 125</span> : }</span>
<span id="L126"><span class="lineNum"> 126</span> <span class="tlaGNC"> 18 : auto sum = std::reduce(significanceModels.begin(), significanceModels.end());</span></span>
<span id="L127"><span class="lineNum"> 127</span> : //Divide each element of the prediction by the sum of the significances</span>
<span id="L128"><span class="lineNum"> 128</span> <span class="tlaGNC"> 3358 : for (auto j = 0; j &lt; y_pred.size(); ++j) {</span></span>
<span id="L129"><span class="lineNum"> 129</span> <span class="tlaGNC"> 19780 : std::transform(y_pred[j].begin(), y_pred[j].end(), y_pred[j].begin(), [sum](double x) { return x / sum; });</span></span>
<span id="L130"><span class="lineNum"> 130</span> : }</span>
<span id="L131"><span class="lineNum"> 131</span> <span class="tlaGNC"> 36 : return y_pred;</span></span>
<span id="L132"><span class="lineNum"> 132</span> <span class="tlaGNC"> 18 : }</span></span>
<span id="L133"><span class="lineNum"> 133</span> <span class="tlaGNC"> 14 : std::vector&lt;std::vector&lt;double&gt;&gt; Ensemble::predict_average_voting(std::vector&lt;std::vector&lt;int&gt;&gt;&amp; X)</span></span>
<span id="L134"><span class="lineNum"> 134</span> : {</span>
<span id="L135"><span class="lineNum"> 135</span> <span class="tlaGNC"> 14 : torch::Tensor Xt = bayesnet::vectorToTensor(X, false);</span></span>
<span id="L136"><span class="lineNum"> 136</span> <span class="tlaGNC"> 14 : auto y_pred = predict_average_voting(Xt);</span></span>
<span id="L137"><span class="lineNum"> 137</span> <span class="tlaGNC"> 14 : std::vector&lt;std::vector&lt;double&gt;&gt; result = tensorToVectorDouble(y_pred);</span></span>
<span id="L138"><span class="lineNum"> 138</span> <span class="tlaGNC"> 28 : return result;</span></span>
<span id="L139"><span class="lineNum"> 139</span> <span class="tlaGNC"> 14 : }</span></span>
<span id="L140"><span class="lineNum"> 140</span> <span class="tlaGNC"> 80 : torch::Tensor Ensemble::predict_average_voting(torch::Tensor&amp; X)</span></span>
<span id="L141"><span class="lineNum"> 141</span> : {</span>
<span id="L142"><span class="lineNum"> 142</span> : // Build a m x n_models tensor with the predictions of each model</span>
<span id="L143"><span class="lineNum"> 143</span> <span class="tlaGNC"> 80 : torch::Tensor y_pred = torch::zeros({ X.size(1), n_models }, torch::kInt32);</span></span>
<span id="L144"><span class="lineNum"> 144</span> <span class="tlaGNC"> 80 : auto threads{ std::vector&lt;std::thread&gt;() };</span></span>
<span id="L145"><span class="lineNum"> 145</span> <span class="tlaGNC"> 80 : std::mutex mtx;</span></span>
<span id="L146"><span class="lineNum"> 146</span> <span class="tlaGNC"> 616 : for (auto i = 0; i &lt; n_models; ++i) {</span></span>
<span id="L147"><span class="lineNum"> 147</span> <span class="tlaGNC"> 536 : threads.push_back(std::thread([&amp;, i]() {</span></span>
<span id="L148"><span class="lineNum"> 148</span> <span class="tlaGNC"> 536 : auto ypredict = models[i]-&gt;predict(X);</span></span>
<span id="L149"><span class="lineNum"> 149</span> <span class="tlaGNC"> 536 : std::lock_guard&lt;std::mutex&gt; lock(mtx);</span></span>
<span id="L150"><span class="lineNum"> 150</span> <span class="tlaGNC"> 1608 : y_pred.index_put_({ &quot;...&quot;, i }, ypredict);</span></span>
<span id="L151"><span class="lineNum"> 151</span> <span class="tlaGNC"> 1072 : }));</span></span>
<span id="L152"><span class="lineNum"> 152</span> : }</span>
<span id="L153"><span class="lineNum"> 153</span> <span class="tlaGNC"> 616 : for (auto&amp; thread : threads) {</span></span>
<span id="L154"><span class="lineNum"> 154</span> <span class="tlaGNC"> 536 : thread.join();</span></span>
<span id="L155"><span class="lineNum"> 155</span> : }</span>
<span id="L156"><span class="lineNum"> 156</span> <span class="tlaGNC"> 160 : return voting(y_pred);</span></span>
<span id="L157"><span class="lineNum"> 157</span> <span class="tlaGNC"> 80 : }</span></span>
<span id="L158"><span class="lineNum"> 158</span> <span class="tlaGNC"> 40 : float Ensemble::score(torch::Tensor&amp; X, torch::Tensor&amp; y)</span></span>
<span id="L159"><span class="lineNum"> 159</span> : {</span>
<span id="L160"><span class="lineNum"> 160</span> <span class="tlaGNC"> 40 : auto y_pred = predict(X);</span></span>
<span id="L161"><span class="lineNum"> 161</span> <span class="tlaGNC"> 36 : int correct = 0;</span></span>
<span id="L162"><span class="lineNum"> 162</span> <span class="tlaGNC"> 11292 : for (int i = 0; i &lt; y_pred.size(0); ++i) {</span></span>
<span id="L163"><span class="lineNum"> 163</span> <span class="tlaGNC"> 11256 : if (y_pred[i].item&lt;int&gt;() == y[i].item&lt;int&gt;()) {</span></span>
<span id="L164"><span class="lineNum"> 164</span> <span class="tlaGNC"> 9834 : correct++;</span></span>
<span id="L165"><span class="lineNum"> 165</span> : }</span>
<span id="L166"><span class="lineNum"> 166</span> : }</span>
<span id="L167"><span class="lineNum"> 167</span> <span class="tlaGNC"> 72 : return (double)correct / y_pred.size(0);</span></span>
<span id="L168"><span class="lineNum"> 168</span> <span class="tlaGNC"> 36 : }</span></span>
<span id="L169"><span class="lineNum"> 169</span> <span class="tlaGNC"> 20 : float Ensemble::score(std::vector&lt;std::vector&lt;int&gt;&gt;&amp; X, std::vector&lt;int&gt;&amp; y)</span></span>
<span id="L170"><span class="lineNum"> 170</span> : {</span>
<span id="L171"><span class="lineNum"> 171</span> <span class="tlaGNC"> 20 : auto y_pred = predict(X);</span></span>
<span id="L172"><span class="lineNum"> 172</span> <span class="tlaGNC"> 16 : int correct = 0;</span></span>
<span id="L173"><span class="lineNum"> 173</span> <span class="tlaGNC"> 4292 : for (int i = 0; i &lt; y_pred.size(); ++i) {</span></span>
<span id="L174"><span class="lineNum"> 174</span> <span class="tlaGNC"> 4276 : if (y_pred[i] == y[i]) {</span></span>
<span id="L175"><span class="lineNum"> 175</span> <span class="tlaGNC"> 3574 : correct++;</span></span>
<span id="L176"><span class="lineNum"> 176</span> : }</span>
<span id="L177"><span class="lineNum"> 177</span> : }</span>
<span id="L178"><span class="lineNum"> 178</span> <span class="tlaGNC"> 32 : return (double)correct / y_pred.size();</span></span>
<span id="L179"><span class="lineNum"> 179</span> <span class="tlaGNC"> 16 : }</span></span>
<span id="L180"><span class="lineNum"> 180</span> <span class="tlaGNC"> 2 : std::vector&lt;std::string&gt; Ensemble::show() const</span></span>
<span id="L181"><span class="lineNum"> 181</span> : {</span>
<span id="L182"><span class="lineNum"> 182</span> <span class="tlaGNC"> 2 : auto result = std::vector&lt;std::string&gt;();</span></span>
<span id="L183"><span class="lineNum"> 183</span> <span class="tlaGNC"> 10 : for (auto i = 0; i &lt; n_models; ++i) {</span></span>
<span id="L184"><span class="lineNum"> 184</span> <span class="tlaGNC"> 8 : auto res = models[i]-&gt;show();</span></span>
<span id="L185"><span class="lineNum"> 185</span> <span class="tlaGNC"> 8 : result.insert(result.end(), res.begin(), res.end());</span></span>
<span id="L186"><span class="lineNum"> 186</span> <span class="tlaGNC"> 8 : }</span></span>
<span id="L187"><span class="lineNum"> 187</span> <span class="tlaGNC"> 2 : return result;</span></span>
<span id="L188"><span class="lineNum"> 188</span> <span class="tlaUNC tlaBgUNC"> 0 : }</span></span>
<span id="L189"><span class="lineNum"> 189</span> <span class="tlaGNC tlaBgGNC"> 6 : std::vector&lt;std::string&gt; Ensemble::graph(const std::string&amp; title) const</span></span>
<span id="L190"><span class="lineNum"> 190</span> : {</span>
<span id="L191"><span class="lineNum"> 191</span> <span class="tlaGNC"> 6 : auto result = std::vector&lt;std::string&gt;();</span></span>
<span id="L192"><span class="lineNum"> 192</span> <span class="tlaGNC"> 40 : for (auto i = 0; i &lt; n_models; ++i) {</span></span>
<span id="L193"><span class="lineNum"> 193</span> <span class="tlaGNC"> 34 : auto res = models[i]-&gt;graph(title + &quot;_&quot; + std::to_string(i));</span></span>
<span id="L194"><span class="lineNum"> 194</span> <span class="tlaGNC"> 34 : result.insert(result.end(), res.begin(), res.end());</span></span>
<span id="L195"><span class="lineNum"> 195</span> <span class="tlaGNC"> 34 : }</span></span>
<span id="L196"><span class="lineNum"> 196</span> <span class="tlaGNC"> 6 : return result;</span></span>
<span id="L197"><span class="lineNum"> 197</span> <span class="tlaUNC tlaBgUNC"> 0 : }</span></span>
<span id="L198"><span class="lineNum"> 198</span> <span class="tlaGNC tlaBgGNC"> 12 : int Ensemble::getNumberOfNodes() const</span></span>
<span id="L199"><span class="lineNum"> 199</span> : {</span>
<span id="L200"><span class="lineNum"> 200</span> <span class="tlaGNC"> 12 : int nodes = 0;</span></span>
<span id="L201"><span class="lineNum"> 201</span> <span class="tlaGNC"> 100 : for (auto i = 0; i &lt; n_models; ++i) {</span></span>
<span id="L202"><span class="lineNum"> 202</span> <span class="tlaGNC"> 88 : nodes += models[i]-&gt;getNumberOfNodes();</span></span>
<span id="L203"><span class="lineNum"> 203</span> : }</span>
<span id="L204"><span class="lineNum"> 204</span> <span class="tlaGNC"> 12 : return nodes;</span></span>
<span id="L205"><span class="lineNum"> 205</span> : }</span>
<span id="L206"><span class="lineNum"> 206</span> <span class="tlaGNC"> 12 : int Ensemble::getNumberOfEdges() const</span></span>
<span id="L207"><span class="lineNum"> 207</span> : {</span>
<span id="L208"><span class="lineNum"> 208</span> <span class="tlaGNC"> 12 : int edges = 0;</span></span>
<span id="L209"><span class="lineNum"> 209</span> <span class="tlaGNC"> 100 : for (auto i = 0; i &lt; n_models; ++i) {</span></span>
<span id="L210"><span class="lineNum"> 210</span> <span class="tlaGNC"> 88 : edges += models[i]-&gt;getNumberOfEdges();</span></span>
<span id="L211"><span class="lineNum"> 211</span> : }</span>
<span id="L212"><span class="lineNum"> 212</span> <span class="tlaGNC"> 12 : return edges;</span></span>
<span id="L213"><span class="lineNum"> 213</span> : }</span>
<span id="L214"><span class="lineNum"> 214</span> <span class="tlaGNC"> 2 : int Ensemble::getNumberOfStates() const</span></span>
<span id="L215"><span class="lineNum"> 215</span> : {</span>
<span id="L216"><span class="lineNum"> 216</span> <span class="tlaGNC"> 2 : int nstates = 0;</span></span>
<span id="L217"><span class="lineNum"> 217</span> <span class="tlaGNC"> 10 : for (auto i = 0; i &lt; n_models; ++i) {</span></span>
<span id="L218"><span class="lineNum"> 218</span> <span class="tlaGNC"> 8 : nstates += models[i]-&gt;getNumberOfStates();</span></span>
<span id="L219"><span class="lineNum"> 219</span> : }</span>
<span id="L220"><span class="lineNum"> 220</span> <span class="tlaGNC"> 2 : return nstates;</span></span>
<span id="L221"><span class="lineNum"> 221</span> : }</span>
<span id="L222"><span class="lineNum"> 222</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,110 +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 - coverage.info - BayesNet/bayesnet/ensembles/Ensemble.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">top level</a> - <a href="index.html">BayesNet/bayesnet/ensembles</a> - Ensemble.h<span style="font-size: 80%;"> (<a href="Ensemble.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">coverage.info</td>
<td></td>
<td class="headerItem">Lines:</td>
<td class="headerCovTableEntryHi">100.0&nbsp;%</td>
<td class="headerCovTableEntry">5</td>
<td class="headerCovTableEntry">5</td>
</tr>
<tr>
<td class="headerItem">Test Date:</td>
<td class="headerValue">2024-04-30 13:17:26</td>
<td></td>
<td class="headerItem">Functions:</td>
<td class="headerCovTableEntryMed">75.0&nbsp;%</td>
<td class="headerCovTableEntry">4</td>
<td class="headerCovTableEntry">3</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="Ensemble.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="Ensemble.h.gcov.html#L32">_ZNK8bayesnet8Ensemble8dump_cptB5cxx11Ev</a></td>
<td class="coverFnHi">4</td>
</tr>
<tr>
<td class="coverFn"><a href="Ensemble.h.gcov.html#L28">_ZN8bayesnet8Ensemble17topological_orderB5cxx11Ev</a></td>
<td class="coverFnHi">6</td>
</tr>
<tr>
<td class="coverFn"><a href="Ensemble.h.gcov.html#L16">_ZN8bayesnet8EnsembleD0Ev</a></td>
<td class="coverFnHi">56</td>
</tr>
<tr>
<td class="coverFnAlias"><a href="Ensemble.h.gcov.html#L16">_ZN8bayesnet8EnsembleD0Ev</a></td>
<td class="coverFnAliasLo">0</td>
</tr>
<tr>
<td class="coverFnAlias"><a href="Ensemble.h.gcov.html#L16">_ZN8bayesnet8EnsembleD2Ev</a></td>
<td class="coverFnAliasHi">56</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,110 +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 - coverage.info - BayesNet/bayesnet/ensembles/Ensemble.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">top level</a> - <a href="index.html">BayesNet/bayesnet/ensembles</a> - Ensemble.h<span style="font-size: 80%;"> (<a href="Ensemble.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">coverage.info</td>
<td></td>
<td class="headerItem">Lines:</td>
<td class="headerCovTableEntryHi">100.0&nbsp;%</td>
<td class="headerCovTableEntry">5</td>
<td class="headerCovTableEntry">5</td>
</tr>
<tr>
<td class="headerItem">Test Date:</td>
<td class="headerValue">2024-04-30 13:17:26</td>
<td></td>
<td class="headerItem">Functions:</td>
<td class="headerCovTableEntryMed">75.0&nbsp;%</td>
<td class="headerCovTableEntry">4</td>
<td class="headerCovTableEntry">3</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="Ensemble.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="Ensemble.h.gcov.html#L28">_ZN8bayesnet8Ensemble17topological_orderB5cxx11Ev</a></td>
<td class="coverFnHi">6</td>
</tr>
<tr>
<td class="coverFn"><a href="Ensemble.h.gcov.html#L16">_ZN8bayesnet8EnsembleD0Ev</a></td>
<td class="coverFnHi">56</td>
</tr>
<tr>
<td class="coverFnAlias"><a href="Ensemble.h.gcov.html#L16">_ZN8bayesnet8EnsembleD0Ev</a></td>
<td class="coverFnAliasLo">0</td>
</tr>
<tr>
<td class="coverFnAlias"><a href="Ensemble.h.gcov.html#L16">_ZN8bayesnet8EnsembleD2Ev</a></td>
<td class="coverFnAliasHi">56</td>
</tr>
<tr>
<td class="coverFn"><a href="Ensemble.h.gcov.html#L32">_ZNK8bayesnet8Ensemble8dump_cptB5cxx11Ev</a></td>
<td class="coverFnHi">4</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,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 - coverage.info - BayesNet/bayesnet/ensembles/Ensemble.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">top level</a> - <a href="index.html">BayesNet/bayesnet/ensembles</a> - Ensemble.h<span style="font-size: 80%;"> (source / <a href="Ensemble.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">coverage.info</td>
<td></td>
<td class="headerItem">Lines:</td>
<td class="headerCovTableEntryHi">100.0&nbsp;%</td>
<td class="headerCovTableEntry">5</td>
<td class="headerCovTableEntry">5</td>
</tr>
<tr>
<td class="headerItem">Test Date:</td>
<td class="headerValue">2024-04-30 13:17:26</td>
<td></td>
<td class="headerItem">Functions:</td>
<td class="headerCovTableEntryMed">75.0&nbsp;%</td>
<td class="headerCovTableEntry">4</td>
<td class="headerCovTableEntry">3</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 ENSEMBLE_H</span>
<span id="L8"><span class="lineNum"> 8</span> : #define ENSEMBLE_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/utils/bayesnetUtils.h&quot;</span>
<span id="L12"><span class="lineNum"> 12</span> : #include &quot;bayesnet/classifiers/Classifier.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 Ensemble : public Classifier {</span>
<span id="L16"><span class="lineNum"> 16</span> : public:</span>
<span id="L17"><span class="lineNum"> 17</span> : Ensemble(bool predict_voting = true);</span>
<span id="L18"><span class="lineNum"> 18</span> <span class="tlaGNC tlaBgGNC"> 56 : virtual ~Ensemble() = default;</span></span>
<span id="L19"><span class="lineNum"> 19</span> : torch::Tensor predict(torch::Tensor&amp; X) override;</span>
<span id="L20"><span class="lineNum"> 20</span> : std::vector&lt;int&gt; predict(std::vector&lt;std::vector&lt;int&gt;&gt;&amp; X) override;</span>
<span id="L21"><span class="lineNum"> 21</span> : torch::Tensor predict_proba(torch::Tensor&amp; X) override;</span>
<span id="L22"><span class="lineNum"> 22</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="L23"><span class="lineNum"> 23</span> : float score(torch::Tensor&amp; X, torch::Tensor&amp; y) override;</span>
<span id="L24"><span class="lineNum"> 24</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="L25"><span class="lineNum"> 25</span> : int getNumberOfNodes() const override;</span>
<span id="L26"><span class="lineNum"> 26</span> : int getNumberOfEdges() const override;</span>
<span id="L27"><span class="lineNum"> 27</span> : int getNumberOfStates() const override;</span>
<span id="L28"><span class="lineNum"> 28</span> : std::vector&lt;std::string&gt; show() const override;</span>
<span id="L29"><span class="lineNum"> 29</span> : std::vector&lt;std::string&gt; graph(const std::string&amp; title) const override;</span>
<span id="L30"><span class="lineNum"> 30</span> <span class="tlaGNC"> 6 : std::vector&lt;std::string&gt; topological_order() override</span></span>
<span id="L31"><span class="lineNum"> 31</span> : {</span>
<span id="L32"><span class="lineNum"> 32</span> <span class="tlaGNC"> 6 : return std::vector&lt;std::string&gt;();</span></span>
<span id="L33"><span class="lineNum"> 33</span> : }</span>
<span id="L34"><span class="lineNum"> 34</span> <span class="tlaGNC"> 4 : std::string dump_cpt() const override</span></span>
<span id="L35"><span class="lineNum"> 35</span> : {</span>
<span id="L36"><span class="lineNum"> 36</span> <span class="tlaGNC"> 8 : return &quot;&quot;;</span></span>
<span id="L37"><span class="lineNum"> 37</span> : }</span>
<span id="L38"><span class="lineNum"> 38</span> : protected:</span>
<span id="L39"><span class="lineNum"> 39</span> : torch::Tensor predict_average_voting(torch::Tensor&amp; X);</span>
<span id="L40"><span class="lineNum"> 40</span> : std::vector&lt;std::vector&lt;double&gt;&gt; predict_average_voting(std::vector&lt;std::vector&lt;int&gt;&gt;&amp; X);</span>
<span id="L41"><span class="lineNum"> 41</span> : torch::Tensor predict_average_proba(torch::Tensor&amp; X);</span>
<span id="L42"><span class="lineNum"> 42</span> : std::vector&lt;std::vector&lt;double&gt;&gt; predict_average_proba(std::vector&lt;std::vector&lt;int&gt;&gt;&amp; X);</span>
<span id="L43"><span class="lineNum"> 43</span> : torch::Tensor compute_arg_max(torch::Tensor&amp; X);</span>
<span id="L44"><span class="lineNum"> 44</span> : std::vector&lt;int&gt; compute_arg_max(std::vector&lt;std::vector&lt;double&gt;&gt;&amp; X);</span>
<span id="L45"><span class="lineNum"> 45</span> : torch::Tensor voting(torch::Tensor&amp; votes);</span>
<span id="L46"><span class="lineNum"> 46</span> : unsigned n_models;</span>
<span id="L47"><span class="lineNum"> 47</span> : std::vector&lt;std::unique_ptr&lt;Classifier&gt;&gt; models;</span>
<span id="L48"><span class="lineNum"> 48</span> : std::vector&lt;double&gt; significanceModels;</span>
<span id="L49"><span class="lineNum"> 49</span> : void trainModel(const torch::Tensor&amp; weights) override;</span>
<span id="L50"><span class="lineNum"> 50</span> : bool predict_voting;</span>
<span id="L51"><span class="lineNum"> 51</span> : };</span>
<span id="L52"><span class="lineNum"> 52</span> : }</span>
<span id="L53"><span class="lineNum"> 53</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,189 +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 - coverage.info - BayesNet/bayesnet/ensembles</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">top level</a> - BayesNet/bayesnet/ensembles</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">coverage.info</td>
<td></td>
<td class="headerItem">Lines:</td>
<td class="headerCovTableEntryHi">98.4&nbsp;%</td>
<td class="headerCovTableEntry">443</td>
<td class="headerCovTableEntry">436</td>
</tr>
<tr>
<td class="headerItem">Test Date:</td>
<td class="headerValue">2024-04-30 13:17:26</td>
<td></td>
<td class="headerItem">Functions:</td>
<td class="headerCovTableEntryHi">98.1&nbsp;%</td>
<td class="headerCovTableEntry">53</td>
<td class="headerCovTableEntry">52</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 width="80%" cellpadding=1 cellspacing=1 border=0>
<tr>
<td width="40%"><br></td>
<td width="8%"></td>
<td width="8%"></td>
<td width="8%"></td>
<td width="8%"></td>
<td width="8%"></td>
<td width="8%"></td>
<td width="8%"></td>
</tr>
<tr>
<td class="tableHead" rowspan=2>Filename <span title="Click to sort table by file name" class="tableHeadSort"><a href="index.html"><img src="../../../updown.png" width=10 height=14 alt="Sort by file name" title="Click to sort table by file name" border=0></a></span></td>
<td class="tableHead" colspan=4>Line Coverage <span title="Click to sort table by line coverage" class="tableHeadSort"><a href="index-sort-l.html"><img src="../../../updown.png" width=10 height=14 alt="Sort by line coverage" title="Click to sort table by line coverage" border=0></a></span></td>
<td class="tableHead" colspan=3>Function Coverage <span title="Click to sort table by function coverage" class="tableHeadSort"><img src="../../../glass.png" width=10 height=14 alt="Sort by function coverage" title="Click to sort table by function coverage" border=0></span></td>
</tr>
<tr>
<td class="tableHead" colspan=2> Rate</td>
<td class="tableHead"> Total</td>
<td class="tableHead"> Hit</td>
<td class="tableHead"> Rate</td>
<td class="tableHead"> Total</td>
<td class="tableHead"> Hit</td>
</tr>
<tr>
<td class="coverFile"><a href="Ensemble.h.gcov.html">Ensemble.h</a></td>
<td class="coverBar" align="center">
<table border=0 cellspacing=0 cellpadding=1><tr><td class="coverBarOutline"><img src="../../../emerald.png" width=100 height=10 alt="100.0%"></td></tr></table>
</td>
<td class="coverPerHi">100.0&nbsp;%</td>
<td class="coverNumDflt">5</td>
<td class="coverNumDflt">5</td>
<td class="coverPerMed">75.0&nbsp;%</td>
<td class="coverNumDflt">4</td>
<td class="coverNumDflt">3</td>
</tr>
<tr>
<td class="coverFile"><a href="AODE.h.gcov.html">AODE.h</a></td>
<td class="coverBar" align="center">
<table border=0 cellspacing=0 cellpadding=1><tr><td class="coverBarOutline"><img src="../../../emerald.png" width=100 height=10 alt="100.0%"></td></tr></table>
</td>
<td class="coverPerHi">100.0&nbsp;%</td>
<td class="coverNumDflt">1</td>
<td class="coverNumDflt">1</td>
<td class="coverPerHi">100.0&nbsp;%</td>
<td class="coverNumDflt">2</td>
<td class="coverNumDflt">2</td>
</tr>
<tr>
<td class="coverFile"><a href="AODELd.h.gcov.html">AODELd.h</a></td>
<td class="coverBar" align="center">
<table border=0 cellspacing=0 cellpadding=1><tr><td class="coverBarOutline"><img src="../../../emerald.png" width=100 height=10 alt="100.0%"></td></tr></table>
</td>
<td class="coverPerHi">100.0&nbsp;%</td>
<td class="coverNumDflt">1</td>
<td class="coverNumDflt">1</td>
<td class="coverPerHi">100.0&nbsp;%</td>
<td class="coverNumDflt">2</td>
<td class="coverNumDflt">2</td>
</tr>
<tr>
<td class="coverFile"><a href="BoostAODE.h.gcov.html">BoostAODE.h</a></td>
<td class="coverBar" align="center">
<table border=0 cellspacing=0 cellpadding=1><tr><td class="coverBarOutline"><img src="../../../emerald.png" width=100 height=10 alt="100.0%"></td></tr></table>
</td>
<td class="coverPerHi">100.0&nbsp;%</td>
<td class="coverNumDflt">1</td>
<td class="coverNumDflt">1</td>
<td class="coverPerHi">100.0&nbsp;%</td>
<td class="coverNumDflt">2</td>
<td class="coverNumDflt">2</td>
</tr>
<tr>
<td class="coverFile"><a href="AODE.cc.gcov.html">AODE.cc</a></td>
<td class="coverBar" align="center">
<table border=0 cellspacing=0 cellpadding=1><tr><td class="coverBarOutline"><img src="../../../emerald.png" width=100 height=10 alt="100.0%"></td></tr></table>
</td>
<td class="coverPerHi">100.0&nbsp;%</td>
<td class="coverNumDflt">20</td>
<td class="coverNumDflt">20</td>
<td class="coverPerHi">100.0&nbsp;%</td>
<td class="coverNumDflt">4</td>
<td class="coverNumDflt">4</td>
</tr>
<tr>
<td class="coverFile"><a href="AODELd.cc.gcov.html">AODELd.cc</a></td>
<td class="coverBar" align="center">
<table border=0 cellspacing=0 cellpadding=1><tr><td class="coverBarOutline"><img src="../../../emerald.png" width=100 height=10 alt="100.0%"></td></tr></table>
</td>
<td class="coverPerHi">100.0&nbsp;%</td>
<td class="coverNumDflt">24</td>
<td class="coverNumDflt">24</td>
<td class="coverPerHi">100.0&nbsp;%</td>
<td class="coverNumDflt">5</td>
<td class="coverNumDflt">5</td>
</tr>
<tr>
<td class="coverFile"><a href="BoostAODE.cc.gcov.html">BoostAODE.cc</a></td>
<td class="coverBar" align="center">
<table border=0 cellspacing=0 cellpadding=1><tr><td class="coverBarOutline"><img src="../../../emerald.png" width=98 height=10 alt="98.3%"><img src="../../../snow.png" width=2 height=10 alt="98.3%"></td></tr></table>
</td>
<td class="coverPerHi">98.3&nbsp;%</td>
<td class="coverNumDflt">237</td>
<td class="coverNumDflt">233</td>
<td class="coverPerHi">100.0&nbsp;%</td>
<td class="coverNumDflt">9</td>
<td class="coverNumDflt">9</td>
</tr>
<tr>
<td class="coverFile"><a href="Ensemble.cc.gcov.html">Ensemble.cc</a></td>
<td class="coverBar" align="center">
<table border=0 cellspacing=0 cellpadding=1><tr><td class="coverBarOutline"><img src="../../../emerald.png" width=98 height=10 alt="98.1%"><img src="../../../snow.png" width=2 height=10 alt="98.1%"></td></tr></table>
</td>
<td class="coverPerHi">98.1&nbsp;%</td>
<td class="coverNumDflt">154</td>
<td class="coverNumDflt">151</td>
<td class="coverPerHi">100.0&nbsp;%</td>
<td class="coverNumDflt">25</td>
<td class="coverNumDflt">25</td>
</tr>
</table>
</center>
<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">LCOV version 2.0-1</a></td></tr>
</table>
<br>
</body>
</html>

View File

@ -1,189 +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 - coverage.info - BayesNet/bayesnet/ensembles</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">top level</a> - BayesNet/bayesnet/ensembles</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">coverage.info</td>
<td></td>
<td class="headerItem">Lines:</td>
<td class="headerCovTableEntryHi">98.4&nbsp;%</td>
<td class="headerCovTableEntry">443</td>
<td class="headerCovTableEntry">436</td>
</tr>
<tr>
<td class="headerItem">Test Date:</td>
<td class="headerValue">2024-04-30 13:17:26</td>
<td></td>
<td class="headerItem">Functions:</td>
<td class="headerCovTableEntryHi">98.1&nbsp;%</td>
<td class="headerCovTableEntry">53</td>
<td class="headerCovTableEntry">52</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 width="80%" cellpadding=1 cellspacing=1 border=0>
<tr>
<td width="40%"><br></td>
<td width="8%"></td>
<td width="8%"></td>
<td width="8%"></td>
<td width="8%"></td>
<td width="8%"></td>
<td width="8%"></td>
<td width="8%"></td>
</tr>
<tr>
<td class="tableHead" rowspan=2>Filename <span title="Click to sort table by file name" class="tableHeadSort"><a href="index.html"><img src="../../../updown.png" width=10 height=14 alt="Sort by file name" title="Click to sort table by file name" border=0></a></span></td>
<td class="tableHead" colspan=4>Line Coverage <span title="Click to sort table by line coverage" class="tableHeadSort"><img src="../../../glass.png" width=10 height=14 alt="Sort by line coverage" title="Click to sort table by line coverage" border=0></span></td>
<td class="tableHead" colspan=3>Function Coverage <span title="Click to sort table by function coverage" class="tableHeadSort"><a href="index-sort-f.html"><img src="../../../updown.png" width=10 height=14 alt="Sort by function coverage" title="Click to sort table by function coverage" border=0></a></span></td>
</tr>
<tr>
<td class="tableHead" colspan=2> Rate</td>
<td class="tableHead"> Total</td>
<td class="tableHead"> Hit</td>
<td class="tableHead"> Rate</td>
<td class="tableHead"> Total</td>
<td class="tableHead"> Hit</td>
</tr>
<tr>
<td class="coverFile"><a href="Ensemble.cc.gcov.html">Ensemble.cc</a></td>
<td class="coverBar" align="center">
<table border=0 cellspacing=0 cellpadding=1><tr><td class="coverBarOutline"><img src="../../../emerald.png" width=98 height=10 alt="98.1%"><img src="../../../snow.png" width=2 height=10 alt="98.1%"></td></tr></table>
</td>
<td class="coverPerHi">98.1&nbsp;%</td>
<td class="coverNumDflt">154</td>
<td class="coverNumDflt">151</td>
<td class="coverPerHi">100.0&nbsp;%</td>
<td class="coverNumDflt">25</td>
<td class="coverNumDflt">25</td>
</tr>
<tr>
<td class="coverFile"><a href="BoostAODE.cc.gcov.html">BoostAODE.cc</a></td>
<td class="coverBar" align="center">
<table border=0 cellspacing=0 cellpadding=1><tr><td class="coverBarOutline"><img src="../../../emerald.png" width=98 height=10 alt="98.3%"><img src="../../../snow.png" width=2 height=10 alt="98.3%"></td></tr></table>
</td>
<td class="coverPerHi">98.3&nbsp;%</td>
<td class="coverNumDflt">237</td>
<td class="coverNumDflt">233</td>
<td class="coverPerHi">100.0&nbsp;%</td>
<td class="coverNumDflt">9</td>
<td class="coverNumDflt">9</td>
</tr>
<tr>
<td class="coverFile"><a href="AODE.h.gcov.html">AODE.h</a></td>
<td class="coverBar" align="center">
<table border=0 cellspacing=0 cellpadding=1><tr><td class="coverBarOutline"><img src="../../../emerald.png" width=100 height=10 alt="100.0%"></td></tr></table>
</td>
<td class="coverPerHi">100.0&nbsp;%</td>
<td class="coverNumDflt">1</td>
<td class="coverNumDflt">1</td>
<td class="coverPerHi">100.0&nbsp;%</td>
<td class="coverNumDflt">2</td>
<td class="coverNumDflt">2</td>
</tr>
<tr>
<td class="coverFile"><a href="AODELd.h.gcov.html">AODELd.h</a></td>
<td class="coverBar" align="center">
<table border=0 cellspacing=0 cellpadding=1><tr><td class="coverBarOutline"><img src="../../../emerald.png" width=100 height=10 alt="100.0%"></td></tr></table>
</td>
<td class="coverPerHi">100.0&nbsp;%</td>
<td class="coverNumDflt">1</td>
<td class="coverNumDflt">1</td>
<td class="coverPerHi">100.0&nbsp;%</td>
<td class="coverNumDflt">2</td>
<td class="coverNumDflt">2</td>
</tr>
<tr>
<td class="coverFile"><a href="BoostAODE.h.gcov.html">BoostAODE.h</a></td>
<td class="coverBar" align="center">
<table border=0 cellspacing=0 cellpadding=1><tr><td class="coverBarOutline"><img src="../../../emerald.png" width=100 height=10 alt="100.0%"></td></tr></table>
</td>
<td class="coverPerHi">100.0&nbsp;%</td>
<td class="coverNumDflt">1</td>
<td class="coverNumDflt">1</td>
<td class="coverPerHi">100.0&nbsp;%</td>
<td class="coverNumDflt">2</td>
<td class="coverNumDflt">2</td>
</tr>
<tr>
<td class="coverFile"><a href="Ensemble.h.gcov.html">Ensemble.h</a></td>
<td class="coverBar" align="center">
<table border=0 cellspacing=0 cellpadding=1><tr><td class="coverBarOutline"><img src="../../../emerald.png" width=100 height=10 alt="100.0%"></td></tr></table>
</td>
<td class="coverPerHi">100.0&nbsp;%</td>
<td class="coverNumDflt">5</td>
<td class="coverNumDflt">5</td>
<td class="coverPerMed">75.0&nbsp;%</td>
<td class="coverNumDflt">4</td>
<td class="coverNumDflt">3</td>
</tr>
<tr>
<td class="coverFile"><a href="AODE.cc.gcov.html">AODE.cc</a></td>
<td class="coverBar" align="center">
<table border=0 cellspacing=0 cellpadding=1><tr><td class="coverBarOutline"><img src="../../../emerald.png" width=100 height=10 alt="100.0%"></td></tr></table>
</td>
<td class="coverPerHi">100.0&nbsp;%</td>
<td class="coverNumDflt">20</td>
<td class="coverNumDflt">20</td>
<td class="coverPerHi">100.0&nbsp;%</td>
<td class="coverNumDflt">4</td>
<td class="coverNumDflt">4</td>
</tr>
<tr>
<td class="coverFile"><a href="AODELd.cc.gcov.html">AODELd.cc</a></td>
<td class="coverBar" align="center">
<table border=0 cellspacing=0 cellpadding=1><tr><td class="coverBarOutline"><img src="../../../emerald.png" width=100 height=10 alt="100.0%"></td></tr></table>
</td>
<td class="coverPerHi">100.0&nbsp;%</td>
<td class="coverNumDflt">24</td>
<td class="coverNumDflt">24</td>
<td class="coverPerHi">100.0&nbsp;%</td>
<td class="coverNumDflt">5</td>
<td class="coverNumDflt">5</td>
</tr>
</table>
</center>
<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">LCOV version 2.0-1</a></td></tr>
</table>
<br>
</body>
</html>

View File

@ -1,189 +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 - coverage.info - BayesNet/bayesnet/ensembles</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">top level</a> - BayesNet/bayesnet/ensembles</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">coverage.info</td>
<td></td>
<td class="headerItem">Lines:</td>
<td class="headerCovTableEntryHi">98.4&nbsp;%</td>
<td class="headerCovTableEntry">443</td>
<td class="headerCovTableEntry">436</td>
</tr>
<tr>
<td class="headerItem">Test Date:</td>
<td class="headerValue">2024-04-30 13:17:26</td>
<td></td>
<td class="headerItem">Functions:</td>
<td class="headerCovTableEntryHi">98.1&nbsp;%</td>
<td class="headerCovTableEntry">53</td>
<td class="headerCovTableEntry">52</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 width="80%" cellpadding=1 cellspacing=1 border=0>
<tr>
<td width="40%"><br></td>
<td width="8%"></td>
<td width="8%"></td>
<td width="8%"></td>
<td width="8%"></td>
<td width="8%"></td>
<td width="8%"></td>
<td width="8%"></td>
</tr>
<tr>
<td class="tableHead" rowspan=2>Filename <span title="Click to sort table by file name" class="tableHeadSort"><img src="../../../glass.png" width=10 height=14 alt="Sort by file name" title="Click to sort table by file name" border=0></span></td>
<td class="tableHead" colspan=4>Line Coverage <span title="Click to sort table by line coverage" class="tableHeadSort"><a href="index-sort-l.html"><img src="../../../updown.png" width=10 height=14 alt="Sort by line coverage" title="Click to sort table by line coverage" border=0></a></span></td>
<td class="tableHead" colspan=3>Function Coverage <span title="Click to sort table by function coverage" class="tableHeadSort"><a href="index-sort-f.html"><img src="../../../updown.png" width=10 height=14 alt="Sort by function coverage" title="Click to sort table by function coverage" border=0></a></span></td>
</tr>
<tr>
<td class="tableHead" colspan=2> Rate</td>
<td class="tableHead"> Total</td>
<td class="tableHead"> Hit</td>
<td class="tableHead"> Rate</td>
<td class="tableHead"> Total</td>
<td class="tableHead"> Hit</td>
</tr>
<tr>
<td class="coverFile"><a href="AODE.cc.gcov.html">AODE.cc</a></td>
<td class="coverBar" align="center">
<table border=0 cellspacing=0 cellpadding=1><tr><td class="coverBarOutline"><img src="../../../emerald.png" width=100 height=10 alt="100.0%"></td></tr></table>
</td>
<td class="coverPerHi">100.0&nbsp;%</td>
<td class="coverNumDflt">20</td>
<td class="coverNumDflt">20</td>
<td class="coverPerHi">100.0&nbsp;%</td>
<td class="coverNumDflt">4</td>
<td class="coverNumDflt">4</td>
</tr>
<tr>
<td class="coverFile"><a href="AODE.h.gcov.html">AODE.h</a></td>
<td class="coverBar" align="center">
<table border=0 cellspacing=0 cellpadding=1><tr><td class="coverBarOutline"><img src="../../../emerald.png" width=100 height=10 alt="100.0%"></td></tr></table>
</td>
<td class="coverPerHi">100.0&nbsp;%</td>
<td class="coverNumDflt">1</td>
<td class="coverNumDflt">1</td>
<td class="coverPerHi">100.0&nbsp;%</td>
<td class="coverNumDflt">2</td>
<td class="coverNumDflt">2</td>
</tr>
<tr>
<td class="coverFile"><a href="AODELd.cc.gcov.html">AODELd.cc</a></td>
<td class="coverBar" align="center">
<table border=0 cellspacing=0 cellpadding=1><tr><td class="coverBarOutline"><img src="../../../emerald.png" width=100 height=10 alt="100.0%"></td></tr></table>
</td>
<td class="coverPerHi">100.0&nbsp;%</td>
<td class="coverNumDflt">24</td>
<td class="coverNumDflt">24</td>
<td class="coverPerHi">100.0&nbsp;%</td>
<td class="coverNumDflt">5</td>
<td class="coverNumDflt">5</td>
</tr>
<tr>
<td class="coverFile"><a href="AODELd.h.gcov.html">AODELd.h</a></td>
<td class="coverBar" align="center">
<table border=0 cellspacing=0 cellpadding=1><tr><td class="coverBarOutline"><img src="../../../emerald.png" width=100 height=10 alt="100.0%"></td></tr></table>
</td>
<td class="coverPerHi">100.0&nbsp;%</td>
<td class="coverNumDflt">1</td>
<td class="coverNumDflt">1</td>
<td class="coverPerHi">100.0&nbsp;%</td>
<td class="coverNumDflt">2</td>
<td class="coverNumDflt">2</td>
</tr>
<tr>
<td class="coverFile"><a href="BoostAODE.cc.gcov.html">BoostAODE.cc</a></td>
<td class="coverBar" align="center">
<table border=0 cellspacing=0 cellpadding=1><tr><td class="coverBarOutline"><img src="../../../emerald.png" width=98 height=10 alt="98.3%"><img src="../../../snow.png" width=2 height=10 alt="98.3%"></td></tr></table>
</td>
<td class="coverPerHi">98.3&nbsp;%</td>
<td class="coverNumDflt">237</td>
<td class="coverNumDflt">233</td>
<td class="coverPerHi">100.0&nbsp;%</td>
<td class="coverNumDflt">9</td>
<td class="coverNumDflt">9</td>
</tr>
<tr>
<td class="coverFile"><a href="BoostAODE.h.gcov.html">BoostAODE.h</a></td>
<td class="coverBar" align="center">
<table border=0 cellspacing=0 cellpadding=1><tr><td class="coverBarOutline"><img src="../../../emerald.png" width=100 height=10 alt="100.0%"></td></tr></table>
</td>
<td class="coverPerHi">100.0&nbsp;%</td>
<td class="coverNumDflt">1</td>
<td class="coverNumDflt">1</td>
<td class="coverPerHi">100.0&nbsp;%</td>
<td class="coverNumDflt">2</td>
<td class="coverNumDflt">2</td>
</tr>
<tr>
<td class="coverFile"><a href="Ensemble.cc.gcov.html">Ensemble.cc</a></td>
<td class="coverBar" align="center">
<table border=0 cellspacing=0 cellpadding=1><tr><td class="coverBarOutline"><img src="../../../emerald.png" width=98 height=10 alt="98.1%"><img src="../../../snow.png" width=2 height=10 alt="98.1%"></td></tr></table>
</td>
<td class="coverPerHi">98.1&nbsp;%</td>
<td class="coverNumDflt">154</td>
<td class="coverNumDflt">151</td>
<td class="coverPerHi">100.0&nbsp;%</td>
<td class="coverNumDflt">25</td>
<td class="coverNumDflt">25</td>
</tr>
<tr>
<td class="coverFile"><a href="Ensemble.h.gcov.html">Ensemble.h</a></td>
<td class="coverBar" align="center">
<table border=0 cellspacing=0 cellpadding=1><tr><td class="coverBarOutline"><img src="../../../emerald.png" width=100 height=10 alt="100.0%"></td></tr></table>
</td>
<td class="coverPerHi">100.0&nbsp;%</td>
<td class="coverNumDflt">5</td>
<td class="coverNumDflt">5</td>
<td class="coverPerMed">75.0&nbsp;%</td>
<td class="coverNumDflt">4</td>
<td class="coverNumDflt">3</td>
</tr>
</table>
</center>
<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">LCOV version 2.0-1</a></td></tr>
</table>
<br>
</body>
</html>

View File

@ -1,89 +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 - coverage.info - BayesNet/bayesnet/feature_selection/CFS.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">top level</a> - <a href="index.html">BayesNet/bayesnet/feature_selection</a> - CFS.cc<span style="font-size: 80%;"> (<a href="CFS.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">coverage.info</td>
<td></td>
<td class="headerItem">Lines:</td>
<td class="headerCovTableEntryHi">97.8&nbsp;%</td>
<td class="headerCovTableEntry">45</td>
<td class="headerCovTableEntry">44</td>
</tr>
<tr>
<td class="headerItem">Test Date:</td>
<td class="headerValue">2024-04-30 13:17:26</td>
<td></td>
<td class="headerItem">Functions:</td>
<td class="headerCovTableEntryHi">100.0&nbsp;%</td>
<td class="headerCovTableEntry">2</td>
<td class="headerCovTableEntry">2</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="CFS.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="CFS.cc.gcov.html#L9">_ZN8bayesnet3CFS3fitEv</a></td>
<td class="coverFnHi">12</td>
</tr>
<tr>
<td class="coverFn"><a href="CFS.cc.gcov.html#L43">_ZN8bayesnet3CFS24computeContinueConditionERKSt6vectorIiSaIiEE</a></td>
<td class="coverFnHi">56</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,89 +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 - coverage.info - BayesNet/bayesnet/feature_selection/CFS.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">top level</a> - <a href="index.html">BayesNet/bayesnet/feature_selection</a> - CFS.cc<span style="font-size: 80%;"> (<a href="CFS.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">coverage.info</td>
<td></td>
<td class="headerItem">Lines:</td>
<td class="headerCovTableEntryHi">97.8&nbsp;%</td>
<td class="headerCovTableEntry">45</td>
<td class="headerCovTableEntry">44</td>
</tr>
<tr>
<td class="headerItem">Test Date:</td>
<td class="headerValue">2024-04-30 13:17:26</td>
<td></td>
<td class="headerItem">Functions:</td>
<td class="headerCovTableEntryHi">100.0&nbsp;%</td>
<td class="headerCovTableEntry">2</td>
<td class="headerCovTableEntry">2</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="CFS.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="CFS.cc.gcov.html#L43">_ZN8bayesnet3CFS24computeContinueConditionERKSt6vectorIiSaIiEE</a></td>
<td class="coverFnHi">56</td>
</tr>
<tr>
<td class="coverFn"><a href="CFS.cc.gcov.html#L9">_ZN8bayesnet3CFS3fitEv</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,154 +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 - coverage.info - BayesNet/bayesnet/feature_selection/CFS.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">top level</a> - <a href="index.html">BayesNet/bayesnet/feature_selection</a> - CFS.cc<span style="font-size: 80%;"> (source / <a href="CFS.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">coverage.info</td>
<td></td>
<td class="headerItem">Lines:</td>
<td class="headerCovTableEntryHi">97.8&nbsp;%</td>
<td class="headerCovTableEntry">45</td>
<td class="headerCovTableEntry">44</td>
</tr>
<tr>
<td class="headerItem">Test Date:</td>
<td class="headerValue">2024-04-30 13:17:26</td>
<td></td>
<td class="headerItem">Functions:</td>
<td class="headerCovTableEntryHi">100.0&nbsp;%</td>
<td class="headerCovTableEntry">2</td>
<td class="headerCovTableEntry">2</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;limits&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;CFS.h&quot;</span>
<span id="L10"><span class="lineNum"> 10</span> : namespace bayesnet {</span>
<span id="L11"><span class="lineNum"> 11</span> <span class="tlaGNC tlaBgGNC"> 12 : void CFS::fit()</span></span>
<span id="L12"><span class="lineNum"> 12</span> : {</span>
<span id="L13"><span class="lineNum"> 13</span> <span class="tlaGNC"> 12 : initialize();</span></span>
<span id="L14"><span class="lineNum"> 14</span> <span class="tlaGNC"> 12 : computeSuLabels();</span></span>
<span id="L15"><span class="lineNum"> 15</span> <span class="tlaGNC"> 12 : auto featureOrder = argsort(suLabels); // sort descending order</span></span>
<span id="L16"><span class="lineNum"> 16</span> <span class="tlaGNC"> 12 : auto continueCondition = true;</span></span>
<span id="L17"><span class="lineNum"> 17</span> <span class="tlaGNC"> 12 : auto feature = featureOrder[0];</span></span>
<span id="L18"><span class="lineNum"> 18</span> <span class="tlaGNC"> 12 : selectedFeatures.push_back(feature);</span></span>
<span id="L19"><span class="lineNum"> 19</span> <span class="tlaGNC"> 12 : selectedScores.push_back(suLabels[feature]);</span></span>
<span id="L20"><span class="lineNum"> 20</span> <span class="tlaGNC"> 12 : featureOrder.erase(featureOrder.begin());</span></span>
<span id="L21"><span class="lineNum"> 21</span> <span class="tlaGNC"> 68 : while (continueCondition) {</span></span>
<span id="L22"><span class="lineNum"> 22</span> <span class="tlaGNC"> 56 : double merit = std::numeric_limits&lt;double&gt;::lowest();</span></span>
<span id="L23"><span class="lineNum"> 23</span> <span class="tlaGNC"> 56 : int bestFeature = -1;</span></span>
<span id="L24"><span class="lineNum"> 24</span> <span class="tlaGNC"> 328 : for (auto feature : featureOrder) {</span></span>
<span id="L25"><span class="lineNum"> 25</span> <span class="tlaGNC"> 272 : selectedFeatures.push_back(feature);</span></span>
<span id="L26"><span class="lineNum"> 26</span> : // Compute merit with selectedFeatures</span>
<span id="L27"><span class="lineNum"> 27</span> <span class="tlaGNC"> 272 : auto meritNew = computeMeritCFS();</span></span>
<span id="L28"><span class="lineNum"> 28</span> <span class="tlaGNC"> 272 : if (meritNew &gt; merit) {</span></span>
<span id="L29"><span class="lineNum"> 29</span> <span class="tlaGNC"> 114 : merit = meritNew;</span></span>
<span id="L30"><span class="lineNum"> 30</span> <span class="tlaGNC"> 114 : bestFeature = feature;</span></span>
<span id="L31"><span class="lineNum"> 31</span> : }</span>
<span id="L32"><span class="lineNum"> 32</span> <span class="tlaGNC"> 272 : selectedFeatures.pop_back();</span></span>
<span id="L33"><span class="lineNum"> 33</span> : }</span>
<span id="L34"><span class="lineNum"> 34</span> <span class="tlaGNC"> 56 : if (bestFeature == -1) {</span></span>
<span id="L35"><span class="lineNum"> 35</span> : // meritNew has to be nan due to constant features</span>
<span id="L36"><span class="lineNum"> 36</span> <span class="tlaUNC tlaBgUNC"> 0 : break;</span></span>
<span id="L37"><span class="lineNum"> 37</span> : }</span>
<span id="L38"><span class="lineNum"> 38</span> <span class="tlaGNC tlaBgGNC"> 56 : selectedFeatures.push_back(bestFeature);</span></span>
<span id="L39"><span class="lineNum"> 39</span> <span class="tlaGNC"> 56 : selectedScores.push_back(merit);</span></span>
<span id="L40"><span class="lineNum"> 40</span> <span class="tlaGNC"> 56 : featureOrder.erase(remove(featureOrder.begin(), featureOrder.end(), bestFeature), featureOrder.end());</span></span>
<span id="L41"><span class="lineNum"> 41</span> <span class="tlaGNC"> 56 : continueCondition = computeContinueCondition(featureOrder);</span></span>
<span id="L42"><span class="lineNum"> 42</span> : }</span>
<span id="L43"><span class="lineNum"> 43</span> <span class="tlaGNC"> 12 : fitted = true;</span></span>
<span id="L44"><span class="lineNum"> 44</span> <span class="tlaGNC"> 12 : }</span></span>
<span id="L45"><span class="lineNum"> 45</span> <span class="tlaGNC"> 56 : bool CFS::computeContinueCondition(const std::vector&lt;int&gt;&amp; featureOrder)</span></span>
<span id="L46"><span class="lineNum"> 46</span> : {</span>
<span id="L47"><span class="lineNum"> 47</span> <span class="tlaGNC"> 56 : if (selectedFeatures.size() == maxFeatures || featureOrder.size() == 0) {</span></span>
<span id="L48"><span class="lineNum"> 48</span> <span class="tlaGNC"> 2 : return false;</span></span>
<span id="L49"><span class="lineNum"> 49</span> : }</span>
<span id="L50"><span class="lineNum"> 50</span> <span class="tlaGNC"> 54 : if (selectedScores.size() &gt;= 5) {</span></span>
<span id="L51"><span class="lineNum"> 51</span> : /*</span>
<span id="L52"><span class="lineNum"> 52</span> : &quot;To prevent the best first search from exploring the entire</span>
<span id="L53"><span class="lineNum"> 53</span> : feature subset search space, a stopping criterion is imposed.</span>
<span id="L54"><span class="lineNum"> 54</span> : The search will terminate if five consecutive fully expanded</span>
<span id="L55"><span class="lineNum"> 55</span> : subsets show no improvement over the current best subset.&quot;</span>
<span id="L56"><span class="lineNum"> 56</span> : as stated in Mark A.Hall Thesis</span>
<span id="L57"><span class="lineNum"> 57</span> : */</span>
<span id="L58"><span class="lineNum"> 58</span> <span class="tlaGNC"> 20 : double item_ant = std::numeric_limits&lt;double&gt;::lowest();</span></span>
<span id="L59"><span class="lineNum"> 59</span> <span class="tlaGNC"> 20 : int num = 0;</span></span>
<span id="L60"><span class="lineNum"> 60</span> <span class="tlaGNC"> 20 : std::vector&lt;double&gt; lastFive(selectedScores.end() - 5, selectedScores.end());</span></span>
<span id="L61"><span class="lineNum"> 61</span> <span class="tlaGNC"> 80 : for (auto item : lastFive) {</span></span>
<span id="L62"><span class="lineNum"> 62</span> <span class="tlaGNC"> 70 : if (item_ant == std::numeric_limits&lt;double&gt;::lowest()) {</span></span>
<span id="L63"><span class="lineNum"> 63</span> <span class="tlaGNC"> 20 : item_ant = item;</span></span>
<span id="L64"><span class="lineNum"> 64</span> : }</span>
<span id="L65"><span class="lineNum"> 65</span> <span class="tlaGNC"> 70 : if (item &gt; item_ant) {</span></span>
<span id="L66"><span class="lineNum"> 66</span> <span class="tlaGNC"> 10 : break;</span></span>
<span id="L67"><span class="lineNum"> 67</span> : } else {</span>
<span id="L68"><span class="lineNum"> 68</span> <span class="tlaGNC"> 60 : num++;</span></span>
<span id="L69"><span class="lineNum"> 69</span> <span class="tlaGNC"> 60 : item_ant = item;</span></span>
<span id="L70"><span class="lineNum"> 70</span> : }</span>
<span id="L71"><span class="lineNum"> 71</span> : }</span>
<span id="L72"><span class="lineNum"> 72</span> <span class="tlaGNC"> 20 : if (num == 5) {</span></span>
<span id="L73"><span class="lineNum"> 73</span> <span class="tlaGNC"> 10 : return false;</span></span>
<span id="L74"><span class="lineNum"> 74</span> : }</span>
<span id="L75"><span class="lineNum"> 75</span> <span class="tlaGNC"> 20 : }</span></span>
<span id="L76"><span class="lineNum"> 76</span> <span class="tlaGNC"> 44 : return true;</span></span>
<span id="L77"><span class="lineNum"> 77</span> : }</span>
<span id="L78"><span class="lineNum"> 78</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,103 +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 - coverage.info - BayesNet/bayesnet/feature_selection/CFS.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">top level</a> - <a href="index.html">BayesNet/bayesnet/feature_selection</a> - CFS.h<span style="font-size: 80%;"> (<a href="CFS.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">coverage.info</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-04-30 13:17:26</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><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="CFS.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="CFS.h.gcov.html#L14">_ZN8bayesnet3CFSC2ERKN2at6TensorERKSt6vectorINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESaISB_EERKSB_iiS4_</a></td>
<td class="coverFnHi">12</td>
</tr>
<tr>
<td class="coverFn"><a href="CFS.h.gcov.html#L18">_ZN8bayesnet3CFSD0Ev</a></td>
<td class="coverFnHi">24</td>
</tr>
<tr>
<td class="coverFnAlias"><a href="CFS.h.gcov.html#L18">_ZN8bayesnet3CFSD0Ev</a></td>
<td class="coverFnAliasHi">12</td>
</tr>
<tr>
<td class="coverFnAlias"><a href="CFS.h.gcov.html#L18">_ZN8bayesnet3CFSD2Ev</a></td>
<td class="coverFnAliasHi">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,103 +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 - coverage.info - BayesNet/bayesnet/feature_selection/CFS.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">top level</a> - <a href="index.html">BayesNet/bayesnet/feature_selection</a> - CFS.h<span style="font-size: 80%;"> (<a href="CFS.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">coverage.info</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-04-30 13:17:26</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><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="CFS.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="CFS.h.gcov.html#L14">_ZN8bayesnet3CFSC2ERKN2at6TensorERKSt6vectorINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESaISB_EERKSB_iiS4_</a></td>
<td class="coverFnHi">12</td>
</tr>
<tr>
<td class="coverFn"><a href="CFS.h.gcov.html#L18">_ZN8bayesnet3CFSD0Ev</a></td>
<td class="coverFnHi">24</td>
</tr>
<tr>
<td class="coverFnAlias"><a href="CFS.h.gcov.html#L18">_ZN8bayesnet3CFSD0Ev</a></td>
<td class="coverFnAliasHi">12</td>
</tr>
<tr>
<td class="coverFnAlias"><a href="CFS.h.gcov.html#L18">_ZN8bayesnet3CFSD2Ev</a></td>
<td class="coverFnAliasHi">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,102 +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 - coverage.info - BayesNet/bayesnet/feature_selection/CFS.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">top level</a> - <a href="index.html">BayesNet/bayesnet/feature_selection</a> - CFS.h<span style="font-size: 80%;"> (source / <a href="CFS.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">coverage.info</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-04-30 13:17:26</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><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 CFS_H</span>
<span id="L8"><span class="lineNum"> 8</span> : #define CFS_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 &lt;vector&gt;</span>
<span id="L11"><span class="lineNum"> 11</span> : #include &quot;bayesnet/feature_selection/FeatureSelect.h&quot;</span>
<span id="L12"><span class="lineNum"> 12</span> : namespace bayesnet {</span>
<span id="L13"><span class="lineNum"> 13</span> : class CFS : public FeatureSelect {</span>
<span id="L14"><span class="lineNum"> 14</span> : public:</span>
<span id="L15"><span class="lineNum"> 15</span> : // dataset is a n+1xm tensor of integers where dataset[-1] is the y std::vector</span>
<span id="L16"><span class="lineNum"> 16</span> <span class="tlaGNC tlaBgGNC"> 12 : CFS(const torch::Tensor&amp; samples, const std::vector&lt;std::string&gt;&amp; features, const std::string&amp; className, const int maxFeatures, const int classNumStates, const torch::Tensor&amp; weights) :</span></span>
<span id="L17"><span class="lineNum"> 17</span> <span class="tlaGNC"> 12 : FeatureSelect(samples, features, className, maxFeatures, classNumStates, weights)</span></span>
<span id="L18"><span class="lineNum"> 18</span> : {</span>
<span id="L19"><span class="lineNum"> 19</span> <span class="tlaGNC"> 12 : }</span></span>
<span id="L20"><span class="lineNum"> 20</span> <span class="tlaGNC"> 24 : virtual ~CFS() {};</span></span>
<span id="L21"><span class="lineNum"> 21</span> : void fit() override;</span>
<span id="L22"><span class="lineNum"> 22</span> : private:</span>
<span id="L23"><span class="lineNum"> 23</span> : bool computeContinueCondition(const std::vector&lt;int&gt;&amp; featureOrder);</span>
<span id="L24"><span class="lineNum"> 24</span> : };</span>
<span id="L25"><span class="lineNum"> 25</span> : }</span>
<span id="L26"><span class="lineNum"> 26</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,89 +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 - coverage.info - BayesNet/bayesnet/feature_selection/FCBF.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">top level</a> - <a href="index.html">BayesNet/bayesnet/feature_selection</a> - FCBF.cc<span style="font-size: 80%;"> (<a href="FCBF.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">coverage.info</td>
<td></td>
<td class="headerItem">Lines:</td>
<td class="headerCovTableEntryHi">92.3&nbsp;%</td>
<td class="headerCovTableEntry">26</td>
<td class="headerCovTableEntry">24</td>
</tr>
<tr>
<td class="headerItem">Test Date:</td>
<td class="headerValue">2024-04-30 13:17:26</td>
<td></td>
<td class="headerItem">Functions:</td>
<td class="headerCovTableEntryHi">100.0&nbsp;%</td>
<td class="headerCovTableEntry">2</td>
<td class="headerCovTableEntry">2</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="FCBF.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="FCBF.cc.gcov.html#L16">_ZN8bayesnet4FCBF3fitEv</a></td>
<td class="coverFnHi">10</td>
</tr>
<tr>
<td class="coverFn"><a href="FCBF.cc.gcov.html#L9">_ZN8bayesnet4FCBFC2ERKN2at6TensorERKSt6vectorINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESaISB_EERKSB_iiS4_d</a></td>
<td class="coverFnHi">14</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,89 +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 - coverage.info - BayesNet/bayesnet/feature_selection/FCBF.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">top level</a> - <a href="index.html">BayesNet/bayesnet/feature_selection</a> - FCBF.cc<span style="font-size: 80%;"> (<a href="FCBF.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">coverage.info</td>
<td></td>
<td class="headerItem">Lines:</td>
<td class="headerCovTableEntryHi">92.3&nbsp;%</td>
<td class="headerCovTableEntry">26</td>
<td class="headerCovTableEntry">24</td>
</tr>
<tr>
<td class="headerItem">Test Date:</td>
<td class="headerValue">2024-04-30 13:17:26</td>
<td></td>
<td class="headerItem">Functions:</td>
<td class="headerCovTableEntryHi">100.0&nbsp;%</td>
<td class="headerCovTableEntry">2</td>
<td class="headerCovTableEntry">2</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="FCBF.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="FCBF.cc.gcov.html#L16">_ZN8bayesnet4FCBF3fitEv</a></td>
<td class="coverFnHi">10</td>
</tr>
<tr>
<td class="coverFn"><a href="FCBF.cc.gcov.html#L9">_ZN8bayesnet4FCBFC2ERKN2at6TensorERKSt6vectorINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESaISB_EERKSB_iiS4_d</a></td>
<td class="coverFnHi">14</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,126 +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 - coverage.info - BayesNet/bayesnet/feature_selection/FCBF.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">top level</a> - <a href="index.html">BayesNet/bayesnet/feature_selection</a> - FCBF.cc<span style="font-size: 80%;"> (source / <a href="FCBF.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">coverage.info</td>
<td></td>
<td class="headerItem">Lines:</td>
<td class="headerCovTableEntryHi">92.3&nbsp;%</td>
<td class="headerCovTableEntry">26</td>
<td class="headerCovTableEntry">24</td>
</tr>
<tr>
<td class="headerItem">Test Date:</td>
<td class="headerValue">2024-04-30 13:17:26</td>
<td></td>
<td class="headerItem">Functions:</td>
<td class="headerCovTableEntryHi">100.0&nbsp;%</td>
<td class="headerCovTableEntry">2</td>
<td class="headerCovTableEntry">2</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;bayesnet/utils/bayesnetUtils.h&quot;</span>
<span id="L8"><span class="lineNum"> 8</span> : #include &quot;FCBF.h&quot;</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"> 14 : FCBF::FCBF(const torch::Tensor&amp; samples, const std::vector&lt;std::string&gt;&amp; features, const std::string&amp; className, const int maxFeatures, const int classNumStates, const torch::Tensor&amp; weights, const double threshold) :</span></span>
<span id="L12"><span class="lineNum"> 12</span> <span class="tlaGNC"> 14 : FeatureSelect(samples, features, className, maxFeatures, classNumStates, weights), threshold(threshold)</span></span>
<span id="L13"><span class="lineNum"> 13</span> : {</span>
<span id="L14"><span class="lineNum"> 14</span> <span class="tlaGNC"> 14 : if (threshold &lt; 1e-7) {</span></span>
<span id="L15"><span class="lineNum"> 15</span> <span class="tlaGNC"> 4 : throw std::invalid_argument(&quot;Threshold cannot be less than 1e-7&quot;);</span></span>
<span id="L16"><span class="lineNum"> 16</span> : }</span>
<span id="L17"><span class="lineNum"> 17</span> <span class="tlaGNC"> 14 : }</span></span>
<span id="L18"><span class="lineNum"> 18</span> <span class="tlaGNC"> 10 : void FCBF::fit()</span></span>
<span id="L19"><span class="lineNum"> 19</span> : {</span>
<span id="L20"><span class="lineNum"> 20</span> <span class="tlaGNC"> 10 : initialize();</span></span>
<span id="L21"><span class="lineNum"> 21</span> <span class="tlaGNC"> 10 : computeSuLabels();</span></span>
<span id="L22"><span class="lineNum"> 22</span> <span class="tlaGNC"> 10 : auto featureOrder = argsort(suLabels); // sort descending order</span></span>
<span id="L23"><span class="lineNum"> 23</span> <span class="tlaGNC"> 10 : auto featureOrderCopy = featureOrder;</span></span>
<span id="L24"><span class="lineNum"> 24</span> <span class="tlaGNC"> 84 : for (const auto&amp; feature : featureOrder) {</span></span>
<span id="L25"><span class="lineNum"> 25</span> : // Don't self compare</span>
<span id="L26"><span class="lineNum"> 26</span> <span class="tlaGNC"> 74 : featureOrderCopy.erase(featureOrderCopy.begin());</span></span>
<span id="L27"><span class="lineNum"> 27</span> <span class="tlaGNC"> 74 : if (suLabels.at(feature) == 0.0) {</span></span>
<span id="L28"><span class="lineNum"> 28</span> : // The feature has been removed from the list</span>
<span id="L29"><span class="lineNum"> 29</span> <span class="tlaGNC"> 32 : continue;</span></span>
<span id="L30"><span class="lineNum"> 30</span> : }</span>
<span id="L31"><span class="lineNum"> 31</span> <span class="tlaGNC"> 42 : if (suLabels.at(feature) &lt; threshold) {</span></span>
<span id="L32"><span class="lineNum"> 32</span> <span class="tlaUNC tlaBgUNC"> 0 : break;</span></span>
<span id="L33"><span class="lineNum"> 33</span> : }</span>
<span id="L34"><span class="lineNum"> 34</span> : // Remove redundant features</span>
<span id="L35"><span class="lineNum"> 35</span> <span class="tlaGNC tlaBgGNC"> 232 : for (const auto&amp; featureCopy : featureOrderCopy) {</span></span>
<span id="L36"><span class="lineNum"> 36</span> <span class="tlaGNC"> 190 : double value = computeSuFeatures(feature, featureCopy);</span></span>
<span id="L37"><span class="lineNum"> 37</span> <span class="tlaGNC"> 190 : if (value &gt;= suLabels.at(featureCopy)) {</span></span>
<span id="L38"><span class="lineNum"> 38</span> : // Remove feature from list</span>
<span id="L39"><span class="lineNum"> 39</span> <span class="tlaGNC"> 66 : suLabels[featureCopy] = 0.0;</span></span>
<span id="L40"><span class="lineNum"> 40</span> : }</span>
<span id="L41"><span class="lineNum"> 41</span> : }</span>
<span id="L42"><span class="lineNum"> 42</span> <span class="tlaGNC"> 42 : selectedFeatures.push_back(feature);</span></span>
<span id="L43"><span class="lineNum"> 43</span> <span class="tlaGNC"> 42 : selectedScores.push_back(suLabels[feature]);</span></span>
<span id="L44"><span class="lineNum"> 44</span> <span class="tlaGNC"> 42 : if (selectedFeatures.size() == maxFeatures) {</span></span>
<span id="L45"><span class="lineNum"> 45</span> <span class="tlaUNC tlaBgUNC"> 0 : break;</span></span>
<span id="L46"><span class="lineNum"> 46</span> : }</span>
<span id="L47"><span class="lineNum"> 47</span> : }</span>
<span id="L48"><span class="lineNum"> 48</span> <span class="tlaGNC tlaBgGNC"> 10 : fitted = true;</span></span>
<span id="L49"><span class="lineNum"> 49</span> <span class="tlaGNC"> 10 : }</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>

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