pmlpp/mlpp/bernoulli_nb/bernoulli_nb.h

42 lines
798 B
C
Raw Normal View History

2023-01-24 18:57:18 +01:00
#ifndef MLPP_BERNOULLI_NB_H
#define MLPP_BERNOULLI_NB_H
//
// BernoulliNB.hpp
//
// Created by Marc Melikyan on 1/17/21.
//
#include <map>
2023-01-24 19:00:54 +01:00
#include <vector>
namespace MLPP {
class BernoulliNB {
public:
BernoulliNB(std::vector<std::vector<double>> inputSet, std::vector<double> outputSet);
std::vector<double> modelSetTest(std::vector<std::vector<double>> X);
double modelTest(std::vector<double> x);
double score();
private:
void computeVocab();
void computeTheta();
void Evaluate();
// Model Params
double prior_1 = 0;
double prior_0 = 0;
std::vector<std::map<double, int>> theta;
std::vector<double> vocab;
int class_num;
// Datasets
std::vector<std::vector<double>> inputSet;
std::vector<double> outputSet;
std::vector<double> y_hat;
};
2023-01-24 19:00:54 +01:00
#endif /* BernoulliNB_hpp */
}