MCPcopy Create free account
hub / github.com/catboost/catboost / WilcoxonWithSign

Function WilcoxonWithSign

library/cpp/statistics/statistics.h:135–154  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

133 //! Wilcoxon test for two samples.
134 template <typename InputIterator1, typename InputIterator2>
135 TStatTestResult WilcoxonWithSign(InputIterator1 xBegin, InputIterator1 xEnd, InputIterator2 yBegin, InputIterator2 yEnd) {
136 typedef typename std::iterator_traits<InputIterator1>::value_type ValueType;
137 typedef typename std::iterator_traits<InputIterator2>::value_type AnotherValueType;
138 static_assert((std::is_same<ValueType, AnotherValueType>::value), "expect (std::is_same<ValueType, AnotherValueType>::value)");
139 static_assert(std::is_floating_point<ValueType>::value, "expect std::is_floating_point<ValueType>::value");
140
141 if (std::distance(xBegin, xEnd) != std::distance(yBegin, yEnd) || xBegin == xEnd) {
142 return TStatTestResult(0.5, 0);
143 }
144
145 TVector<ValueType> v;
146 for (; xBegin != xEnd; ++xBegin, ++yBegin) {
147 if (!NDetail::RelativeEqual(*xBegin, *yBegin)) {
148 v.push_back(*xBegin - *yBegin);
149 }
150 }
151
152 Sort(v.begin(), v.end(), NDetail::WilcoxonComparator<ValueType>);
153 return NDetail::WilcoxonTestWithSign(v.begin(), v.end());
154 }
155
156 //! Wilcoxon test for two samples.
157 template <typename InputIterator1, typename InputIterator2>

Callers 1

WilcoxonFunction · 0.85

Calls 9

distanceFunction · 0.85
TStatTestResultClass · 0.85
RelativeEqualFunction · 0.85
WilcoxonTestWithSignFunction · 0.85
SortFunction · 0.50
push_backMethod · 0.45
beginMethod · 0.45
endMethod · 0.45
emptyMethod · 0.45

Tested by

no test coverage detected