aboutsummaryrefslogtreecommitdiffstats
path: root/library/cpp/codecs/greedy_dict/gd_stats.h
diff options
context:
space:
mode:
authorRuslan Kovalev <ruslan.a.kovalev@gmail.com>2022-02-10 16:46:44 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:46:44 +0300
commit59e19371de37995fcb36beb16cd6ec030af960bc (patch)
treefa68e36093ebff8b805462e9e6d331fe9d348214 /library/cpp/codecs/greedy_dict/gd_stats.h
parent89db6fe2fe2c32d2a832ddfeb04e8d078e301084 (diff)
downloadydb-59e19371de37995fcb36beb16cd6ec030af960bc.tar.gz
Restoring authorship annotation for Ruslan Kovalev <ruslan.a.kovalev@gmail.com>. Commit 1 of 2.
Diffstat (limited to 'library/cpp/codecs/greedy_dict/gd_stats.h')
-rw-r--r--library/cpp/codecs/greedy_dict/gd_stats.h38
1 files changed, 19 insertions, 19 deletions
diff --git a/library/cpp/codecs/greedy_dict/gd_stats.h b/library/cpp/codecs/greedy_dict/gd_stats.h
index b63c4c38d2..3c209fc67d 100644
--- a/library/cpp/codecs/greedy_dict/gd_stats.h
+++ b/library/cpp/codecs/greedy_dict/gd_stats.h
@@ -1,10 +1,10 @@
-#pragma once
-
+#pragma once
+
#include <util/generic/ymath.h>
-#include <util/generic/algorithm.h>
-#include <util/generic/yexception.h>
-
-namespace NGreedyDict {
+#include <util/generic/algorithm.h>
+#include <util/generic/yexception.h>
+
+namespace NGreedyDict {
enum EEntryScore {
ES_COUNT,
ES_LEN_COUNT,
@@ -12,33 +12,33 @@ namespace NGreedyDict {
ES_LEN_SIMPLE,
ES_SOLAR
};
-
+
enum EEntryStatTest {
EST_NONE = 0,
EST_SIMPLE_NORM = 2
};
-
+
inline float ModelP(ui32 countA, ui32 countB, ui32 total) {
return float(countA) * countB / total / total;
}
-
+
// P (ab | dependent)
inline float SimpleTest(float modelp, ui32 countAB, ui32 total) {
float realp = float(countAB) / total;
return modelp >= realp ? 0 : (realp - modelp);
}
-
+
inline float SolarTest(float modelp, ui32 countAB, ui32 total) {
float realp = float(countAB) / total;
return modelp >= realp ? 0 : (modelp + realp * (log(realp / modelp) - 1));
}
-
+
// P (ab | dependent) / P (ab)
inline float SimpleTestNorm(float modelp, ui32 countAB, ui32 total) {
float realp = float(countAB) / total;
return modelp >= realp ? 0 : (realp - modelp) / realp;
}
-
+
inline float StatTest(EEntryStatTest test, float modelp, ui32 countAB, ui32 total) {
if (!total) {
return 0;
@@ -50,9 +50,9 @@ namespace NGreedyDict {
return SimpleTestNorm(modelp, countAB, total);
}
Y_FAIL("no way!");
- return 0;
- }
-
+ return 0;
+ }
+
inline float Score(EEntryScore score, ui32 len, float modelp, ui32 count, ui32 total) {
if (!total) {
return 0;
@@ -73,7 +73,7 @@ namespace NGreedyDict {
return SolarTest(modelp, count, total);
}
Y_FAIL("no way!");
- return 0;
- }
-
-}
+ return 0;
+ }
+
+}