1 #ifndef _theplu_yat_statistics_kolmogorov_smirnov_ 2 #define _theplu_yat_statistics_kolmogorov_smirnov_ 26 #include "yat/utility/concept_check.h" 28 #include <boost/concept_check.hpp> 29 #include <boost/iterator/iterator_concepts.hpp> 37 namespace statistics {
63 Element(
double x,
bool class_label,
double w=1.0);
94 void add(
double value,
bool class_label,
double weight=1.0);
112 template <
typename ForwardIterator>
113 void add(ForwardIterator first, ForwardIterator last);
141 double p_value(
size_t perm)
const;
151 void remove(
double value,
bool class_label,
double weight=1.0);
168 double score(
void)
const;
184 void scores(std::vector<double>&)
const;
215 template <
typename ForwardIterator>
216 void add_sum_w(ForwardIterator first, ForwardIterator last);
218 mutable bool cached_;
219 mutable double score_;
220 typedef std::multiset<Element> data_w;
240 template <
typename ForwardIterator>
243 BOOST_CONCEPT_ASSERT((boost_concepts::ForwardTraversal<ForwardIterator>));
244 BOOST_CONCEPT_ASSERT((boost_concepts::ReadableIterator<ForwardIterator>));
245 ForwardIterator iter(first);
246 typename data_w::const_iterator hint(data_.begin());
247 for ( ; iter!=last; ++iter)
249 hint = data_.insert(hint, *iter);
250 add_sum_w(first, last);
255 template <
typename ForwardIterator>
256 void KolmogorovSmirnov::add_sum_w(ForwardIterator first,
257 ForwardIterator last)
259 while (first!=last) {
261 sum_w1_ += (*first).weight;
263 sum_w2_ += (*first).weight;
bool operator<(const Element &rhs) const
double signed_score(void) const
double score(void) const
Kolmogorov Smirnov statistic.
Definition: KolmogorovSmirnov.h:53
void shuffle(void)
shuffle class labels
bool label
Definition: KolmogorovSmirnov.h:73
The Department of Theoretical Physics namespace as we define it.
Element(void)
default constructor
Kolmogorov Smirnov Test.
Definition: KolmogorovSmirnov.h:42
void add(double value, bool class_label, double weight=1.0)
add a value
double weight
Definition: KolmogorovSmirnov.h:78
void reset(void)
resets everything to zero
double p_value(void) const
Large-Sample Approximation.
KolmogorovSmirnov(void)
Constructor.
void scores(std::vector< double > &) const
double value
data value
Definition: KolmogorovSmirnov.h:68