diff options
author | Devtools Arcadia <arcadia-devtools@yandex-team.ru> | 2022-02-07 18:08:42 +0300 |
---|---|---|
committer | Devtools Arcadia <arcadia-devtools@mous.vla.yp-c.yandex.net> | 2022-02-07 18:08:42 +0300 |
commit | 1110808a9d39d4b808aef724c861a2e1a38d2a69 (patch) | |
tree | e26c9fed0de5d9873cce7e00bc214573dc2195b7 /library/cpp/histogram/adaptive/common.cpp | |
download | ydb-1110808a9d39d4b808aef724c861a2e1a38d2a69.tar.gz |
intermediate changes
ref:cde9a383711a11544ce7e107a78147fb96cc4029
Diffstat (limited to 'library/cpp/histogram/adaptive/common.cpp')
-rw-r--r-- | library/cpp/histogram/adaptive/common.cpp | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/library/cpp/histogram/adaptive/common.cpp b/library/cpp/histogram/adaptive/common.cpp new file mode 100644 index 0000000000..afc6322fce --- /dev/null +++ b/library/cpp/histogram/adaptive/common.cpp @@ -0,0 +1,19 @@ +#include "common.h" + +namespace NKiwiAggr { + TWeightedValue CalcDistanceQuality(const TWeightedValue& left, const TWeightedValue& right) { + return TWeightedValue(right.first - left.first, left.first); + } + + TWeightedValue CalcWeightQuality(const TWeightedValue& left, const TWeightedValue& right) { + return TWeightedValue(right.second + left.second, left.first); + } + + TWeightedValue CalcWardQuality(const TWeightedValue& left, const TWeightedValue& right) { + const double N1 = left.second; + const double N2 = right.second; + const double mu1 = left.first; + const double mu2 = right.first; + return TWeightedValue(N1 * N2 / (N1 + N2) * (mu1 - mu2) * (mu1 - mu2), left.first); + } +} |