Ignore:
Timestamp:
Mar 19, 2007, 11:15:43 PM (16 years ago)
Author:
Peter
Message:

Generalized ConsenusInputRanker?, Fixes #151

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/test/consensus_inputranker_test.cc

    r820 r828  
    2828#include "yat/classifier/CrossValidationSampler.h"
    2929#include "yat/classifier/IRRank.h"
     30#include "yat/statistics/VectorFunction.h"
    3031
    3132#include <cstdlib>
     
    6364  *error << "Building Consensus_Inputranker" << std::endl;
    6465  theplu::yat::classifier::IRRank retrieve;
    65   theplu::yat::classifier::ConsensusInputRanker cir(sampler,data,roc,retrieve);
    66   *error << "Done" << std::endl;
     66  theplu::yat::statistics::Median median;
     67  theplu::yat::classifier::ConsensusInputRanker cir(retrieve,median);
     68  cir.add(sampler,data,roc);
    6769
     70  *error << "test ids... ";
    6871  if (cir.id(0)!=2 || cir.id(1)!=0 || cir.id(2)!=1){
    69     *error << "incorrect id" << endl;
    70     ok = false;
    71   }
    72  
    73   if (cir.rank(0)!=1 || cir.rank(1)!=2 || cir.rank(2)!=0){
    74     *error << "incorrect rank" << endl;
     72    *error << "\nincorrect id for weighted" << endl;
    7573    ok=false;
    7674  }
     75  else
     76    *error << "ok." << std::endl;
     77
     78  *error << "test ranks... ";
     79  if (cir.rank(0)!=1 || cir.rank(1)!=2 || cir.rank(2)!=0){
     80    *error << "\nincorrect rank for weighted" << endl;
     81    ok=false;
     82  }
     83  else
     84    *error << "ok." << std::endl;
    7785
    7886  theplu::yat::utility::matrix flag(data.rows(),data.columns(),1);
    7987  // Peter, fix weighted version instead
    80   theplu::yat::classifier::ConsensusInputRanker cir2(sampler,data,roc,retrieve);
     88  theplu::yat::classifier::ConsensusInputRanker cir2(retrieve,median);
     89  cir2.add(sampler,data,roc);
    8190
     91  *error << "test ids... ";
    8292  if (cir2.id(0)!=2 || cir2.id(1)!=0 || cir2.id(2)!=1){
    83     *error << "incorrect id for weighted" << endl;
     93    *error << "\nincorrect id for weighted" << endl;
    8494    ok=false;
    8595  }
     96  else
     97    *error << "ok." << std::endl;
    8698 
     99  *error << "test ranks... ";
    87100  if (cir2.rank(0)!=1 || cir2.rank(1)!=2 || cir2.rank(2)!=0){
    88     *error << "incorrect rank for weighted" << endl;
     101    *error << "\nincorrect rank for weighted" << endl;
    89102    ok=false;
    90103  }
     104  else
     105    *error << "ok." << std::endl;
    91106
    92107  if (error!=&std::cerr)
Note: See TracChangeset for help on using the changeset viewer.