19 XSp2de(
int spIndex1,
int spIndex2);
20 void setHyperparameters(
const nlohmann::json &hyperparameters_)
override;
21 void fitx(torch::Tensor &X, torch::Tensor &y, torch::Tensor &weights_,
const Smoothing_t smoothing);
22 std::vector<double> predict_proba(
const std::vector<int> &instance)
const;
23 std::vector<std::vector<double>> predict_proba(std::vector<std::vector<int>> &test_data)
override;
24 int predict(
const std::vector<int> &instance)
const;
25 std::vector<int> predict(std::vector<std::vector<int>> &test_data)
override;
26 torch::Tensor predict(torch::Tensor &X)
override;
27 torch::Tensor predict_proba(torch::Tensor &X)
override;
29 float score(torch::Tensor &X, torch::Tensor &y)
override;
30 float score(std::vector<std::vector<int>> &X, std::vector<int> &y)
override;
31 std::string to_string()
const;
32 std::vector<std::string> graph(
const std::string &title)
const override {
33 return std::vector<std::string>({title});
36 int getNumberOfNodes()
const override;
37 int getNumberOfEdges()
const override;
38 int getNFeatures()
const;
39 int getClassNumStates()
const override;
40 int getNumberOfStates()
const override;
43 void buildModel(
const torch::Tensor &weights)
override;
44 void trainModel(
const torch::Tensor &weights,
const bayesnet::Smoothing_t smoothing)
override;
47 void addSample(
const std::vector<int> &instance,
double weight);
48 void normalize(std::vector<double> &v)
const;
49 void computeProbabilities();
58 std::vector<int> states_;
59 std::vector<double> classCounts_;
60 std::vector<double> classPriors_;
61 std::vector<double> sp1FeatureCounts_, sp1FeatureProbs_;
62 std::vector<double> sp2FeatureCounts_, sp2FeatureProbs_;
65 std::vector<int> childOffsets_;
69 std::vector<double> childCounts_;
70 std::vector<double> childProbs_;
71 CountingSemaphore &semaphore_;