# LCOV - BayesNet Coverage Report - bayesnet/classifiers/SPODE.cc

LCOV - code coverage report

Current view: | top level - bayesnet/classifiers - SPODE.cc (source / functions) |  |  | Coverage | Total | Hit
Test: | BayesNet Coverage Report |  | Lines: | 100.0 % | 10 | 10
Test Date: | 2024-05-06 17:54:04 |  | Functions: | 100.0 % | 3 | 3
Legend: | Lines: hit not hit |

                Line data    Source code

           1              : // ***************************************************************
           2              : // SPDX-FileCopyrightText: Copyright 2024 Ricardo Montañana Gómez
           3              : // SPDX-FileType: SOURCE
           4              : // SPDX-License-Identifier: MIT
           5              : // ***************************************************************
           6              :
           7              : #include "SPODE.h"
           8              :
           9              : namespace bayesnet {
          10              :
          11         1124 :     SPODE::SPODE(int root) : Classifier(Network()), root(root) {}
          12              :
          13         1016 :     void SPODE::buildModel(const torch::Tensor& weights)
          14              :     {
          15              :         // 0. Add all nodes to the model
          16         1016 :         addNodes();
          17              :         // 1. Add edges from the class node to all other nodes
          18              :         // 2. Add edges from the root node to all other nodes
          19        25680 :         for (int i = 0; i < static_cast<int>(features.size()); ++i) {
          20        24664 :             model.addEdge(className, features[i]);
          21        24664 :             if (i != root) {
          22        23648 :                 model.addEdge(features[root], features[i]);
          23              :             }
          24              :         }
          25         1016 :     }
          26           68 :     std::vector<std::string> SPODE::graph(const std::string& name) const
          27              :     {
          28           68 :         return model.graph(name);
          29              :     }
          30              :
          31              : }

Generated by: LCOV version 2.0-1