Files
BayesNet/html/bayesnet/classifiers/TANLd.cc.gcov.html
2024-05-06 17:56:00 +02:00

7.8 KiB

<html lang="en"> <head> </head>
LCOV - code coverage report
Current view: top level - bayesnet/classifiers - TANLd.cc (source / functions) Coverage Total Hit
Test: BayesNet Coverage Report Lines: 100.0 % 17 17
Test Date: 2024-05-06 17:54:04 Functions: 100.0 % 4 4
Legend: Lines: hit not hit

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

Generated by: LCOV version 2.0-1

</html>