pmlpp/mlpp/bernoulli_nb/bernoulli_nb.h

47 lines
878 B
C++

#ifndef MLPP_BERNOULLI_NB_H
#define MLPP_BERNOULLI_NB_H
//
// BernoulliNB.hpp
//
// Created by Marc Melikyan on 1/17/21.
//
#include "core/math/math_defs.h"
#include <map>
#include <vector>
class MLPPBernoulliNB {
public:
std::vector<real_t> model_set_test(std::vector<std::vector<real_t>> X);
real_t model_test(std::vector<real_t> x);
real_t score();
MLPPBernoulliNB(std::vector<std::vector<real_t>> p_input_set, std::vector<real_t> p_output_set);
MLPPBernoulliNB();
~MLPPBernoulliNB();
private:
void compute_vocab();
void compute_theta();
void evaluate();
// Model Params
real_t _prior_1;
real_t _prior_0;
std::vector<std::map<real_t, int>> _theta;
std::vector<real_t> _vocab;
int _class_num;
// Datasets
std::vector<std::vector<real_t>> _input_set;
std::vector<real_t> _output_set;
std::vector<real_t> _y_hat;
};
#endif /* BernoulliNB_hpp */