aboutsummaryrefslogtreecommitdiffstats
path: root/library/cpp/lwtrace/mon/analytics/transform.h
diff options
context:
space:
mode:
authorlianabatalova <lianabatalova@yandex-team.ru>2022-02-10 16:49:11 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:49:11 +0300
commit5bb473368cbb2d67a30433d2cd55e8e32460dea8 (patch)
tree05d166cc67f02e379edbe07942017ed65bcf0cf6 /library/cpp/lwtrace/mon/analytics/transform.h
parent6c7ed19fb4e807d81f39d5b370b1dba604558a17 (diff)
downloadydb-5bb473368cbb2d67a30433d2cd55e8e32460dea8.tar.gz
Restoring authorship annotation for <lianabatalova@yandex-team.ru>. Commit 1 of 2.
Diffstat (limited to 'library/cpp/lwtrace/mon/analytics/transform.h')
-rw-r--r--library/cpp/lwtrace/mon/analytics/transform.h52
1 files changed, 26 insertions, 26 deletions
diff --git a/library/cpp/lwtrace/mon/analytics/transform.h b/library/cpp/lwtrace/mon/analytics/transform.h
index f7dc9adb5b..e821ce566f 100644
--- a/library/cpp/lwtrace/mon/analytics/transform.h
+++ b/library/cpp/lwtrace/mon/analytics/transform.h
@@ -35,12 +35,12 @@ inline TTable Histogram(const TTable& in, TSkip skip,
double y = y_in(row);
ysum += y;
if (i >= 0 && i < buckets) {
- out[i][yn_sum] = y + out[i].GetOrDefault(yn_sum, 0.0);
+ out[i][yn_sum] = y + out[i].GetOrDefault(yn_sum, 0.0);
}
}
for (TRow& row : out) {
if (ysum != 0.0) {
- row[yn_share] = row.GetOrDefault(yn_sum, 0.0) / ysum;
+ row[yn_share] = row.GetOrDefault(yn_sum, 0.0) / ysum;
}
}
return out;
@@ -90,21 +90,21 @@ inline TTable HistogramAll(const TTable& in, const TString& xn, double x1, doubl
if (yn == xn) {
continue;
}
- double y;
- if (!row_in.Get(yn, y)) {
- continue;
- }
+ double y;
+ if (!row_in.Get(yn, y)) {
+ continue;
+ }
colSum[yn] += y;
if (i >= 0 && i < buckets) {
- out[i][yn + "_cnt"] = out[i].GetOrDefault(yn + "_cnt") + 1;
- out[i][yn + "_sum"] = out[i].GetOrDefault(yn + "_sum") + y;
+ out[i][yn + "_cnt"] = out[i].GetOrDefault(yn + "_cnt") + 1;
+ out[i][yn + "_sum"] = out[i].GetOrDefault(yn + "_sum") + y;
if (out[i].contains(yn + "_min")) {
- out[i][yn + "_min"] = Min(y, out[i].GetOrDefault(yn + "_min"));
+ out[i][yn + "_min"] = Min(y, out[i].GetOrDefault(yn + "_min"));
} else {
out[i][yn + "_min"] = y;
}
if (out[i].contains(yn + "_max")) {
- out[i][yn + "_max"] = Max(y, out[i].GetOrDefault(yn + "_max"));
+ out[i][yn + "_max"] = Max(y, out[i].GetOrDefault(yn + "_max"));
} else {
out[i][yn + "_max"] = y;
}
@@ -112,19 +112,19 @@ inline TTable HistogramAll(const TTable& in, const TString& xn, double x1, doubl
}
colSum["_count"]++;
if (i >= 0 && i < buckets) {
- out[i]["_count_sum"] = out[i].GetOrDefault("_count_sum") + 1;
+ out[i]["_count_sum"] = out[i].GetOrDefault("_count_sum") + 1;
}
}
for (TRow& row : out) {
for (const TString& col : cols) {
double ysum = colSum[col];
if (col != "_count") {
- if (row.GetOrDefault(col + "_cnt") != 0.0) {
- row[col + "_avg"] = row.GetOrDefault(col + "_sum") / row.GetOrDefault(col + "_cnt");
+ if (row.GetOrDefault(col + "_cnt") != 0.0) {
+ row[col + "_avg"] = row.GetOrDefault(col + "_sum") / row.GetOrDefault(col + "_cnt");
}
}
if (ysum != 0.0) {
- row[col + "_share"] = row.GetOrDefault(col + "_sum") / ysum;
+ row[col + "_share"] = row.GetOrDefault(col + "_sum") / ysum;
}
}
}
@@ -158,10 +158,10 @@ inline TMatrix CovarianceMatrix(const TTable& in)
for (const TRow& row : in) {
for (const auto& kv : row) {
const TString& xn = kv.first;
- double x;
- if (!row.Get(xn, x)) {
- continue;
- }
+ double x;
+ if (!row.Get(xn, x)) {
+ continue;
+ }
TAggregate& aggr = colAggr[xn];
aggr.Sum += x;
aggr.Count++;
@@ -177,16 +177,16 @@ inline TMatrix CovarianceMatrix(const TTable& in)
TMatrix cov(cols.size(), cols.size());
for (const TRow& row : in) {
for (const auto& kv1 : row) {
- double x;
- if (!row.Get(kv1.first, x)) {
- continue;
- }
+ double x;
+ if (!row.Get(kv1.first, x)) {
+ continue;
+ }
TAggregate& xaggr = colAggr[kv1.first];
for (const auto& kv2 : row) {
- double y;
- if (!row.Get(kv2.first, y)) {
- continue;
- }
+ double y;
+ if (!row.Get(kv2.first, y)) {
+ continue;
+ }
TAggregate& yaggr = colAggr[kv2.first];
covCount.Cell(xaggr.Idx, yaggr.Idx)++;
cov.Cell(xaggr.Idx, yaggr.Idx) += (x - xaggr.Mean) * (y - yaggr.Mean);