Ignore:
Timestamp:
Oct 6, 2006, 9:03:19 AM (15 years ago)
Author:
Peter
Message:

refs #151 using Functor now in consensusinputranker to retrieve information from inputranker to sort on. Median is still hard-coded so I leave this ticket open.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/c++_tools/classifier/ConsensusInputRanker.cc

    r666 r667  
    44
    55#include <c++_tools/classifier/InputRanker.h>
     6#include <c++_tools/classifier/IRRetrieve.h>
    67#include <c++_tools/classifier/MatrixLookup.h>
    78#include <c++_tools/classifier/MatrixLookupWeighted.h>
     
    1314
    1415#include <cassert>
     16#include <functional>
    1517#include <iostream>
    1618#include <utility>
     
    6567  {
    6668
    67     // Sorting with respect to median rank
     69    // Sorting with respect to median info (from retriever_)
    6870    std::vector<std::pair<double,size_t> > medians(id_.size());
    6971    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());
    7174      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));
    7376      }
    74       medians[i].first = statistics::median(ranks);
     77      medians[i].first = statistics::median(scores);
    7578      medians[i].second = i;
    7679    }
    7780   
    7881    //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         
    8085    for (size_t i=0; i<medians.size(); i++){
    8186      id_[i]=medians[i].second;
Note: See TracChangeset for help on using the changeset viewer.