mirror of
https://github.com/Doctorado-ML/bayesclass.git
synced 2025-08-15 23:55:57 +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]) {
|
||||
auto p_l_f = jointCount / count;
|
||||
if (p_l_f > 0) {
|
||||
double epsilon = 1e-9;
|
||||
if (nat)
|
||||
entropy_f -= p_l_f * log(p_l_f + epsilon);
|
||||
entropy_f -= p_l_f * log(p_l_f);
|
||||
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;
|
||||
|
@@ -5,7 +5,7 @@
|
||||
#include <string>
|
||||
using namespace std;
|
||||
namespace features {
|
||||
typedef double precision_t;
|
||||
typedef float precision_t;
|
||||
typedef int value_t;
|
||||
typedef vector<value_t> sample_t;
|
||||
typedef vector<sample_t> samples_t;
|
||||
|
Reference in New Issue
Block a user