mirror of
https://github.com/Doctorado-ML/bayesclass.git
synced 2025-08-17 00:26:10 +00:00
Remove unneeded small value added to logs
This commit is contained in:
@@ -100,11 +100,10 @@ namespace features {
|
|||||||
for (auto& [label, jointCount] : jointCounts[feat]) {
|
for (auto& [label, jointCount] : jointCounts[feat]) {
|
||||||
auto p_l_f = jointCount / count;
|
auto p_l_f = jointCount / count;
|
||||||
if (p_l_f > 0) {
|
if (p_l_f > 0) {
|
||||||
double epsilon = 1e-9;
|
|
||||||
if (nat)
|
if (nat)
|
||||||
entropy_f -= p_l_f * log(p_l_f + epsilon);
|
entropy_f -= p_l_f * log(p_l_f);
|
||||||
else
|
else
|
||||||
entropy_f -= p_l_f * log2(p_l_f + epsilon);
|
entropy_f -= p_l_f * log2(p_l_f);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
entropy += p_f * entropy_f;
|
entropy += p_f * entropy_f;
|
||||||
|
@@ -5,7 +5,7 @@
|
|||||||
#include <string>
|
#include <string>
|
||||||
using namespace std;
|
using namespace std;
|
||||||
namespace features {
|
namespace features {
|
||||||
typedef double precision_t;
|
typedef float precision_t;
|
||||||
typedef int value_t;
|
typedef int value_t;
|
||||||
typedef vector<value_t> sample_t;
|
typedef vector<value_t> sample_t;
|
||||||
typedef vector<sample_t> samples_t;
|
typedef vector<sample_t> samples_t;
|
||||||
|
Reference in New Issue
Block a user