1 #ifndef _theplu_yat_normalizer_z_score_ 2 #define _theplu_yat_normalizer_z_score_ 28 #include "yat/statistics/Averager.h" 29 #include "yat/statistics/AveragerWeighted.h" 31 #include "yat/utility/concept_check.h" 32 #include "yat/utility/iterator_traits.h" 34 #include <boost/concept_check.hpp> 38 namespace normalizer {
69 template<
class InputIterator,
class OutputIterator>
71 OutputIterator result)
const 78 normalize(first, last, result, tag);
82 template<
class ForwardIterator,
class OutputIterator>
83 void normalize(ForwardIterator first, ForwardIterator last,
84 OutputIterator result,
90 BOOST_CONCEPT_ASSERT((boost_concepts::ForwardTraversal<ForwardIterator>));
92 BOOST_CONCEPT_ASSERT((boost_concepts::WritableIterator<OutputIterator>));
99 *result = (*first - m) /
std;
105 template<
class ForwardIterator,
class OutputIterator>
106 void normalize(ForwardIterator first, ForwardIterator last,
107 OutputIterator result,
108 utility::weighted_iterator_tag tag)
const 113 BOOST_CONCEPT_ASSERT((boost_concepts::ForwardTraversal<ForwardIterator>));
115 BOOST_CONCEPT_ASSERT((boost_concepts::WritableIterator<OutputIterator>));
117 BOOST_CONCEPT_ASSERT((boost_concepts::ForwardTraversal<OutputIterator>));
118 detail::copy_weight_if_weighted(first, last, result);
119 statistics::AveragerWeighted a;
122 double std = a.std();
123 utility::iterator_traits<ForwardIterator> in_trait;
124 utility::iterator_traits<OutputIterator> out_trait;
125 while (first!=last) {
126 out_trait.data(result) = (in_trait.data(first) - m) /
std;
Zero mean and unity variance.
Definition: Zscore.h:56
Concept check for Data Iterator.
Definition: concept_check.h:240
double std(void) const
The standard deviation is defined as the square root of the variance.
Definition: averager_base.h:206
Class to calculate simple (first and second moments) averages.
Definition: Averager.h:46
The Department of Theoretical Physics namespace as we define it.
Definition: iterator_traits.h:47
Definition: stl_utility.h:64
void operator()(InputIterator first, InputIterator last, OutputIterator result) const
Definition: Zscore.h:70
double mean(void) const
mean
Definition: averager_base.h:97
detail::unweighted_type_and< w_type1, w_type2 >::type type
return unweighted if both are unweighted
Definition: iterator_traits.h:165