yat
0.14.5pre
|
Robust algorithm to rank rows in a data matrix versus a target vector. More...
#include <yat/classifier/ConsensusInputRanker.h>
Public Member Functions | |
ConsensusInputRanker (const IRRetrieve &, const statistics::VectorFunction &) | |
Default constructor. More... | |
void | add (const Sampler &sampler, const MatrixLookup &, const statistics::Score &s) |
void | add (const Sampler &sampler, const MatrixLookupWeighted &data, const statistics::Score &score) |
Add a set of InputRankers. More... | |
void | add (const InputRanker &ir) |
Add an InputRanker. More... | |
size_t | id (size_t i) const |
const InputRanker & | input_ranker (size_t i) const |
size_t | rank (size_t i) const |
void | reserve (size_t n) |
reserve memory for internal vector of InputRankers More... | |
void | update (void) |
Robust algorithm to rank rows in a data matrix versus a target vector.
The idea is to create several (different) ranked lists. The list could be different because they are based upon different sub-sets of the data, or the different lists could be different because they have been generated using different criteria. Having lists means each row in the data matrix has ranks (each corresponding to one list). A statistics::VectorFunction is used to boil down these ranks to one consensus rank, and a ranked list is created by sorting the data rows with respect to this consensus rank.
For the time being there are two ways to build a ConsensusInputRanker. 1) Sending a Sampler and a MatrixLookup to the add function will create one ranked list for each of the partitions defined in the Sampler. 2) You can generate your ranked list outside, using your favourite method, and adding it into the ConsensusInputRanker object. This allows combining different scores and different sub-sets in a more general way.
theplu::yat::classifier::ConsensusInputRanker::ConsensusInputRanker | ( | const IRRetrieve & | , |
const statistics::VectorFunction & | |||
) |
Default constructor.
Truly does nothing but creates a few empty member vectors.
void theplu::yat::classifier::ConsensusInputRanker::add | ( | const Sampler & | sampler, |
const MatrixLookup & | , | ||
const statistics::Score & | s | ||
) |
Iterating through sampler creating subsets of data, and for each subset is an InputRanker is created using the score. After creation the data rows are sorted with respect to the median rank (i.e. update() is called).
void theplu::yat::classifier::ConsensusInputRanker::add | ( | const Sampler & | sampler, |
const MatrixLookupWeighted & | data, | ||
const statistics::Score & | score | ||
) |
Add a set of InputRankers.
Iterating through sampler creating subsets of data, and for each subset is an InputRanker is created using the score. After creation the data rows are sorted with respect to the median rank (i.e. update() is called).
void theplu::yat::classifier::ConsensusInputRanker::add | ( | const InputRanker & | ir | ) |
Add an InputRanker.
size_t theplu::yat::classifier::ConsensusInputRanker::id | ( | size_t | i | ) | const |
Row with lowest rank (highest score) is ranked as number zero
const InputRanker& theplu::yat::classifier::ConsensusInputRanker::input_ranker | ( | size_t | i | ) | const |
size_t theplu::yat::classifier::ConsensusInputRanker::rank | ( | size_t | i | ) | const |
Row with lowest rank (highest score) is ranked as number zero
void theplu::yat::classifier::ConsensusInputRanker::reserve | ( | size_t | n | ) |
reserve memory for internal vector of InputRankers
This function is recommended before adding using add(const InputRanker&) to avoid re-allocations.
void theplu::yat::classifier::ConsensusInputRanker::update | ( | void | ) |
update ids and ranks