diff options
author | svirg <svirg@yandex-team.ru> | 2022-02-10 16:50:56 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:50:56 +0300 |
commit | d7b26a7860e235a7b00891e1ffbc256c7c976f7d (patch) | |
tree | 5d5cb817648f650d76cf1076100726fd9b8448e8 /library/cpp/histogram | |
parent | 6b417b6bdff55c365f5835bb18c5a8053b975801 (diff) | |
download | ydb-d7b26a7860e235a7b00891e1ffbc256c7c976f7d.tar.gz |
Restoring authorship annotation for <svirg@yandex-team.ru>. Commit 2 of 2.
Diffstat (limited to 'library/cpp/histogram')
-rw-r--r-- | library/cpp/histogram/adaptive/adaptive_histogram.cpp | 114 | ||||
-rw-r--r-- | library/cpp/histogram/adaptive/adaptive_histogram.h | 8 | ||||
-rw-r--r-- | library/cpp/histogram/adaptive/auto_histogram.h | 20 | ||||
-rw-r--r-- | library/cpp/histogram/adaptive/block_histogram.cpp | 452 | ||||
-rw-r--r-- | library/cpp/histogram/adaptive/block_histogram.h | 132 | ||||
-rw-r--r-- | library/cpp/histogram/adaptive/common.cpp | 34 | ||||
-rw-r--r-- | library/cpp/histogram/adaptive/common.h | 20 | ||||
-rw-r--r-- | library/cpp/histogram/adaptive/fixed_bin_histogram.cpp | 8 | ||||
-rw-r--r-- | library/cpp/histogram/adaptive/fixed_bin_histogram.h | 2 | ||||
-rw-r--r-- | library/cpp/histogram/adaptive/histogram.h | 2 | ||||
-rw-r--r-- | library/cpp/histogram/adaptive/protos/histo.proto | 2 | ||||
-rw-r--r-- | library/cpp/histogram/adaptive/ya.make | 12 |
12 files changed, 403 insertions, 403 deletions
diff --git a/library/cpp/histogram/adaptive/adaptive_histogram.cpp b/library/cpp/histogram/adaptive/adaptive_histogram.cpp index d5d2f0c80a..cbfc494021 100644 --- a/library/cpp/histogram/adaptive/adaptive_histogram.cpp +++ b/library/cpp/histogram/adaptive/adaptive_histogram.cpp @@ -17,13 +17,13 @@ namespace NKiwiAggr { } TAdaptiveHistogram::TAdaptiveHistogram(const THistogram& histo, size_t defaultIntervals, ui64 defaultId, TQualityFunction qualityFunc) - : TAdaptiveHistogram(defaultIntervals, defaultId, qualityFunc) + : TAdaptiveHistogram(defaultIntervals, defaultId, qualityFunc) { FromProto(histo); } TAdaptiveHistogram::TAdaptiveHistogram(IHistogram* histo, size_t defaultIntervals, ui64 defaultId, TQualityFunction qualityFunc) - : TAdaptiveHistogram(defaultIntervals, defaultId, qualityFunc) + : TAdaptiveHistogram(defaultIntervals, defaultId, qualityFunc) { TAdaptiveHistogram* adaptiveHisto = dynamic_cast<TAdaptiveHistogram*>(histo); if (!adaptiveHisto) { @@ -42,7 +42,7 @@ namespace NKiwiAggr { } } - TQualityFunction TAdaptiveHistogram::GetQualityFunc() { + TQualityFunction TAdaptiveHistogram::GetQualityFunc() { return CalcQuality; } @@ -67,58 +67,58 @@ namespace NKiwiAggr { PrecomputedBins.clear(); } - void TAdaptiveHistogram::Merge(const THistogram& histo, double multiplier) { - if (!IsValidFloat(histo.GetMinValue()) || !IsValidFloat(histo.GetMaxValue())) { + void TAdaptiveHistogram::Merge(const THistogram& histo, double multiplier) { + if (!IsValidFloat(histo.GetMinValue()) || !IsValidFloat(histo.GetMaxValue())) { fprintf(stderr, "Merging in histogram id %lu: skip bad histo with minvalue %f maxvalue %f\n", Id, histo.GetMinValue(), histo.GetMaxValue()); - return; - } - if (histo.FreqSize() == 0) { - return; // skip empty histos - } - if (histo.GetType() == HT_ADAPTIVE_DISTANCE_HISTOGRAM || - histo.GetType() == HT_ADAPTIVE_WEIGHT_HISTOGRAM || - histo.GetType() == HT_ADAPTIVE_WARD_HISTOGRAM || + return; + } + if (histo.FreqSize() == 0) { + return; // skip empty histos + } + if (histo.GetType() == HT_ADAPTIVE_DISTANCE_HISTOGRAM || + histo.GetType() == HT_ADAPTIVE_WEIGHT_HISTOGRAM || + histo.GetType() == HT_ADAPTIVE_WARD_HISTOGRAM || histo.GetType() == HT_ADAPTIVE_HISTOGRAM) { Y_VERIFY(histo.FreqSize() == histo.PositionSize(), "Corrupted histo"); - for (size_t j = 0; j < histo.FreqSize(); ++j) { - double value = histo.GetPosition(j); - double weight = histo.GetFreq(j); - if (!IsValidFloat(value) || !IsValidFloat(weight)) { + for (size_t j = 0; j < histo.FreqSize(); ++j) { + double value = histo.GetPosition(j); + double weight = histo.GetFreq(j); + if (!IsValidFloat(value) || !IsValidFloat(weight)) { fprintf(stderr, "Merging in histogram id %lu: skip bad value %f weight %f\n", Id, value, weight); - continue; + continue; } - Add(value, weight * multiplier); - } - - MinValue = Min(MinValue, histo.GetMinValue()); - MaxValue = Max(MaxValue, histo.GetMaxValue()); - } else if (histo.GetType() == HT_FIXED_BIN_HISTOGRAM) { - double pos = histo.GetMinValue() + histo.GetBinRange() / 2.0; - for (size_t j = 0; j < histo.FreqSize(); ++j) { - double weight = histo.GetFreq(j); - if (!IsValidFloat(pos) || !IsValidFloat(weight)) { + Add(value, weight * multiplier); + } + + MinValue = Min(MinValue, histo.GetMinValue()); + MaxValue = Max(MaxValue, histo.GetMaxValue()); + } else if (histo.GetType() == HT_FIXED_BIN_HISTOGRAM) { + double pos = histo.GetMinValue() + histo.GetBinRange() / 2.0; + for (size_t j = 0; j < histo.FreqSize(); ++j) { + double weight = histo.GetFreq(j); + if (!IsValidFloat(pos) || !IsValidFloat(weight)) { fprintf(stderr, "Merging in histogram id %lu: skip bad value %f weight %f\n", Id, pos, weight); pos += histo.GetBinRange(); - continue; + continue; } - Add(pos, weight * multiplier); - pos += histo.GetBinRange(); - } + Add(pos, weight * multiplier); + pos += histo.GetBinRange(); + } - MinValue = Min(MinValue, histo.GetMinValue()); - MaxValue = Max(MaxValue, histo.GetMaxValue()); - } else { - ythrow yexception() << "Unknown THistogram type"; + MinValue = Min(MinValue, histo.GetMinValue()); + MaxValue = Max(MaxValue, histo.GetMaxValue()); + } else { + ythrow yexception() << "Unknown THistogram type"; } } void TAdaptiveHistogram::Merge(const TVector<THistogram>& histogramsToMerge) { - for (size_t i = 0; i < histogramsToMerge.size(); ++i) { - Merge(histogramsToMerge[i], 1.0); - } - } - + for (size_t i = 0; i < histogramsToMerge.size(); ++i) { + Merge(histogramsToMerge[i], 1.0); + } + } + void TAdaptiveHistogram::Merge(TVector<IHistogramPtr> histogramsToMerge) { TVector<IHistogramPtr> histogramsToMergeRepacked(0); TVector<TAdaptiveHistogram*> histograms(0); @@ -182,19 +182,19 @@ namespace NKiwiAggr { void TAdaptiveHistogram::FromProto(const THistogram& histo) { Y_VERIFY(histo.HasType(), "Attempt to parse TAdaptiveHistogram from THistogram protobuf with no Type field set"); ; - switch (histo.GetType()) { // check that histogram type could be deduced - case HT_ADAPTIVE_DISTANCE_HISTOGRAM: - case HT_ADAPTIVE_WEIGHT_HISTOGRAM: - case HT_ADAPTIVE_WARD_HISTOGRAM: - break; // ok - case HT_ADAPTIVE_HISTOGRAM: + switch (histo.GetType()) { // check that histogram type could be deduced + case HT_ADAPTIVE_DISTANCE_HISTOGRAM: + case HT_ADAPTIVE_WEIGHT_HISTOGRAM: + case HT_ADAPTIVE_WARD_HISTOGRAM: + break; // ok + case HT_ADAPTIVE_HISTOGRAM: if (CalcQuality != nullptr) - break; // ok + break; // ok [[fallthrough]]; default: // not ok - ythrow yexception() << "Attempt to parse TAdaptiveHistogram from THistogram protobuf record of type = " << (ui32)histo.GetType(); + ythrow yexception() << "Attempt to parse TAdaptiveHistogram from THistogram protobuf record of type = " << (ui32)histo.GetType(); } - + if (histo.FreqSize() != histo.PositionSize()) { ythrow yexception() << "Attempt to parse TAdaptiveHistogram from THistogram protobuf record where FreqSize != PositionSize. FreqSize == " << (ui32)histo.FreqSize() << ", PositionSize == " << (ui32)histo.PositionSize(); } @@ -203,8 +203,8 @@ namespace NKiwiAggr { CalcQuality = CalcDistanceQuality; } else if (histo.GetType() == HT_ADAPTIVE_WEIGHT_HISTOGRAM) { CalcQuality = CalcWeightQuality; - } else if (histo.GetType() == HT_ADAPTIVE_WARD_HISTOGRAM) { - CalcQuality = CalcWardQuality; + } else if (histo.GetType() == HT_ADAPTIVE_WARD_HISTOGRAM) { + CalcQuality = CalcWardQuality; } else { ythrow yexception() << "Attempt to parse an HT_ADAPTIVE_HISTOGRAM without default quality function"; } @@ -236,8 +236,8 @@ namespace NKiwiAggr { histo.SetType(HT_ADAPTIVE_DISTANCE_HISTOGRAM); } else if (CalcQuality == CalcWeightQuality) { histo.SetType(HT_ADAPTIVE_WEIGHT_HISTOGRAM); - } else if (CalcQuality == CalcWardQuality) { - histo.SetType(HT_ADAPTIVE_WARD_HISTOGRAM); + } else if (CalcQuality == CalcWardQuality) { + histo.SetType(HT_ADAPTIVE_WARD_HISTOGRAM); } else { histo.SetType(HT_ADAPTIVE_HISTOGRAM); } @@ -448,9 +448,9 @@ namespace NKiwiAggr { if (!histo) { ythrow yexception() << "Attempt to create TAdaptiveHistogram from a NULL pointer"; } - if (CalcQuality == CalcWardQuality) { - ythrow yexception() << "Not implemented"; - } else if (CalcQuality != CalcDistanceQuality && CalcQuality != CalcWeightQuality) { + if (CalcQuality == CalcWardQuality) { + ythrow yexception() << "Not implemented"; + } else if (CalcQuality != CalcDistanceQuality && CalcQuality != CalcWeightQuality) { ythrow yexception() << "Attempt to create TAdaptiveHistogram from a pointer without default CalcQuality"; } Id = histo->GetId(); diff --git a/library/cpp/histogram/adaptive/adaptive_histogram.h b/library/cpp/histogram/adaptive/adaptive_histogram.h index b8323890d0..fa8f48433f 100644 --- a/library/cpp/histogram/adaptive/adaptive_histogram.h +++ b/library/cpp/histogram/adaptive/adaptive_histogram.h @@ -1,7 +1,7 @@ #pragma once #include "histogram.h" -#include "common.h" +#include "common.h" #include <library/cpp/histogram/adaptive/protos/histo.pb.h> @@ -124,8 +124,8 @@ namespace NKiwiAggr { } }; - typedef TDefinedAdaptiveHistogram<CalcDistanceQuality> TAdaptiveDistanceHistogram; - typedef TDefinedAdaptiveHistogram<CalcWeightQuality> TAdaptiveWeightHistogram; - typedef TDefinedAdaptiveHistogram<CalcWardQuality> TAdaptiveWardHistogram; + typedef TDefinedAdaptiveHistogram<CalcDistanceQuality> TAdaptiveDistanceHistogram; + typedef TDefinedAdaptiveHistogram<CalcWeightQuality> TAdaptiveWeightHistogram; + typedef TDefinedAdaptiveHistogram<CalcWardQuality> TAdaptiveWardHistogram; } diff --git a/library/cpp/histogram/adaptive/auto_histogram.h b/library/cpp/histogram/adaptive/auto_histogram.h index be21c39b19..9fdf0b9abe 100644 --- a/library/cpp/histogram/adaptive/auto_histogram.h +++ b/library/cpp/histogram/adaptive/auto_histogram.h @@ -54,10 +54,10 @@ namespace NKiwiAggr { HistogramImpl->Add(histoRec); } - virtual void Merge(const THistogram& histo, double multiplier) { - HistogramImpl->Merge(histo, multiplier); - } - + virtual void Merge(const THistogram& histo, double multiplier) { + HistogramImpl->Merge(histo, multiplier); + } + virtual void Merge(const TVector<THistogram>& histogramsToMerge) { HistogramImpl->Merge(histogramsToMerge); } @@ -73,14 +73,14 @@ namespace NKiwiAggr { virtual void FromProto(const THistogram& histo) { if (!histo.HasType() || histo.GetType() == HT_FIXED_BIN_HISTOGRAM) { HistogramImpl.Reset(new TFixedBinHistogram(histo, Intervals, Id)); - } else if (histo.GetType() == HT_ADAPTIVE_DISTANCE_HISTOGRAM) { + } else if (histo.GetType() == HT_ADAPTIVE_DISTANCE_HISTOGRAM) { HistogramImpl.Reset(new TAdaptiveDistanceHistogram(histo, Intervals, Id)); - } else if (histo.GetType() == HT_ADAPTIVE_WEIGHT_HISTOGRAM) { + } else if (histo.GetType() == HT_ADAPTIVE_WEIGHT_HISTOGRAM) { HistogramImpl.Reset(new TAdaptiveWeightHistogram(histo, Intervals, Id)); - } else if (histo.GetType() == HT_ADAPTIVE_WARD_HISTOGRAM) { - HistogramImpl.Reset(new TAdaptiveWardHistogram(histo, Intervals, Id)); - } else { - ythrow yexception() << "Can't parse TAutoHistogram from a THistogram of type " << (ui32)histo.GetType(); + } else if (histo.GetType() == HT_ADAPTIVE_WARD_HISTOGRAM) { + HistogramImpl.Reset(new TAdaptiveWardHistogram(histo, Intervals, Id)); + } else { + ythrow yexception() << "Can't parse TAutoHistogram from a THistogram of type " << (ui32)histo.GetType(); } } diff --git a/library/cpp/histogram/adaptive/block_histogram.cpp b/library/cpp/histogram/adaptive/block_histogram.cpp index 5f6063593f..6586d13ff6 100644 --- a/library/cpp/histogram/adaptive/block_histogram.cpp +++ b/library/cpp/histogram/adaptive/block_histogram.cpp @@ -1,4 +1,4 @@ -#include "block_histogram.h" +#include "block_histogram.h" #include <library/cpp/histogram/adaptive/protos/histo.pb.h> @@ -6,7 +6,7 @@ #include <util/generic/yexception.h> #include <util/generic/intrlist.h> #include <util/generic/ptr.h> -#include <util/generic/queue.h> +#include <util/generic/queue.h> #include <util/generic/ymath.h> #include <util/string/printf.h> @@ -77,15 +77,15 @@ namespace { } namespace NKiwiAggr { - /////////////////// - // TBlockHistogram - /////////////////// + /////////////////// + // TBlockHistogram + /////////////////// - TBlockHistogram::TBlockHistogram(EHistogramType type, TQualityFunction calcQuality, + TBlockHistogram::TBlockHistogram(EHistogramType type, TQualityFunction calcQuality, size_t intervals, ui64 id, size_t shrinkSize) - : Type(type) - , CalcQuality(calcQuality) - , Intervals(intervals) + : Type(type) + , CalcQuality(calcQuality) + , Intervals(intervals) , ShrinkSize(shrinkSize) , PrevSize(0) , Id(id) @@ -96,7 +96,7 @@ namespace NKiwiAggr { CorrectShrinkSize(); } - void TBlockHistogram::Clear() { + void TBlockHistogram::Clear() { PrevSize = 0; Sum = 0.0; MinValue = 0.0; @@ -104,13 +104,13 @@ namespace NKiwiAggr { Bins.clear(); } - void TBlockHistogram::Add(const THistoRec& rec) { + void TBlockHistogram::Add(const THistoRec& rec) { if (!rec.HasId() || rec.GetId() == Id) { Add(rec.GetValue(), rec.GetWeight()); } } - void TBlockHistogram::Add(double value, double weight) { + void TBlockHistogram::Add(double value, double weight) { if (!IsValidFloat(value) || !IsValidFloat(weight)) { ythrow yexception() << Sprintf("Histogram id %lu: bad value %f weight %f", Id, value, weight); } @@ -122,9 +122,9 @@ namespace NKiwiAggr { if (Bins.empty()) { MinValue = value; MaxValue = value; - } else { - MinValue = Min(MinValue, value); - MaxValue = Max(MaxValue, value); + } else { + MinValue = Min(MinValue, value); + MaxValue = Max(MaxValue, value); } Sum += weight; @@ -136,64 +136,64 @@ namespace NKiwiAggr { Bins.push_back(TWeightedValue(value, weight)); } - void TBlockHistogram::Merge(const THistogram& histo, double multiplier) { - if (!IsValidFloat(histo.GetMinValue()) || !IsValidFloat(histo.GetMaxValue())) { + void TBlockHistogram::Merge(const THistogram& histo, double multiplier) { + if (!IsValidFloat(histo.GetMinValue()) || !IsValidFloat(histo.GetMaxValue())) { fprintf(stderr, "Merging in histogram id %lu: skip bad histo with minvalue %f maxvalue %f\n", Id, histo.GetMinValue(), histo.GetMaxValue()); - return; - } - if (histo.FreqSize() == 0) { - return; // skip empty histos - } - if (histo.GetType() == HT_ADAPTIVE_DISTANCE_HISTOGRAM || - histo.GetType() == HT_ADAPTIVE_WEIGHT_HISTOGRAM || - histo.GetType() == HT_ADAPTIVE_WARD_HISTOGRAM || + return; + } + if (histo.FreqSize() == 0) { + return; // skip empty histos + } + if (histo.GetType() == HT_ADAPTIVE_DISTANCE_HISTOGRAM || + histo.GetType() == HT_ADAPTIVE_WEIGHT_HISTOGRAM || + histo.GetType() == HT_ADAPTIVE_WARD_HISTOGRAM || histo.GetType() == HT_ADAPTIVE_HISTOGRAM) { Y_VERIFY(histo.FreqSize() == histo.PositionSize(), "Corrupted histo"); - for (size_t j = 0; j < histo.FreqSize(); ++j) { - double value = histo.GetPosition(j); - double weight = histo.GetFreq(j); - if (!IsValidFloat(value) || !IsValidFloat(weight)) { + for (size_t j = 0; j < histo.FreqSize(); ++j) { + double value = histo.GetPosition(j); + double weight = histo.GetFreq(j); + if (!IsValidFloat(value) || !IsValidFloat(weight)) { fprintf(stderr, "Merging in histogram id %lu: skip bad value %f weight %f\n", Id, value, weight); - continue; + continue; } - Add(value, weight * multiplier); - } - - MinValue = Min(MinValue, histo.GetMinValue()); - MaxValue = Max(MaxValue, histo.GetMaxValue()); - } else if (histo.GetType() == HT_FIXED_BIN_HISTOGRAM) { - double pos = histo.GetMinValue() + histo.GetBinRange() / 2.0; - for (size_t j = 0; j < histo.FreqSize(); ++j) { - double weight = histo.GetFreq(j); - if (!IsValidFloat(pos) || !IsValidFloat(weight)) { + Add(value, weight * multiplier); + } + + MinValue = Min(MinValue, histo.GetMinValue()); + MaxValue = Max(MaxValue, histo.GetMaxValue()); + } else if (histo.GetType() == HT_FIXED_BIN_HISTOGRAM) { + double pos = histo.GetMinValue() + histo.GetBinRange() / 2.0; + for (size_t j = 0; j < histo.FreqSize(); ++j) { + double weight = histo.GetFreq(j); + if (!IsValidFloat(pos) || !IsValidFloat(weight)) { fprintf(stderr, "Merging in histogram id %lu: skip bad value %f weight %f\n", Id, pos, weight); pos += histo.GetBinRange(); - continue; + continue; } - Add(pos, weight * multiplier); - pos += histo.GetBinRange(); - } + Add(pos, weight * multiplier); + pos += histo.GetBinRange(); + } - MinValue = Min(MinValue, histo.GetMinValue()); - MaxValue = Max(MaxValue, histo.GetMaxValue()); - } else { - ythrow yexception() << "Unknown THistogram type"; + MinValue = Min(MinValue, histo.GetMinValue()); + MaxValue = Max(MaxValue, histo.GetMaxValue()); + } else { + ythrow yexception() << "Unknown THistogram type"; } } void TBlockHistogram::Merge(const TVector<THistogram>& histogramsToMerge) { - for (size_t i = 0; i < histogramsToMerge.size(); ++i) { - Merge(histogramsToMerge[i], 1.0); - } - } - + for (size_t i = 0; i < histogramsToMerge.size(); ++i) { + Merge(histogramsToMerge[i], 1.0); + } + } + void TBlockHistogram::Merge(TVector<IHistogramPtr> histogramsToMerge) { Y_UNUSED(histogramsToMerge); ythrow yexception() << "IHistogram::Merge(TVector<IHistogramPtr>) is not defined for TBlockHistogram"; } - void TBlockHistogram::Multiply(double factor) { + void TBlockHistogram::Multiply(double factor) { if (!IsValidFloat(factor) || factor <= 0) { ythrow yexception() << "Not valid factor in IHistogram::Multiply(): " << factor; } @@ -203,21 +203,21 @@ namespace NKiwiAggr { } } - void TBlockHistogram::FromProto(const THistogram& histo) { + void TBlockHistogram::FromProto(const THistogram& histo) { Y_VERIFY(histo.HasType(), "Attempt to parse TBlockHistogram from THistogram protobuf with no Type field set"); ; - switch (histo.GetType()) { // check that histogram type is correct - case HT_ADAPTIVE_DISTANCE_HISTOGRAM: - case HT_ADAPTIVE_WEIGHT_HISTOGRAM: - case HT_ADAPTIVE_WARD_HISTOGRAM: - case HT_ADAPTIVE_HISTOGRAM: - break; // ok + switch (histo.GetType()) { // check that histogram type is correct + case HT_ADAPTIVE_DISTANCE_HISTOGRAM: + case HT_ADAPTIVE_WEIGHT_HISTOGRAM: + case HT_ADAPTIVE_WARD_HISTOGRAM: + case HT_ADAPTIVE_HISTOGRAM: + break; // ok default: // not ok - ythrow yexception() << "Attempt to parse TBlockHistogram from THistogram protobuf record of type = " << (ui32)histo.GetType(); + ythrow yexception() << "Attempt to parse TBlockHistogram from THistogram protobuf record of type = " << (ui32)histo.GetType(); } - + if (histo.FreqSize() != histo.PositionSize()) { - ythrow yexception() << "Attempt to parse TBlockHistogram from THistogram protobuf record where FreqSize != PositionSize. FreqSize == " << (ui32)histo.FreqSize() << ", PositionSize == " << (ui32)histo.PositionSize(); + ythrow yexception() << "Attempt to parse TBlockHistogram from THistogram protobuf record where FreqSize != PositionSize. FreqSize == " << (ui32)histo.FreqSize() << ", PositionSize == " << (ui32)histo.PositionSize(); } Id = histo.GetId(); Sum = 0; @@ -244,9 +244,9 @@ namespace NKiwiAggr { MaxValue = histo.GetMaxValue(); } - void TBlockHistogram::ToProto(THistogram& histo) { + void TBlockHistogram::ToProto(THistogram& histo) { histo.Clear(); - histo.SetType(Type); + histo.SetType(Type); histo.SetId(Id); if (Empty()) { return; @@ -269,23 +269,23 @@ namespace NKiwiAggr { return Id; } - bool TBlockHistogram::Empty() { + bool TBlockHistogram::Empty() { return Bins.empty(); } - double TBlockHistogram::GetMinValue() { + double TBlockHistogram::GetMinValue() { return MinValue; } - double TBlockHistogram::GetMaxValue() { + double TBlockHistogram::GetMaxValue() { return MaxValue; } - double TBlockHistogram::GetSum() { + double TBlockHistogram::GetSum() { return Sum; } - void TBlockHistogram::SortAndShrink(size_t intervals, bool final) { + void TBlockHistogram::SortAndShrink(size_t intervals, bool final) { Y_VERIFY(intervals > 0); if (Bins.size() <= intervals) { @@ -294,7 +294,7 @@ namespace NKiwiAggr { if (Bins.size() >= Intervals * GREEDY_SHRINK_MULTIPLIER) { SortBins(); - UniquifyBins(); + UniquifyBins(); FastGreedyShrink(intervals); if (final) { @@ -303,12 +303,12 @@ namespace NKiwiAggr { } else { SortBins(); - UniquifyBins(); + UniquifyBins(); SlowShrink(intervals); } } - void TBlockHistogram::SortBins() { + void TBlockHistogram::SortBins() { Sort(Bins.begin() + PrevSize, Bins.end()); if (PrevSize != 0) { TVector<TWeightedValue> temp(Bins.begin(), Bins.begin() + PrevSize); @@ -316,28 +316,28 @@ namespace NKiwiAggr { } } - void TBlockHistogram::UniquifyBins() { - if (Bins.empty()) + void TBlockHistogram::UniquifyBins() { + if (Bins.empty()) return; - auto it1 = Bins.begin(); - auto it2 = Bins.begin(); - while (++it2 != Bins.end()) { - if (it1->first == it2->first) { - it1->second += it2->second; - } else { - *(++it1) = *it2; + auto it1 = Bins.begin(); + auto it2 = Bins.begin(); + while (++it2 != Bins.end()) { + if (it1->first == it2->first) { + it1->second += it2->second; + } else { + *(++it1) = *it2; } } - Bins.erase(++it1, Bins.end()); + Bins.erase(++it1, Bins.end()); } - void TBlockHistogram::CorrectShrinkSize() { - ShrinkSize = Max(ShrinkSize, Intervals * (SHRINK_MULTIPLIER + GREEDY_SHRINK_MULTIPLIER)); - } - - void TBlockHistogram::SlowShrink(size_t intervals) { + void TBlockHistogram::CorrectShrinkSize() { + ShrinkSize = Max(ShrinkSize, Intervals * (SHRINK_MULTIPLIER + GREEDY_SHRINK_MULTIPLIER)); + } + + void TBlockHistogram::SlowShrink(size_t intervals) { { size_t pos = 0; for (size_t i = 1; i < Bins.size(); ++i) @@ -370,7 +370,7 @@ namespace NKiwiAggr { TVector<double> pairWeights(n); for (ui32 i = 0; i < n; ++i) { - pairWeights[i] = CalcQuality(Bins[i], Bins[i + 1]).first; + pairWeights[i] = CalcQuality(Bins[i], Bins[i + 1]).first; } TSmartHeap heap(pairWeights); @@ -392,12 +392,12 @@ namespace NKiwiAggr { Bins[b].second = -1; if (a != end) { - pairWeights[a] = CalcQuality(Bins[a], Bins[c]).first; + pairWeights[a] = CalcQuality(Bins[a], Bins[c]).first; heap.DownElement(a); } if (d != end && c + 1 != Bins.size()) { - pairWeights[c] = CalcQuality(Bins[c], Bins[d]).first; + pairWeights[c] = CalcQuality(Bins[c], Bins[d]).first; heap.DownElement(c); } @@ -414,34 +414,34 @@ namespace NKiwiAggr { Y_VERIFY(pos == intervals); } - double TBlockHistogram::GetSumInRange(double leftBound, double rightBound) { + double TBlockHistogram::GetSumInRange(double leftBound, double rightBound) { Y_UNUSED(leftBound); Y_UNUSED(rightBound); - ythrow yexception() << "Method is not implemented for TBlockHistogram"; + ythrow yexception() << "Method is not implemented for TBlockHistogram"; return 0; } - double TBlockHistogram::GetSumAboveBound(double bound) { + double TBlockHistogram::GetSumAboveBound(double bound) { Y_UNUSED(bound); - ythrow yexception() << "Method is not implemented for TBlockHistogram"; + ythrow yexception() << "Method is not implemented for TBlockHistogram"; return 0; } - double TBlockHistogram::GetSumBelowBound(double bound) { + double TBlockHistogram::GetSumBelowBound(double bound) { Y_UNUSED(bound); - ythrow yexception() << "Method is not implemented for TBlockHistogram"; + ythrow yexception() << "Method is not implemented for TBlockHistogram"; return 0; } - double TBlockHistogram::CalcUpperBound(double sum) { + double TBlockHistogram::CalcUpperBound(double sum) { Y_UNUSED(sum); - ythrow yexception() << "Method is not implemented for TBlockHistogram"; + ythrow yexception() << "Method is not implemented for TBlockHistogram"; return 0; } - double TBlockHistogram::CalcLowerBound(double sum) { + double TBlockHistogram::CalcLowerBound(double sum) { Y_UNUSED(sum); - ythrow yexception() << "Method is not implemented for TBlockHistogram"; + ythrow yexception() << "Method is not implemented for TBlockHistogram"; return 0; } @@ -450,144 +450,144 @@ namespace NKiwiAggr { ythrow yexception() << "Method is not implemented for TBlockHistogram"; return 0; } - + double TBlockHistogram::CalcLowerBoundSafe(double sum) { Y_UNUSED(sum); ythrow yexception() << "Method is not implemented for TBlockHistogram"; return 0; } - ///////////////////////// - // TBlockWeightHistogram - ///////////////////////// - + ///////////////////////// + // TBlockWeightHistogram + ///////////////////////// + TBlockWeightHistogram::TBlockWeightHistogram(size_t intervals, ui64 id, size_t shrinkSize) - : TBlockHistogram(HT_ADAPTIVE_WEIGHT_HISTOGRAM, CalcWeightQuality, intervals, id, shrinkSize) - { - } - - void TBlockWeightHistogram::FastGreedyShrink(size_t intervals) { - if (Bins.size() <= intervals) - return; - - double slab = Sum / intervals; - - size_t i = 0; - size_t pos = 0; - while (i < Bins.size()) { - double curW = Bins[i].second; - double curMul = Bins[i].first * Bins[i].second; - ++i; - while (i < Bins.size() && curW + Bins[i].second <= slab && pos + Bins.size() - i >= intervals) { - curW += Bins[i].second; - curMul += Bins[i].first * Bins[i].second; - ++i; - } - Bins[pos++] = TWeightedValue(curMul / curW, curW); - } - - Bins.resize(pos); - PrevSize = pos; - } - - /////////////////////// - // TBlockWardHistogram - /////////////////////// - + : TBlockHistogram(HT_ADAPTIVE_WEIGHT_HISTOGRAM, CalcWeightQuality, intervals, id, shrinkSize) + { + } + + void TBlockWeightHistogram::FastGreedyShrink(size_t intervals) { + if (Bins.size() <= intervals) + return; + + double slab = Sum / intervals; + + size_t i = 0; + size_t pos = 0; + while (i < Bins.size()) { + double curW = Bins[i].second; + double curMul = Bins[i].first * Bins[i].second; + ++i; + while (i < Bins.size() && curW + Bins[i].second <= slab && pos + Bins.size() - i >= intervals) { + curW += Bins[i].second; + curMul += Bins[i].first * Bins[i].second; + ++i; + } + Bins[pos++] = TWeightedValue(curMul / curW, curW); + } + + Bins.resize(pos); + PrevSize = pos; + } + + /////////////////////// + // TBlockWardHistogram + /////////////////////// + TBlockWardHistogram::TBlockWardHistogram(size_t intervals, ui64 id, size_t shrinkSize) - : TBlockHistogram(HT_ADAPTIVE_WARD_HISTOGRAM, CalcWardQuality, intervals, id, shrinkSize) + : TBlockHistogram(HT_ADAPTIVE_WARD_HISTOGRAM, CalcWardQuality, intervals, id, shrinkSize) { } - - bool TBlockWardHistogram::CalcSplitInfo( - const TCumulatives::const_iterator beg, - const TCumulatives::const_iterator end, // (!) points to the final element + + bool TBlockWardHistogram::CalcSplitInfo( + const TCumulatives::const_iterator beg, + const TCumulatives::const_iterator end, // (!) points to the final element TSplitInfo& splitInfo // out - ) { - if (end - beg < 2) { - return false; - } - - TCumulatives::const_iterator mid = LowerBound(beg, end + 1, TCumulative{(beg->first + end->first) / 2, 0.}); - - if (mid == beg) { - mid++; - } else if (mid == end) { - mid--; - } - - // derived from Ward's minimum variance criterion - double profit = 0.0; - profit += (mid->second - beg->second) * (mid->second - beg->second) / (mid->first - beg->first); - profit += (end->second - mid->second) * (end->second - mid->second) / (end->first - mid->first); - profit -= (end->second - beg->second) * (end->second - beg->second) / (end->first - beg->first); - - splitInfo = {profit, beg, mid, end}; - - return true; - } - - void TBlockWardHistogram::FastGreedyShrink(size_t intervals) { + ) { + if (end - beg < 2) { + return false; + } + + TCumulatives::const_iterator mid = LowerBound(beg, end + 1, TCumulative{(beg->first + end->first) / 2, 0.}); + + if (mid == beg) { + mid++; + } else if (mid == end) { + mid--; + } + + // derived from Ward's minimum variance criterion + double profit = 0.0; + profit += (mid->second - beg->second) * (mid->second - beg->second) / (mid->first - beg->first); + profit += (end->second - mid->second) * (end->second - mid->second) / (end->first - mid->first); + profit -= (end->second - beg->second) * (end->second - beg->second) / (end->first - beg->first); + + splitInfo = {profit, beg, mid, end}; + + return true; + } + + void TBlockWardHistogram::FastGreedyShrink(size_t intervals) { Y_VERIFY(intervals > 0); - - if (Bins.size() <= intervals) { - return; - } - - // fill cumulative sums - // sum at index i equals to the sum of all values before i - // sum at index i+1 equals to the sum of all values before i with the value at i added - TCumulatives cumulatives; - cumulatives.reserve(Bins.size() + 1); - - TCumulative cumulative = {0., 0.}; - cumulatives.push_back(cumulative); - for (size_t i = 0; i < Bins.size(); i++) { + + if (Bins.size() <= intervals) { + return; + } + + // fill cumulative sums + // sum at index i equals to the sum of all values before i + // sum at index i+1 equals to the sum of all values before i with the value at i added + TCumulatives cumulatives; + cumulatives.reserve(Bins.size() + 1); + + TCumulative cumulative = {0., 0.}; + cumulatives.push_back(cumulative); + for (size_t i = 0; i < Bins.size(); i++) { cumulative.first += Bins[i].second; - cumulative.second += Bins[i].second * Bins[i].first; - cumulatives.push_back(cumulative); - } - + cumulative.second += Bins[i].second * Bins[i].first; + cumulatives.push_back(cumulative); + } + TVector<TCumulatives::const_iterator> splits; - splits.reserve(intervals + 1); - splits.push_back(cumulatives.begin()); - splits.push_back(cumulatives.end() - 1); - + splits.reserve(intervals + 1); + splits.push_back(cumulatives.begin()); + splits.push_back(cumulatives.end() - 1); + TPriorityQueue<TSplitInfo> candidates; - - // explicitly add first split - TSplitInfo newSplitInfo; - if (CalcSplitInfo(cumulatives.begin(), cumulatives.end() - 1, newSplitInfo)) { - candidates.push(newSplitInfo); - } - - // recursively split until done - for (size_t split = 0; split < intervals - 1 && !candidates.empty(); split++) { - TSplitInfo curSplitInfo = candidates.top(); - candidates.pop(); - - splits.push_back(curSplitInfo.mid); - - if (CalcSplitInfo(curSplitInfo.beg, curSplitInfo.mid, newSplitInfo)) { - candidates.push(newSplitInfo); - } - if (CalcSplitInfo(curSplitInfo.mid, curSplitInfo.end, newSplitInfo)) { - candidates.push(newSplitInfo); - } - } - - // calclate new bin centers and weights - Sort(splits.begin(), splits.end()); - - Bins.clear(); - for (auto it = splits.begin(); it + 1 != splits.end(); ++it) { - auto splitBeg = *it; - auto splitEnd = *(it + 1); - double cnt = (splitEnd->first - splitBeg->first); + + // explicitly add first split + TSplitInfo newSplitInfo; + if (CalcSplitInfo(cumulatives.begin(), cumulatives.end() - 1, newSplitInfo)) { + candidates.push(newSplitInfo); + } + + // recursively split until done + for (size_t split = 0; split < intervals - 1 && !candidates.empty(); split++) { + TSplitInfo curSplitInfo = candidates.top(); + candidates.pop(); + + splits.push_back(curSplitInfo.mid); + + if (CalcSplitInfo(curSplitInfo.beg, curSplitInfo.mid, newSplitInfo)) { + candidates.push(newSplitInfo); + } + if (CalcSplitInfo(curSplitInfo.mid, curSplitInfo.end, newSplitInfo)) { + candidates.push(newSplitInfo); + } + } + + // calclate new bin centers and weights + Sort(splits.begin(), splits.end()); + + Bins.clear(); + for (auto it = splits.begin(); it + 1 != splits.end(); ++it) { + auto splitBeg = *it; + auto splitEnd = *(it + 1); + double cnt = (splitEnd->first - splitBeg->first); double mu = (splitEnd->second - splitBeg->second) / cnt; - - Bins.push_back(TWeightedValue(mu, cnt)); - } - } - + + Bins.push_back(TWeightedValue(mu, cnt)); + } + } + } diff --git a/library/cpp/histogram/adaptive/block_histogram.h b/library/cpp/histogram/adaptive/block_histogram.h index a892c3da57..266bb2f2b2 100644 --- a/library/cpp/histogram/adaptive/block_histogram.h +++ b/library/cpp/histogram/adaptive/block_histogram.h @@ -1,7 +1,7 @@ #pragma once #include "histogram.h" -#include "common.h" +#include "common.h" #include <library/cpp/histogram/adaptive/protos/histo.pb.h> @@ -10,31 +10,31 @@ #include <utility> namespace NKiwiAggr { - /////////////////// - // TBlockHistogram - /////////////////// - - /** - * Contrary to adaptive histogram, block histogram doesn't rebuild bins - * after the addition of each point. Instead, it accumulates points and in case the amount - * of points overflows specified limits, it shrinks all the points at once to produce histogram - * Indeed, there exist two limits and two shrinkage operations: - * 1) FastGreedyShrink is fast but coarse. It is used to shrink from upper limit to intermediate limit - * (override FastGreedyShrink to set specific behaviour) - * 2) SlowShrink is slow, but produces finer histogram. It shrinks from the intermediate limit to the - * actual number of bins in a manner similar to that in adaptive histogram (set CalcQuality in constuctor) - * While FastGreedyShrink is used most of the time, SlowShrink is mostly used for histogram finalization - */ - class TBlockHistogram: private TNonCopyable, public IHistogram { - protected: + /////////////////// + // TBlockHistogram + /////////////////// + + /** + * Contrary to adaptive histogram, block histogram doesn't rebuild bins + * after the addition of each point. Instead, it accumulates points and in case the amount + * of points overflows specified limits, it shrinks all the points at once to produce histogram + * Indeed, there exist two limits and two shrinkage operations: + * 1) FastGreedyShrink is fast but coarse. It is used to shrink from upper limit to intermediate limit + * (override FastGreedyShrink to set specific behaviour) + * 2) SlowShrink is slow, but produces finer histogram. It shrinks from the intermediate limit to the + * actual number of bins in a manner similar to that in adaptive histogram (set CalcQuality in constuctor) + * While FastGreedyShrink is used most of the time, SlowShrink is mostly used for histogram finalization + */ + class TBlockHistogram: private TNonCopyable, public IHistogram { + protected: static const size_t SHRINK_MULTIPLIER = 2; static const size_t GREEDY_SHRINK_MULTIPLIER = 4; static const size_t DEFAULT_INTERVALS = 100; - static const size_t DEFAULT_SHRINK_SIZE = DEFAULT_INTERVALS * (SHRINK_MULTIPLIER + GREEDY_SHRINK_MULTIPLIER); + static const size_t DEFAULT_SHRINK_SIZE = DEFAULT_INTERVALS * (SHRINK_MULTIPLIER + GREEDY_SHRINK_MULTIPLIER); const EHistogramType Type; - const TQualityFunction CalcQuality; - + const TQualityFunction CalcQuality; + size_t Intervals; size_t ShrinkSize; size_t PrevSize; @@ -48,7 +48,7 @@ namespace NKiwiAggr { TVector<TWeightedValue> Bins; public: - TBlockHistogram(EHistogramType type, TQualityFunction calcQuality, + TBlockHistogram(EHistogramType type, TQualityFunction calcQuality, size_t intervals, ui64 id = 0, size_t shrinkSize = DEFAULT_SHRINK_SIZE); virtual ~TBlockHistogram() { @@ -59,7 +59,7 @@ namespace NKiwiAggr { virtual void Add(double value, double weight); virtual void Add(const THistoRec& histoRec); - virtual void Merge(const THistogram& histo, double multiplier); + virtual void Merge(const THistogram& histo, double multiplier); virtual void Merge(const TVector<THistogram>& histogramsToMerge); virtual void Merge(TVector<IHistogramPtr> histogramsToMerge); // not implemented @@ -86,63 +86,63 @@ namespace NKiwiAggr { private: void SortBins(); - void UniquifyBins(); + void UniquifyBins(); void CorrectShrinkSize(); void SortAndShrink(size_t intervals, bool final = false); - + void SlowShrink(size_t intervals); - virtual void FastGreedyShrink(size_t intervals) = 0; + virtual void FastGreedyShrink(size_t intervals) = 0; }; - ///////////////////////// - // TBlockWeightHistogram - ///////////////////////// - + ///////////////////////// + // TBlockWeightHistogram + ///////////////////////// + class TBlockWeightHistogram: public TBlockHistogram { - public: + public: TBlockWeightHistogram(size_t intervals, ui64 id = 0, size_t shrinkSize = DEFAULT_SHRINK_SIZE); - + virtual ~TBlockWeightHistogram() { } - - private: - virtual void FastGreedyShrink(size_t intervals) final; - }; - - /////////////////////// - // TBlockWardHistogram - /////////////////////// - + + private: + virtual void FastGreedyShrink(size_t intervals) final; + }; + + /////////////////////// + // TBlockWardHistogram + /////////////////////// + class TBlockWardHistogram: public TBlockHistogram { - public: + public: TBlockWardHistogram(size_t intervals, ui64 id = 0, size_t shrinkSize = DEFAULT_SHRINK_SIZE); - + virtual ~TBlockWardHistogram() { } - - private: + + private: using TCumulative = std::pair<double, double>; // cumulative sum of (weights, weighted centers) using TCumulatives = TVector<TCumulative>; - - struct TSplitInfo { - double profit; - - TCumulatives::const_iterator beg; - TCumulatives::const_iterator mid; - TCumulatives::const_iterator end; - - bool operator<(const TSplitInfo& other) const { - return profit < other.profit; - } - }; - - private: - virtual void FastGreedyShrink(size_t intervals) final; - - static bool CalcSplitInfo(const TCumulatives::const_iterator beg, - const TCumulatives::const_iterator end, - TSplitInfo& splitInfo); - }; - + + struct TSplitInfo { + double profit; + + TCumulatives::const_iterator beg; + TCumulatives::const_iterator mid; + TCumulatives::const_iterator end; + + bool operator<(const TSplitInfo& other) const { + return profit < other.profit; + } + }; + + private: + virtual void FastGreedyShrink(size_t intervals) final; + + static bool CalcSplitInfo(const TCumulatives::const_iterator beg, + const TCumulatives::const_iterator end, + TSplitInfo& splitInfo); + }; + } diff --git a/library/cpp/histogram/adaptive/common.cpp b/library/cpp/histogram/adaptive/common.cpp index 4d90ff1549..afc6322fce 100644 --- a/library/cpp/histogram/adaptive/common.cpp +++ b/library/cpp/histogram/adaptive/common.cpp @@ -1,19 +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) { +#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); - } -} + const double mu1 = left.first; + const double mu2 = right.first; + return TWeightedValue(N1 * N2 / (N1 + N2) * (mu1 - mu2) * (mu1 - mu2), left.first); + } +} diff --git a/library/cpp/histogram/adaptive/common.h b/library/cpp/histogram/adaptive/common.h index 31a5f2d2f8..c0f7dfb26b 100644 --- a/library/cpp/histogram/adaptive/common.h +++ b/library/cpp/histogram/adaptive/common.h @@ -1,12 +1,12 @@ -#pragma once - +#pragma once + #include <utility> - -namespace NKiwiAggr { + +namespace NKiwiAggr { using TWeightedValue = std::pair<double, double>; // value, weight - using TQualityFunction = TWeightedValue (*)(const TWeightedValue&, const TWeightedValue&); - - TWeightedValue CalcDistanceQuality(const TWeightedValue& left, const TWeightedValue& right); - TWeightedValue CalcWeightQuality(const TWeightedValue& left, const TWeightedValue& right); - TWeightedValue CalcWardQuality(const TWeightedValue& left, const TWeightedValue& right); -} + using TQualityFunction = TWeightedValue (*)(const TWeightedValue&, const TWeightedValue&); + + TWeightedValue CalcDistanceQuality(const TWeightedValue& left, const TWeightedValue& right); + TWeightedValue CalcWeightQuality(const TWeightedValue& left, const TWeightedValue& right); + TWeightedValue CalcWardQuality(const TWeightedValue& left, const TWeightedValue& right); +} diff --git a/library/cpp/histogram/adaptive/fixed_bin_histogram.cpp b/library/cpp/histogram/adaptive/fixed_bin_histogram.cpp index 156bc3d1c5..558aba9e2d 100644 --- a/library/cpp/histogram/adaptive/fixed_bin_histogram.cpp +++ b/library/cpp/histogram/adaptive/fixed_bin_histogram.cpp @@ -124,10 +124,10 @@ namespace NKiwiAggr { } } - void TFixedBinHistogram::Merge(const THistogram& /*histo*/, double /*multiplier*/) { - ythrow yexception() << "Method is not implemented for TFixedBinHistogram"; - } - + void TFixedBinHistogram::Merge(const THistogram& /*histo*/, double /*multiplier*/) { + ythrow yexception() << "Method is not implemented for TFixedBinHistogram"; + } + void TFixedBinHistogram::Merge(const TVector<THistogram>& histogramsToMerge) { TVector<IHistogramPtr> parsedHistogramsToMerge; for (size_t i = 0; i < histogramsToMerge.size(); ++i) { diff --git a/library/cpp/histogram/adaptive/fixed_bin_histogram.h b/library/cpp/histogram/adaptive/fixed_bin_histogram.h index c06e892ce9..bd380bd94a 100644 --- a/library/cpp/histogram/adaptive/fixed_bin_histogram.h +++ b/library/cpp/histogram/adaptive/fixed_bin_histogram.h @@ -48,7 +48,7 @@ namespace NKiwiAggr { virtual void Add(double value, double weight); virtual void Add(const THistoRec& histoRec); - virtual void Merge(const THistogram& histo, double multiplier); + virtual void Merge(const THistogram& histo, double multiplier); virtual void Merge(const TVector<THistogram>& histogramsToMerge); virtual void Merge(TVector<IHistogramPtr> histogramsToMerge); diff --git a/library/cpp/histogram/adaptive/histogram.h b/library/cpp/histogram/adaptive/histogram.h index a18e94e5c2..360fd9a693 100644 --- a/library/cpp/histogram/adaptive/histogram.h +++ b/library/cpp/histogram/adaptive/histogram.h @@ -28,7 +28,7 @@ namespace NKiwiAggr { virtual void Add(const THistoRec& histoRec) = 0; // Merge some other histos into current - virtual void Merge(const THistogram& histo, double multiplier) = 0; + virtual void Merge(const THistogram& histo, double multiplier) = 0; virtual void Merge(const TVector<THistogram>& histogramsToMerge) = 0; virtual void Merge(TVector<IHistogramPtr> histogramsToMerge) = 0; diff --git a/library/cpp/histogram/adaptive/protos/histo.proto b/library/cpp/histogram/adaptive/protos/histo.proto index 2999ca72f3..8961fef022 100644 --- a/library/cpp/histogram/adaptive/protos/histo.proto +++ b/library/cpp/histogram/adaptive/protos/histo.proto @@ -17,7 +17,7 @@ enum EHistogramType { HT_ADAPTIVE_DISTANCE_HISTOGRAM = 2; HT_ADAPTIVE_WEIGHT_HISTOGRAM = 3; HT_ADAPTIVE_HISTOGRAM = 4; // if the quality function is unknown - HT_ADAPTIVE_WARD_HISTOGRAM = 5; + HT_ADAPTIVE_WARD_HISTOGRAM = 5; } message THistogram { diff --git a/library/cpp/histogram/adaptive/ya.make b/library/cpp/histogram/adaptive/ya.make index 6bbc8ccb8c..b589801b27 100644 --- a/library/cpp/histogram/adaptive/ya.make +++ b/library/cpp/histogram/adaptive/ya.make @@ -1,14 +1,14 @@ LIBRARY() -OWNER( - zosimov - svirg -) +OWNER( + zosimov + svirg +) SRCS( - common.cpp + common.cpp adaptive_histogram.cpp - block_histogram.cpp + block_histogram.cpp fixed_bin_histogram.cpp ) |