10 #include "aggregates.h"
16 namespace algorithms {
19 using namespace herald::analysis::aggregates;
25 static constexpr
int runs = 1;
27 RiskAggregationBasic(
double timeScale,
double distanceScale,
double minimumDistanceClamp,
double minimumRiskScoreAtClamp,
double logScale = 3.3598856662 )
28 : run(1), timeScale(timeScale), distanceScale(distanceScale), minimumDistanceClamp(minimumDistanceClamp),
29 minimumRiskScoreAtClamp(minimumRiskScoreAtClamp), logScale(logScale), nMinusOne(-1.0), n(-1.0), timeMinusOne(0), time(0), riskScore(0)
35 void beginRun(
int thisRun) {
46 template <
typename SampleT>
51 time = value.taken.secondsSinceUnixEpoch();
55 if (-1.0 != nMinusOne) {
58 double dist = distanceScale * n;
59 double t = timeScale * (time - timeMinusOne);
61 double riskSlice = minimumRiskScoreAtClamp;
62 if (dist > minimumDistanceClamp) {
66 riskSlice = minimumRiskScoreAtClamp - (logScale * std::log10(dist));
67 if (riskSlice > minimumRiskScoreAtClamp) {
69 riskSlice = minimumRiskScoreAtClamp;
71 if (riskSlice < 0.0) {
78 riskScore += riskSlice;
97 double minimumDistanceClamp;
98 double minimumRiskScoreAtClamp;
Acts as a non-global memory arena for arbitrary classes.
Definition: aggregates.h:15
The Sample taken from an object with ID of type SampledID.
Definition: sampling.h:28