Changeset 1524

Ignore:
Timestamp:
Sep 23, 2008, 7:49:15 PM (15 years ago)
Message:

fixes #443

Location:
trunk
Files:
2 edited

Unmodified
Removed
• trunk/test/normalization_test.cc

 r1523 for (size_t i=0; i vec2; vec2.push_back(utility::DataWeight(1,1)); vec2.push_back(utility::DataWeight(2.13,0.5)); vec2.push_back(utility::DataWeight(2.13,0.5)); std::vector vec3(vec2.size()); zscore(vec2.begin(), vec2.end(), vec3.begin()); for (size_t i=0; i
• trunk/yat/normalizer/Zscore.h

 r1521 #include "yat/statistics/Averager.h" #include "yat/statistics/AveragerWeighted.h" #include "yat/utility/iterator_traits.h" namespace theplu { OutputIterator result) const { typename utility::weighted_iterator_traits::type tag; return normalize(first, last, result, tag); } private: template OutputIterator normalize(InputIterator first, InputIterator last, OutputIterator result, utility::unweighted_iterator_tag tag) const { statistics::Averager a; add(a, first, last); } template OutputIterator normalize(InputIterator first, InputIterator last, OutputIterator result, utility::weighted_iterator_tag tag) const { std::copy(utility::weight_iterator(first), utility::weight_iterator(last), utility::weight_iterator(result)); statistics::AveragerWeighted a; add(a, first, last); double m = a.mean(); double std = a.std(); utility::iterator_traits trait; while (first!=last) { trait.data(result) = (trait.data(first) - m) / std; ++first; ++result; } return result; } };
Note: See TracChangeset for help on using the changeset viewer.