Changeset 1471 for trunk/yat/statistics
- Timestamp:
- Sep 2, 2008, 8:24:20 PM (15 years ago)
- Location:
- trunk/yat/statistics
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/yat/statistics/WilcoxonFoldChange.cc
r1437 r1471 27 27 #include "utility.h" 28 28 #include "yat/classifier/Target.h" 29 #include "yat/utility/DataWeight.h" 29 30 30 31 #include <cmath> … … 61 62 62 63 63 double WilcoxonFoldChange::score64 (const classifier::Target& target,65 const classifier::DataLookupWeighted1D& value) const66 {67 std::cerr << " WilcoxonFoldChange::score not implemented" << std::endl;68 return 0;69 }70 71 72 64 double WilcoxonFoldChange::score(const classifier::Target& target, 73 65 const utility::VectorBase& value, 74 66 const utility::VectorBase& weight) const 75 67 { 76 std::cerr << " WilcoxonFoldChange::score not implemented" << std::endl; 68 std::vector<utility::DataWeight> distance; 69 //Peter, should reserve the vector to avoid reallocations 70 for (size_t i=0; i<target.size(); i++) { 71 if (target.binary(i)) continue; 72 for (size_t j=0; j<target.size(); j++) { 73 if (!target.binary(j)) 74 distance.push_back(utility::DataWeight(value(i)-value(j), 75 weight(i)*weight(j))); 76 } 77 } 78 if (absolute_) 79 return fabs(median(distance.begin(), distance.end())); 80 return median(distance.begin(), distance.end()); 81 82 77 83 return 0; 78 84 } -
trunk/yat/statistics/WilcoxonFoldChange.h
r1437 r1471 63 63 64 64 /// 65 /// @return difference of the weighted means of the two classes 66 /// 67 /// @param target defining the two groups (Target.binary() ) 68 /// @param value vector of the values (with weights) 69 /// 70 /// @note not implemented 71 /// 72 double score(const classifier::Target& target, 73 const classifier::DataLookupWeighted1D& value) const; 74 65 /// @return weighted median of all pairwise differences 75 66 /// 76 /// @return difference of the weighted means of the two classes 67 /// For each pair a DataWeight is created with value = value(i) - 68 /// value(j) and weight = weight(i)*weight(j) where sample i and 69 /// sample j come from different groups. 77 70 /// 78 71 /// @param target defining the two groups
Note: See TracChangeset
for help on using the changeset viewer.