#include <yat/statistics/KolmogorovSmirnov.h>
Classes | |
struct | Element |
Public Member Functions | |
KolmogorovSmirnov (void) | |
Constructor. | |
void | add (double value, bool class_label, double weight=1.0) |
add a value | |
template<typename ForwardIterator > | |
void | add (ForwardIterator first, ForwardIterator last) |
add a range | |
double | p_value (void) const |
Large-Sample Approximation. | |
double | p_value (size_t perm) const |
p-value | |
void | reset (void) |
resets everything to zero | |
double | score (void) const |
Kolmogorov Smirnov statistic. | |
void | shuffle (void) |
shuffle class labels | |
double | signed_score (void) const |
Friends | |
std::ostream & | operator<< (std::ostream &, const KolmogorovSmirnov &) |
output operator |
void theplu::yat::statistics::KolmogorovSmirnov::add | ( | ForwardIterator | first, | |
ForwardIterator | last | |||
) | [inline] |
add a range
value_type of ForwardIterator must be convertible to KolmogorovSmirnov::Element
Insertion takes typically N*log(N). However, if range is sorted, insertion takes linear time. A common use case of this function is when calculating several KS statistics on a data set (values and weights) with different class labels.
double theplu::yat::statistics::KolmogorovSmirnov::p_value | ( | size_t | perm | ) | const |
double theplu::yat::statistics::KolmogorovSmirnov::p_value | ( | void | ) | const |
double theplu::yat::statistics::KolmogorovSmirnov::score | ( | void | ) | const |
Kolmogorov Smirnov statistic.
where
void theplu::yat::statistics::KolmogorovSmirnov::shuffle | ( | void | ) |
shuffle class labels
This is equivalent to reset and re-add values with shuffled class labels.
double theplu::yat::statistics::KolmogorovSmirnov::signed_score | ( | void | ) | const |
Same as score() but keeping the sign, in other words, abs(signed_score())==score()
A positive score implies that values in class true
on average are smaller than values in class false
.