|
template<typename T > |
static T | mean (vector< T > const &vals) |
| Compute the mean of given values. More...
|
|
template<typename T > |
static T | variance (vector< T > const &vals) |
| Compute the variance of given values, which requires to previously compute the mean. More...
|
|
template<typename T > |
static T | variance (vector< T > const &vals, T const mean) |
| Compute the variance of given values, considering provided mean. More...
|
|
template<typename T > |
static T | stdev (vector< T > const &vals) |
| Compute the standard deviation of given values, which requires to previously compute the variance. More...
|
|
template<typename T > |
static T | stdev (vector< T > const &vals, T const mean) |
| Compute the standard deviation of given values, considering provided mean. More...
|
|
template<typename T > |
static T | stdev (T const variance) |
| Compute the standard deviation for given variance. More...
|
|
template<typename T > |
static T | covariance (vector< T > const &X, vector< T > const &Y, bool besselCorrection=false) |
| Compute the covariance between X and Y. More...
|
|
template<typename T > |
static T | covariance (vector< T > const &X, vector< T > const &Y, T xMean, T yMean, bool besselCorrection=false) |
| Compute the covariance between X and Y, considering provided means. More...
|
|
template<typename T > |
static arma::Mat< T > | covarianceMatrix (vector< vector< T >> dataset, bool besselCorrection=false) |
| Compute matrix of covariances. More...
|
|
template<typename T > |
static arma::Mat< T > | covarianceMatrix (vector< vector< T >> dataset, vector< T > means, bool besselCorrection=false) |
| Compute matrix of covariances. More...
|
|
template<typename T > |
static vector< T > | quantiles (arma::Col< T > data, size_t nQuantiles=3) |
| Compute quantiles. More...
|
|
template<typename T > |
static vector< T > | quantiles (vector< T > const &data, size_t nQuantiles=3) |
| Like quantiles(armas::vec, size_t) function but receiving data as a standard vector instead of an armadillo vector. More...
|
|
template<typename T > |
static size_t | quantileFiltering (vector< T > &values, size_t nQuantiles=3, double filterFactor=1.5) |
| Remove those values which are considered outliers. More...
|
|
template<typename T > |
static bool | findTrustableMin (vector< T > const &S, size_t const m, T const tau, T &g, size_t *discardsCount=nullptr) |
| Obtain the trustable minimum between all elements in given collection \(S\). More...
|
|
template<typename T > |
static bool | findTrustableMax (vector< T > const &S, size_t const m, T const tau, T &g, size_t *discardsCount=nullptr) |
| Like findTrustableMin but with maximum value instead of minimum. More...
|
|
Class providing common statistics operations.
- Author
- Alberto M. Esmoris Pena
- Version
- 1.0
template<typename T >
static bool SurfaceInspector::maths::Statistics::findTrustableMin |
( |
vector< T > const & |
S, |
|
|
size_t const |
m, |
|
|
T const |
tau, |
|
|
T & |
g, |
|
|
size_t * |
discardsCount = nullptr |
|
) |
| |
|
static |
Obtain the trustable minimum between all elements in given collection \(S\).
Let \(S\) be a collection of elements of the same type.
Now, let \(Z = \left\{z_1, \ldots, z_m \right\}\) be the collection of \(m\) lowest elements in ascending order.
From \(Z\), it is possible to define the collection \(\Delta = \left\{\Delta_1, \ldots, \Delta_{m-1} : \Delta_i = z_{i+1} - z_{i}\right\}\)
For each \(\Delta_i \in \Delta\), if \(\Delta_i > \tau\) then remove \(R=\{z_j : j \leq i\}\) from \(Z\), while adding \(A=\{z_j : i < j \leq i+|R|\}\) (where \(|R|\) is the number of removed elements). This means the updated \(Z\) collection can be defined as \(Z' = Z \setminus R + A = \{z_1', \ldots, z_m'\}\). In consequence, the updated \(\Delta\) collection can be expressed as \(\Delta' = \{\Delta_1', \ldots, \Delta_{m-1}' : \Delta_i' = z_{i+1}' - z_i'\}\).
Aforementioned process must be repeated until \(|\Delta| = m-1\) and \(\forall \Delta_i \in \Delta,\, \Delta_{i} \leq \tau\) (where \(|\Delta|\) is the number of elements in \(\Delta\) collection). Whenever this cannot be satisfied, the trustable minimum is considered to be undefined and \(g=0\) by default. Otherwise, the trustable minimum is defined as \(g=\min(Z)\) where \(Z\) is the collection of trustable lowest elements obtained through previously defined iterative process.
PARTICULAR CASE \(m=1\)
If \(m=1\) then the trustable minimum of the collection will be the minimum of the collection itself. This happens because \(m=1\) implies no checks will be done.
- Template Parameters
-
T | Numerical type for \(S\) collection elements |
- Parameters
-
[in] | S | Collection \(S\) of elements implemented as vector |
[in] | m | Number of \(m\) values involved in trustability analysis |
[in] | tau | Differential threshold \(\tau\) defining trustability |
[out] | g | Minimum trustable element in \(S\) |
[out] | discardsCount | If it is a not null pointer, then number of checks leading to a discard is stored here |
- Returns
- True if trustable minimum was found (defined), false otherwise (undefined)
- See also
- SurfaceInspector::maths::Statistics::findTrustableMax
template<typename T >
static size_t SurfaceInspector::maths::Statistics::quantileFiltering |
( |
vector< T > & |
values, |
|
|
size_t |
nQuantiles = 3 , |
|
|
double |
filterFactor = 1.5 |
|
) |
| |
|
static |
Remove those values which are considered outliers.
Let \(\overline{V}\) be the vector of values, \(k\) be the filtering factor and assume \(\Delta = Q_{n}-Q_{1}\) as the difference between last and first quantile. When 3 quantiles are used, quartiles are used hence \(\Delta = Q_{3} - Q_{1}\) which would be the classical/standard quantile filtering method. Below expression defines when a value from \(\overline{V}\) will also be in filtered vector \(\overline{F}\):
\[ \forall v \in \overline{V} ,\, v \in [Q_{1}-k\Delta, Q_{n}+k\Delta] \Rightarrow v \in \overline{F} \]
- Template Parameters
-
T | Numerical type for values vector |
- Parameters
-
values | Vector of values to be filtered |
filterFactor | Factor defining filtering boundaries |
- Returns
- Amount of filtered values