mirror of
https://github.com/Relintai/pmlpp.git
synced 2024-11-08 13:12:09 +01:00
Fixed crashes and errors.
This commit is contained in:
parent
fe4ac8625c
commit
7b0d147aa3
@ -85,7 +85,9 @@ MLPPBernoulliNB::MLPPBernoulliNB(const Ref<MLPPMatrix> &p_input_set, const Ref<M
|
||||
_prior_1 = 0;
|
||||
_prior_0 = 0;
|
||||
|
||||
_vocab.instance();
|
||||
_y_hat.instance();
|
||||
|
||||
_y_hat->resize(_output_set->size());
|
||||
|
||||
evaluate();
|
||||
@ -157,7 +159,7 @@ void MLPPBernoulliNB::evaluate() {
|
||||
|
||||
Vector<int> found_indices;
|
||||
|
||||
for (int j = 0; j < _input_set->size().y; j++) {
|
||||
for (int j = 0; j < _input_set->size().x; j++) {
|
||||
for (int k = 0; k < _vocab->size(); k++) {
|
||||
if (_input_set->element_get(i, j) == _vocab->element_get(k)) {
|
||||
score_0 += Math::log(static_cast<real_t>(_theta[0][_vocab->element_get(k)]));
|
||||
|
@ -135,7 +135,10 @@ MLPPMultinomialNB::MLPPMultinomialNB(const Ref<MLPPMatrix> &p_input_set, const R
|
||||
_output_set = p_output_set;
|
||||
_class_num = pclass_num;
|
||||
|
||||
_priors.instance();
|
||||
_vocab.instance();
|
||||
_y_hat.instance();
|
||||
|
||||
_y_hat->resize(_output_set->size());
|
||||
|
||||
_initialized = true;
|
||||
|
Loading…
Reference in New Issue
Block a user