public class RankAggregationRanker extends MultiObjectiveEntryRanker
Usage: <k> -obj <maximize|minimize> <property> <ranker name> [<ranker options...>] [-opt <...>]
BaseEntryRanker
. Avoid using another multi-objective ranker
The "-obj" flag can be used multiple times, and the syntax for each additional flag is identical. Also, this function
is designed to be minimized.
Modifier and Type | Field and Description |
---|---|
protected int |
K
Number of top entries to be interested in.
|
protected java.util.SortedMap<java.lang.String,BaseEntryRanker> |
ObjectiveFunction
Map of property name to objective function
|
protected int[] |
PropertyIndex
Index of each property of interest
|
Constructor and Description |
---|
RankAggregationRanker() |
Modifier and Type | Method and Description |
---|---|
void |
addObjectiveFunction(java.lang.String property,
BaseEntryRanker function)
Define a new objective function.
|
void |
clearObjectiveFunctions()
Clear out list of currently-defined objective functions
|
BaseEntryRanker |
getObjectiveFunction(java.lang.String property)
Get objective function for a certain property.
|
java.lang.String[] |
getObjectives()
Get properties currently used in objective functions.
|
double |
objectiveFunction(BaseEntry Entry)
Some kind of objective function that returns a double when given an entry.
|
java.lang.String |
printUsage()
Print out required format for options.
|
int[] |
rankEntries(Dataset Data,
double[] Values)
Return the rank of entries that were sorted based on the objective function defined
in this class (also depends on the settings for Maximize and Measured.
|
void |
setK(int K)
Define the maximum number of entries to be interested in.
|
void |
setOptions(java.util.List<java.lang.Object> Options)
Set any options for this object.
|
void |
setUseMeasured(boolean useMeasured)
Set whether to used measured (or predicted) class values
|
void |
train(MultiPropertyDataset data)
Train the entry ranker.
|
clone, train
isMaximizing, isUsingMeasured, rankEntries, rankEntries, runObjectiveFunction, setMaximizeFunction
protected java.util.SortedMap<java.lang.String,BaseEntryRanker> ObjectiveFunction
protected int[] PropertyIndex
protected int K
public void setOptions(java.util.List<java.lang.Object> Options) throws java.lang.Exception
Options
Options
- Array of options as Objects - can be null
java.lang.Exception
- if problem with inputspublic java.lang.String printUsage()
Options
public void setK(int K)
K
- Maximum number of entries.public void setUseMeasured(boolean useMeasured)
BaseEntryRanker
setUseMeasured
in class BaseEntryRanker
useMeasured
- Desired optionpublic void clearObjectiveFunctions()
public void addObjectiveFunction(java.lang.String property, BaseEntryRanker function)
property
- Name of property to be optimizedfunction
- Objective function for that propertypublic BaseEntryRanker getObjectiveFunction(java.lang.String property)
property
- Name of propertypublic java.lang.String[] getObjectives()
MultiObjectiveEntryRanker
getObjectives
in class MultiObjectiveEntryRanker
public void train(MultiPropertyDataset data)
MultiObjectiveEntryRanker
Note: This might be an opportune operation to map the name of each property with their index to allow for faster operation of the EntryRanker#objectiveFunction(magpie.data.BaseEntry)
train
in class MultiObjectiveEntryRanker
data
- Dataset to use for trainingpublic double objectiveFunction(BaseEntry Entry)
BaseEntryRanker
NOTE: This function needs to support using either the measured or predicted class depending on the settings
objectiveFunction
in class BaseEntryRanker
Entry
- Entry to be analyzedpublic int[] rankEntries(Dataset Data, double[] Values)
BaseEntryRanker
double[] Values = new double[Data.NEntries()];
rankEntries
in class BaseEntryRanker
Data
- Dataset containing entries to be rankedValues
- Pre-allocated, containing Data.NEntries() number of entries