pmlpp/mlpp/bernoulli_nb/bernoulli_nb.h

55 lines
1.0 KiB
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 "core/containers/hash_map.h"
#include "core/containers/vector.h"
2023-01-27 13:01:16 +01:00
#include "core/math/math_defs.h"
#include "core/object/reference.h"
#include "../lin_alg/mlpp_matrix.h"
#include "../lin_alg/mlpp_vector.h"
2023-01-24 19:00:54 +01:00
class MLPPBernoulliNB : public Reference {
GDCLASS(MLPPBernoulliNB, Reference);
2023-01-24 19:00:54 +01:00
public:
Ref<MLPPVector> model_set_test(const Ref<MLPPMatrix> &X);
real_t model_test(const Ref<MLPPVector> &x);
2023-01-27 13:01:16 +01:00
real_t score();
2023-01-24 19:00:54 +01:00
MLPPBernoulliNB(const Ref<MLPPMatrix> &p_input_set, const Ref<MLPPVector> &p_output_set);
MLPPBernoulliNB();
~MLPPBernoulliNB();
protected:
void compute_vocab();
void compute_theta();
void evaluate();
2023-01-24 19:00:54 +01:00
static void _bind_methods();
2023-01-24 19:00:54 +01:00
// Model Params
real_t _prior_1;
real_t _prior_0;
2023-01-24 19:00:54 +01:00
Vector<HashMap<real_t, int>> _theta;
Ref<MLPPVector> _vocab;
int _class_num;
2023-01-24 19:00:54 +01:00
// Datasets
Ref<MLPPMatrix> _input_set;
Ref<MLPPVector> _output_set;
Ref<MLPPVector> _y_hat;
2023-01-24 19:00:54 +01:00
};
2023-01-24 19:20:18 +01:00
#endif /* BernoulliNB_hpp */