- Timestamp:
- Oct 6, 2006, 9:03:19 AM (16 years ago)
- Location:
- trunk
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/c++_tools/classifier/ConsensusInputRanker.cc
r666 r667 4 4 5 5 #include <c++_tools/classifier/InputRanker.h> 6 #include <c++_tools/classifier/IRRetrieve.h> 6 7 #include <c++_tools/classifier/MatrixLookup.h> 7 8 #include <c++_tools/classifier/MatrixLookupWeighted.h> … … 13 14 14 15 #include <cassert> 16 #include <functional> 15 17 #include <iostream> 16 18 #include <utility> … … 65 67 { 66 68 67 // Sorting with respect to median rank69 // Sorting with respect to median info (from retriever_) 68 70 std::vector<std::pair<double,size_t> > medians(id_.size()); 69 71 for (size_t i=0; i<id_.size(); i++){ 70 std::vector<size_t> ranks(input_rankers_.size()); 72 std::vector<double> scores; 73 scores.reserve(input_rankers_.size()); 71 74 for (size_t j=0; j<input_rankers_.size(); j++) { 72 ranks[j]=input_rankers_[j].rank()[i];75 scores.push_back(retriever_(input_rankers_[j],i)); 73 76 } 74 medians[i].first = statistics::median( ranks);77 medians[i].first = statistics::median(scores); 75 78 medians[i].second = i; 76 79 } 77 80 78 81 //sort medians and assign id_ and rank_ 79 sort(medians.begin(), medians.end()); 82 sort(medians.begin(), medians.end(), 83 std::greater<std::pair<double, size_t> >()); 84 80 85 for (size_t i=0; i<medians.size(); i++){ 81 86 id_[i]=medians[i].second; -
trunk/c++_tools/classifier/ConsensusInputRanker.h
r666 r667 5 5 6 6 #include <c++_tools/classifier/InputRanker.h> 7 #include <c++_tools/classifier/IRRetrieve.h>8 7 9 8 namespace theplu { … … 13 12 namespace classifier { 14 13 14 class IRRetrieve; 15 15 class MatrixLookup; 16 16 class MatrixLookupWeighted; -
trunk/c++_tools/classifier/IRRank.h
r666 r667 5 5 6 6 #include <c++_tools/classifier/InputRanker.h> 7 #include <c++_tools/classifier/IRRetrieve.h> 7 8 8 9 namespace theplu { … … 23 24 inline double operator()(const InputRanker& ranker, size_t i) const 24 25 { 25 return - ranker.rank()[i];26 return -static_cast<double>(ranker.rank()[i]); 26 27 } 27 28 }; -
trunk/test/consensus_inputranker_test.cc
r666 r667 50 50 if (cir.id(0)!=2 || cir.id(1)!=0 || cir.id(2)!=1){ 51 51 *error << "incorrect id" << endl; 52 std::cout << cir.id(0) << "=2" << std::endl; 53 std::cout << cir.id(1) << "=0" << std::endl; 54 std::cout << cir.id(2) << "=1" << std::endl; 52 55 ok = false; 53 56 }
Note: See TracChangeset
for help on using the changeset viewer.