|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectweka.core.metrics.PairwiseSelector
weka.core.metrics.HardPairwiseSelector
HardPairwiseSelector class. Given a metric and training data, create a set of "difficult" diff-class instance pairs that correspond to metric training data
Nested Class Summary | |
class |
HardPairwiseSelector.ReverseComparator
We will need this reverse comparator class to get hardest pairs (those with the largest distance |
Field Summary | |
protected int |
m_negativesMode
|
protected int |
m_positivesMode
|
static int |
PAIRS_EASIEST
|
static int |
PAIRS_HARDEST
|
static int |
PAIRS_INTERVAL
|
static int |
PAIRS_RANDOM
|
static Tag[] |
TAGS_PAIR_SELECTION_MODE
|
Fields inherited from class weka.core.metrics.PairwiseSelector |
m_classInstanceMap, m_classValueList, m_numPotentialNegatives, m_numPotentialPositives |
Constructor Summary | |
HardPairwiseSelector()
A default constructor |
Method Summary | |
protected double |
addUniquePair(java.util.TreeSet set,
TrainingPair pair)
Add a pair to the set so that there are no collisions |
java.util.ArrayList |
createPairList(Instances instances,
int numPosPairs,
int numNegPairs,
Metric metric)
Provide an array of metric pairs metric using given training instances |
SelectedTag |
getNegativesMode()
return the selection mode for negatives |
java.lang.String[] |
getOptions()
Gets the current settings of WeightedDotP. |
SelectedTag |
getPositivesMode()
return the selection mode for positives |
protected java.util.ArrayList |
getUniquePairs(java.util.TreeSet pairSet,
Metric metric,
int numPairs)
This helper method goes through a TreeSet containing sorted TrainingPairs and returns a list of unique pairs |
java.util.Enumeration |
listOptions()
Returns an enumeration describing the available options. |
protected double[] |
populateNegativePairSet(Metric metric,
java.util.TreeSet pairSet)
Populate a treeset with all negative TrainingPair's |
protected double[] |
populatePositivePairSet(Metric metric,
java.util.TreeSet pairSet)
Populate a treeset with all positive TrainingPair's |
static int[] |
randomSubset(int numIdxs,
int maxIdx)
get an array of numIdxs random indeces out of n possible values. |
java.util.TreeSet |
reverseCopy(java.util.Set set)
Given a set, return a TreeSet whose items are accessed in descending order |
void |
setNegativesMode(SelectedTag mode)
Set the selection mode for negatives |
void |
setOptions(java.lang.String[] options)
Parses a given list of options. |
void |
setPositivesMode(SelectedTag mode)
Set the selection mode for positives |
Methods inherited from class weka.core.metrics.PairwiseSelector |
forName, initSelector |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final int PAIRS_RANDOM
public static final int PAIRS_HARDEST
public static final int PAIRS_EASIEST
public static final int PAIRS_INTERVAL
public static final Tag[] TAGS_PAIR_SELECTION_MODE
protected int m_positivesMode
protected int m_negativesMode
Constructor Detail |
public HardPairwiseSelector()
Method Detail |
public java.util.ArrayList createPairList(Instances instances, int numPosPairs, int numNegPairs, Metric metric) throws java.lang.Exception
createPairList
in class PairwiseSelector
metric
- the metric to traininstances
- data to train the metric on
java.lang.Exception
- if training has gone bad.protected java.util.ArrayList getUniquePairs(java.util.TreeSet pairSet, Metric metric, int numPairs)
pairSet
- a sorted set of TrainingPair'smetric
- the metric that is used for creating DiffInstance'snumPairs
- the number of desired pairs
protected double addUniquePair(java.util.TreeSet set, TrainingPair pair)
set
- a set to which a new pair should be addedpair
- a new pair that is to be added; value is the distance between the instances
protected double[] populatePositivePairSet(Metric metric, java.util.TreeSet pairSet) throws java.lang.Exception
metric
- a metric that will be used to calculate distancepairSet
- an empty set that will be populated
java.lang.Exception
protected double[] populateNegativePairSet(Metric metric, java.util.TreeSet pairSet) throws java.lang.Exception
metric
- a metric that will be used to calculate distancepairSet
- an empty set that will be populated
java.lang.Exception
public java.util.TreeSet reverseCopy(java.util.Set set)
set
- any set containing Comparable objects
public void setPositivesMode(SelectedTag mode)
mode
- selection modepublic SelectedTag getPositivesMode()
public void setNegativesMode(SelectedTag mode)
mode
- selection modepublic SelectedTag getNegativesMode()
public java.lang.String[] getOptions()
getOptions
in interface OptionHandler
public void setOptions(java.lang.String[] options) throws java.lang.Exception
setOptions
in interface OptionHandler
options
- the list of options as an array of strings
java.lang.Exception
- if an option is not supportedpublic java.util.Enumeration listOptions()
listOptions
in interface OptionHandler
public static int[] randomSubset(int numIdxs, int maxIdx)
maxIdx
- - the maximum index of the setnumIdxs
- number of indexes to return
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |