pmlpp/mlpp/multinomial_nb/multinomial_nb.h

40 lines
773 B
C
Raw Normal View History

2023-01-24 18:57:18 +01:00
#ifndef MLPP_MULTINOMIAL_NB_H
#define MLPP_MULTINOMIAL_NB_H
//
// MultinomialNB.hpp
//
// Created by Marc Melikyan on 1/17/21.
//
#include <map>
2023-01-24 19:00:54 +01:00
#include <vector>
2023-01-24 19:20:18 +01:00
2023-01-24 19:00:54 +01:00
class MultinomialNB {
public:
MultinomialNB(std::vector<std::vector<double>> inputSet, std::vector<double> outputSet, int class_num);
std::vector<double> modelSetTest(std::vector<std::vector<double>> X);
double modelTest(std::vector<double> x);
double score();
private:
void computeTheta();
void Evaluate();
// Model Params
std::vector<double> priors;
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 /* MultinomialNB_hpp */