22 #ifndef OV_EVAL_STATISTICS_H 23 #define OV_EVAL_STATISTICS_H 29 #include <Eigen/Eigen> 76 std::vector<double> values_sorted =
values;
77 std::sort(values_sorted.begin(), values_sorted.end());
80 if (values_sorted.empty())
84 min = values_sorted.at(0);
85 max = values_sorted.at(values_sorted.size() - 1);
90 if (values_sorted.size() == 1) {
91 median = values_sorted.at(values_sorted.size() - 1);
92 }
else if (values_sorted.size() % 2 == 1) {
93 median = values_sorted.at(values_sorted.size() / 2);
94 }
else if (values_sorted.size() > 1) {
95 median = 0.5 * (values_sorted.at(values_sorted.size() / 2 - 1) + values_sorted.at(values_sorted.size() / 2));
102 for (
size_t i = 0; i < values_sorted.size(); i++) {
103 assert(!std::isnan(values_sorted.at(i)));
104 mean += values_sorted.at(i);
105 rmse += values_sorted.at(i) * values_sorted.at(i);
107 mean /= values_sorted.size();
108 rmse = std::sqrt(rmse / values_sorted.size());
112 for (
size_t i = 0; i < values_sorted.size(); i++) {
113 std += std::pow(values_sorted.at(i) -
mean, 2);
115 std = std::sqrt(std / (values_sorted.size() - 1));
120 ninetynine = mean + 2.326 *
std;
127 values_bound.clear();
133 #endif // OV_EVAL_STATISTICS_H Statistics object for a given set scalar time series values.
double ninetynine
99th percentile
double rmse
Root mean squared for the given values.
double mean
Mean of the given values.
std::vector< double > values
Values (e.g. error or nees at a given time)
Evaluation and recording utilities.
void calculate()
Will calculate all values from our vectors of information.
std::vector< double > values_bound
Bound of these values (e.g. our expected covariance bound)
double max
Max of the given values.
double std
Standard deviation of given values.
double min
Min of the given values.
void clear()
Will clear any old values.
double median
Median of the given values.
std::vector< double > timestamps
Timestamp when these values occured at.