diff options
author | Vlad Yaroslavlev <vladon@vladon.com> | 2022-02-10 16:46:25 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:46:25 +0300 |
commit | 344ea37b4a345701ab0e67de2266a1c1bd7baf2d (patch) | |
tree | 1a2c5ffcf89eb53ecd79dbc9bc0a195c27404d0c /library/cpp/histogram/adaptive | |
parent | 706b83ed7de5a473436620367af31fc0ceecde07 (diff) | |
download | ydb-344ea37b4a345701ab0e67de2266a1c1bd7baf2d.tar.gz |
Restoring authorship annotation for Vlad Yaroslavlev <vladon@vladon.com>. Commit 2 of 2.
Diffstat (limited to 'library/cpp/histogram/adaptive')
9 files changed, 39 insertions, 39 deletions
diff --git a/library/cpp/histogram/adaptive/adaptive_histogram.cpp b/library/cpp/histogram/adaptive/adaptive_histogram.cpp index 57dec4d608..cbfc494021 100644 --- a/library/cpp/histogram/adaptive/adaptive_histogram.cpp +++ b/library/cpp/histogram/adaptive/adaptive_histogram.cpp @@ -113,15 +113,15 @@ namespace NKiwiAggr { } } - void TAdaptiveHistogram::Merge(const TVector<THistogram>& histogramsToMerge) { + void TAdaptiveHistogram::Merge(const TVector<THistogram>& histogramsToMerge) { 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); + void TAdaptiveHistogram::Merge(TVector<IHistogramPtr> histogramsToMerge) { + TVector<IHistogramPtr> histogramsToMergeRepacked(0); + TVector<TAdaptiveHistogram*> histograms(0); for (size_t i = 0; i < histogramsToMerge.size(); ++i) { if (!histogramsToMerge[i] || histogramsToMerge[i]->Empty()) { continue; diff --git a/library/cpp/histogram/adaptive/adaptive_histogram.h b/library/cpp/histogram/adaptive/adaptive_histogram.h index 3bb921e780..fa8f48433f 100644 --- a/library/cpp/histogram/adaptive/adaptive_histogram.h +++ b/library/cpp/histogram/adaptive/adaptive_histogram.h @@ -15,7 +15,7 @@ namespace NKiwiAggr { static const size_t DEFAULT_INTERVALS = 100; private: - using TPairSet = TSet<TWeightedValue>; + using TPairSet = TSet<TWeightedValue>; struct TFastBin { // these names are for compatibility with TWeightedValue @@ -47,7 +47,7 @@ namespace NKiwiAggr { TPairSet BinsByQuality; TQualityFunction CalcQuality; - TVector<TFastBin> PrecomputedBins; + TVector<TFastBin> PrecomputedBins; public: TAdaptiveHistogram(size_t intervals, ui64 id = 0, TQualityFunction qualityFunc = CalcWeightQuality); diff --git a/library/cpp/histogram/adaptive/auto_histogram.h b/library/cpp/histogram/adaptive/auto_histogram.h index 21efc5cd3a..9fdf0b9abe 100644 --- a/library/cpp/histogram/adaptive/auto_histogram.h +++ b/library/cpp/histogram/adaptive/auto_histogram.h @@ -58,11 +58,11 @@ namespace NKiwiAggr { HistogramImpl->Merge(histo, multiplier); } - virtual void Merge(const TVector<THistogram>& histogramsToMerge) { + virtual void Merge(const TVector<THistogram>& histogramsToMerge) { HistogramImpl->Merge(histogramsToMerge); } - virtual void Merge(TVector<IHistogramPtr> histogramsToMerge) { + virtual void Merge(TVector<IHistogramPtr> histogramsToMerge) { HistogramImpl->Merge(histogramsToMerge); } diff --git a/library/cpp/histogram/adaptive/block_histogram.cpp b/library/cpp/histogram/adaptive/block_histogram.cpp index 51e418405b..6586d13ff6 100644 --- a/library/cpp/histogram/adaptive/block_histogram.cpp +++ b/library/cpp/histogram/adaptive/block_histogram.cpp @@ -16,12 +16,12 @@ namespace { class TSmartHeap { private: - TVector<ui32> A; - TVector<ui32> Pos; - const TVector<double>& Weights; + TVector<ui32> A; + TVector<ui32> Pos; + const TVector<double>& Weights; public: - TSmartHeap(const TVector<double>& weights) + TSmartHeap(const TVector<double>& weights) : A(weights.size()) , Pos(weights.size()) , Weights(weights) @@ -182,7 +182,7 @@ namespace NKiwiAggr { } } - void TBlockHistogram::Merge(const TVector<THistogram>& histogramsToMerge) { + void TBlockHistogram::Merge(const TVector<THistogram>& histogramsToMerge) { for (size_t i = 0; i < histogramsToMerge.size(); ++i) { Merge(histogramsToMerge[i], 1.0); } @@ -190,7 +190,7 @@ namespace NKiwiAggr { void TBlockHistogram::Merge(TVector<IHistogramPtr> histogramsToMerge) { Y_UNUSED(histogramsToMerge); - ythrow yexception() << "IHistogram::Merge(TVector<IHistogramPtr>) is not defined for TBlockHistogram"; + ythrow yexception() << "IHistogram::Merge(TVector<IHistogramPtr>) is not defined for TBlockHistogram"; } void TBlockHistogram::Multiply(double factor) { @@ -198,7 +198,7 @@ namespace NKiwiAggr { ythrow yexception() << "Not valid factor in IHistogram::Multiply(): " << factor; } Sum *= factor; - for (TVector<TWeightedValue>::iterator it = Bins.begin(); it != Bins.end(); ++it) { + for (TVector<TWeightedValue>::iterator it = Bins.begin(); it != Bins.end(); ++it) { it->second *= factor; } } @@ -255,7 +255,7 @@ namespace NKiwiAggr { SortAndShrink(Intervals, true); histo.SetMinValue(MinValue); histo.SetMaxValue(MaxValue); - for (TVector<TWeightedValue>::const_iterator it = Bins.begin(); it != Bins.end(); ++it) { + for (TVector<TWeightedValue>::const_iterator it = Bins.begin(); it != Bins.end(); ++it) { histo.AddFreq(it->second); histo.AddPosition(it->first); } @@ -311,7 +311,7 @@ namespace NKiwiAggr { void TBlockHistogram::SortBins() { Sort(Bins.begin() + PrevSize, Bins.end()); if (PrevSize != 0) { - TVector<TWeightedValue> temp(Bins.begin(), Bins.begin() + PrevSize); + TVector<TWeightedValue> temp(Bins.begin(), Bins.begin() + PrevSize); std::merge(temp.begin(), temp.end(), Bins.begin() + PrevSize, Bins.end(), Bins.begin()); } } @@ -367,7 +367,7 @@ namespace NKiwiAggr { bins[i].LinkAfter(&bins[i - 1]); } - TVector<double> pairWeights(n); + TVector<double> pairWeights(n); for (ui32 i = 0; i < n; ++i) { pairWeights[i] = CalcQuality(Bins[i], Bins[i + 1]).first; @@ -548,12 +548,12 @@ namespace NKiwiAggr { cumulatives.push_back(cumulative); } - TVector<TCumulatives::const_iterator> splits; + TVector<TCumulatives::const_iterator> splits; splits.reserve(intervals + 1); splits.push_back(cumulatives.begin()); splits.push_back(cumulatives.end() - 1); - TPriorityQueue<TSplitInfo> candidates; + TPriorityQueue<TSplitInfo> candidates; // explicitly add first split TSplitInfo newSplitInfo; diff --git a/library/cpp/histogram/adaptive/block_histogram.h b/library/cpp/histogram/adaptive/block_histogram.h index ba1d26f274..266bb2f2b2 100644 --- a/library/cpp/histogram/adaptive/block_histogram.h +++ b/library/cpp/histogram/adaptive/block_histogram.h @@ -45,7 +45,7 @@ namespace NKiwiAggr { double MinValue; double MaxValue; - TVector<TWeightedValue> Bins; + TVector<TWeightedValue> Bins; public: TBlockHistogram(EHistogramType type, TQualityFunction calcQuality, @@ -60,7 +60,7 @@ namespace NKiwiAggr { virtual void Add(const THistoRec& histoRec); virtual void Merge(const THistogram& histo, double multiplier); - virtual void Merge(const TVector<THistogram>& histogramsToMerge); + virtual void Merge(const TVector<THistogram>& histogramsToMerge); virtual void Merge(TVector<IHistogramPtr> histogramsToMerge); // not implemented virtual void Multiply(double factor); @@ -123,7 +123,7 @@ namespace NKiwiAggr { private: using TCumulative = std::pair<double, double>; // cumulative sum of (weights, weighted centers) - using TCumulatives = TVector<TCumulative>; + using TCumulatives = TVector<TCumulative>; struct TSplitInfo { double profit; diff --git a/library/cpp/histogram/adaptive/fixed_bin_histogram.cpp b/library/cpp/histogram/adaptive/fixed_bin_histogram.cpp index 903b076a30..558aba9e2d 100644 --- a/library/cpp/histogram/adaptive/fixed_bin_histogram.cpp +++ b/library/cpp/histogram/adaptive/fixed_bin_histogram.cpp @@ -102,7 +102,7 @@ namespace NKiwiAggr { if (!IsInitialized) { if (!TrainingSet) { - TrainingSet.Reset(new TVector<TWeightedValue>(0)); + TrainingSet.Reset(new TVector<TWeightedValue>(0)); } TrainingSet->push_back(TWeightedValue(value, weight)); if (TrainingSet->size() >= TrainingSetSize) { @@ -128,17 +128,17 @@ namespace NKiwiAggr { ythrow yexception() << "Method is not implemented for TFixedBinHistogram"; } - void TFixedBinHistogram::Merge(const TVector<THistogram>& histogramsToMerge) { - TVector<IHistogramPtr> parsedHistogramsToMerge; + void TFixedBinHistogram::Merge(const TVector<THistogram>& histogramsToMerge) { + TVector<IHistogramPtr> parsedHistogramsToMerge; for (size_t i = 0; i < histogramsToMerge.size(); ++i) { parsedHistogramsToMerge.push_back(IHistogramPtr(new TAutoHistogram(histogramsToMerge[i], Intervals, Id))); } Merge(parsedHistogramsToMerge); } - void TFixedBinHistogram::Merge(TVector<IHistogramPtr> histogramsToMerge) { - TVector<IHistogramPtr> histogramsToMergeRepacked(0); - TVector<TFixedBinHistogram*> histograms(0); + void TFixedBinHistogram::Merge(TVector<IHistogramPtr> histogramsToMerge) { + TVector<IHistogramPtr> histogramsToMergeRepacked(0); + TVector<TFixedBinHistogram*> histograms(0); // put current histogram to the vector of histograms to merge and clear self if (!Empty()) { @@ -485,7 +485,7 @@ namespace NKiwiAggr { } SetFrame(MinElement(TrainingSet->begin(), TrainingSet->end(), CompareWeightedValue)->first, MaxElement(TrainingSet->begin(), TrainingSet->end(), CompareWeightedValue)->first, true); - for (TVector<TWeightedValue>::const_iterator it = TrainingSet->begin(); it != TrainingSet->end(); ++it) { + for (TVector<TWeightedValue>::const_iterator it = TrainingSet->begin(); it != TrainingSet->end(); ++it) { Freqs[CalcBin(it->first)] += it->second; } TrainingSet.Destroy(); diff --git a/library/cpp/histogram/adaptive/fixed_bin_histogram.h b/library/cpp/histogram/adaptive/fixed_bin_histogram.h index 05ae0db428..bd380bd94a 100644 --- a/library/cpp/histogram/adaptive/fixed_bin_histogram.h +++ b/library/cpp/histogram/adaptive/fixed_bin_histogram.h @@ -26,8 +26,8 @@ namespace NKiwiAggr { double MaxValue; double Sum; - TVector<double> Freqs; - TVector<double> ReserveFreqs; + TVector<double> Freqs; + TVector<double> ReserveFreqs; double ReferencePoint; double BinRange; size_t Intervals; @@ -49,8 +49,8 @@ namespace NKiwiAggr { virtual void Add(const THistoRec& histoRec); virtual void Merge(const THistogram& histo, double multiplier); - virtual void Merge(const TVector<THistogram>& histogramsToMerge); - virtual void Merge(TVector<IHistogramPtr> histogramsToMerge); + virtual void Merge(const TVector<THistogram>& histogramsToMerge); + virtual void Merge(TVector<IHistogramPtr> histogramsToMerge); virtual void Multiply(double factor); diff --git a/library/cpp/histogram/adaptive/histogram.h b/library/cpp/histogram/adaptive/histogram.h index e6b11870e1..360fd9a693 100644 --- a/library/cpp/histogram/adaptive/histogram.h +++ b/library/cpp/histogram/adaptive/histogram.h @@ -29,8 +29,8 @@ namespace NKiwiAggr { // Merge some other histos into current virtual void Merge(const THistogram& histo, double multiplier) = 0; - virtual void Merge(const TVector<THistogram>& histogramsToMerge) = 0; - virtual void Merge(TVector<IHistogramPtr> histogramsToMerge) = 0; + virtual void Merge(const TVector<THistogram>& histogramsToMerge) = 0; + virtual void Merge(TVector<IHistogramPtr> histogramsToMerge) = 0; // factor should be greater then zero virtual void Multiply(double factor) = 0; diff --git a/library/cpp/histogram/adaptive/multi_histogram.h b/library/cpp/histogram/adaptive/multi_histogram.h index 5a18999edc..41caac5ba6 100644 --- a/library/cpp/histogram/adaptive/multi_histogram.h +++ b/library/cpp/histogram/adaptive/multi_histogram.h @@ -15,7 +15,7 @@ namespace NKiwiAggr { private: static const size_t DEFAULT_INTERVALS = 100; - typedef THashMap<ui64, IHistogramPtr> THistogramsMap; + typedef THashMap<ui64, IHistogramPtr> THistogramsMap; THistogramsMap Histograms; size_t Intervals; @@ -62,8 +62,8 @@ namespace NKiwiAggr { } } - TVector<ui64> GetIds() const { - TVector<ui64> result(0); + TVector<ui64> GetIds() const { + TVector<ui64> result(0); for (THistogramsMap::const_iterator it = Histograms.begin(); it != Histograms.end(); ++it) { result.push_back(it->first); } |