BayesNet 1.0.7.
Bayesian Network and basic classifiers Library.
Loading...
Searching...
No Matches
Proposal.h
1// ***************************************************************
2// SPDX-FileCopyrightText: Copyright 2024 Ricardo Montañana Gómez
3// SPDX-FileType: SOURCE
4// SPDX-License-Identifier: MIT
5// ***************************************************************
6
7#ifndef PROPOSAL_H
8#define PROPOSAL_H
9#include <string>
10#include <map>
11#include <torch/torch.h>
12#include <CPPFImdlp.h>
13#include "bayesnet/network/Network.h"
14#include "Classifier.h"
15
16namespace bayesnet {
17 class Proposal {
18 public:
19 Proposal(torch::Tensor& pDataset, std::vector<std::string>& features_, std::string& className_);
20 virtual ~Proposal();
21 protected:
22 void checkInput(const torch::Tensor& X, const torch::Tensor& y);
23 torch::Tensor prepareX(torch::Tensor& X);
24 map<std::string, std::vector<int>> localDiscretizationProposal(const map<std::string, std::vector<int>>& states, Network& model);
25 map<std::string, std::vector<int>> fit_local_discretization(const torch::Tensor& y);
26 torch::Tensor Xf; // X continuous nxm tensor
27 torch::Tensor y; // y discrete nx1 tensor
28 map<std::string, mdlp::CPPFImdlp*> discretizers;
29 private:
30 std::vector<int> factorize(const std::vector<std::string>& labels_t);
31 torch::Tensor& pDataset; // (n+1)xm tensor
32 std::vector<std::string>& pFeatures;
33 std::string& pClassName;
34 };
35}
36
37#endif