1 #ifndef _theplu_yat_statistics_kolmogorov_smirnov_
2 #define _theplu_yat_statistics_kolmogorov_smirnov_
26 #include <boost/concept_check.hpp>
34 namespace statistics {
60 Element(
double x,
bool class_label,
double w=1.0);
91 void add(
double value,
bool class_label,
double weight=1.0);
106 template <
typename ForwardIterator>
107 void add(ForwardIterator first, ForwardIterator last);
135 double p_value(
size_t perm)
const;
145 void remove(
double value,
bool class_label,
double weight=1.0);
158 double score(
void)
const;
182 void scores(std::vector<double>&)
const;
185 template <
typename ForwardIterator>
186 void add_sum_w(ForwardIterator first, ForwardIterator last);
188 mutable bool cached_;
189 mutable double score_;
190 typedef std::multiset<Element> data_w;
212 template <
typename ForwardIterator>
215 BOOST_CONCEPT_ASSERT((boost::ForwardIterator<ForwardIterator>));
216 ForwardIterator iter(first);
217 typename data_w::const_iterator hint(data_.begin());
218 for ( ; iter!=last; ++iter)
220 hint = data_.insert(hint, *iter);
221 add_sum_w(first, last);
226 template <
typename ForwardIterator>
227 void KolmogorovSmirnov::add_sum_w(ForwardIterator first,
228 ForwardIterator last)
230 while (first!=last) {
232 sum_w1_ += (*first).weight;
234 sum_w2_ += (*first).weight;
Definition: KolmogorovSmirnov.h:50
void shuffle(void)
shuffle class labels
bool label
Definition: KolmogorovSmirnov.h:70
double signed_score(void) const
bool operator<(const Element &rhs) const
Element(void)
default constructor
Kolmogorov Smirnov Test.
Definition: KolmogorovSmirnov.h:39
void add(double value, bool class_label, double weight=1.0)
add a value
double weight
Definition: KolmogorovSmirnov.h:75
void reset(void)
resets everything to zero
KolmogorovSmirnov(void)
Constructor.
double value
data value
Definition: KolmogorovSmirnov.h:65
double score(void) const
Kolmogorov Smirnov statistic.
double p_value(void) const
Large-Sample Approximation.