Files
BayesNet/html/bayesnet/classifiers/SPODE.cc.gcov.html

6.5 KiB

<html lang="en"> <head> </head>
LCOV - code coverage report
Current view: top level - bayesnet/classifiers - SPODE.cc (source / functions) Coverage Total Hit
Test: coverage.info Lines: 100.0 % 10 10
Test Date: 2024-04-21 16:43:29 Functions: 100.0 % 3 3

            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          252 :     SPODE::SPODE(int root) : Classifier(Network()), root(root) {}
      12              : 
      13          225 :     void SPODE::buildModel(const torch::Tensor& weights)
      14              :     {
      15              :         // 0. Add all nodes to the model
      16          225 :         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         8611 :         for (int i = 0; i < static_cast<int>(features.size()); ++i) {
      20         8386 :             model.addEdge(className, features[i]);
      21         8386 :             if (i != root) {
      22         8161 :                 model.addEdge(features[root], features[i]);
      23              :             }
      24              :         }
      25          225 :     }
      26           17 :     std::vector<std::string> SPODE::graph(const std::string& name) const
      27              :     {
      28           17 :         return model.graph(name);
      29              :     }
      30              : 
      31              : }
        

Generated by: LCOV version 2.0-1

</html>