weka.core.metrics
Class PairwiseSelector

java.lang.Object
  extended byweka.core.metrics.PairwiseSelector
Direct Known Subclasses:
HardPairwiseSelector, RandomPairwiseSelector

public abstract class PairwiseSelector
extends java.lang.Object

Abstract PairwiseSelector class. Given a metric and training data, create a set of instance pairs that correspond to metric training data


Field Summary
protected  java.util.HashMap m_classInstanceMap
          A hashmap where class attribute values are mapped to lists of instances of that class
protected  java.util.ArrayList m_classValueList
          A list of classes, each element is the double value of the class attribute
protected  int m_numPotentialNegatives
          The number of possible different-class pairs
protected  int m_numPotentialPositives
          The number of possible same-class pairs
 
Constructor Summary
PairwiseSelector()
           
 
Method Summary
abstract  java.util.ArrayList createPairList(Instances instances, int numPosPairs, int numNegPairs, Metric metric)
          Provide an array of metric pairs metric using given training instances
static PairwiseSelector forName(java.lang.String pairwiseSelectorName, java.lang.String[] options)
          Creates a new instance of a metric learner given it's class name and (optional) arguments to pass to it's setOptions method.
 void initSelector(Instances instances)
          Initialize m_classInstanceMap and m_classValueList using a given set of instances
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

m_classInstanceMap

protected java.util.HashMap m_classInstanceMap
A hashmap where class attribute values are mapped to lists of instances of that class


m_classValueList

protected java.util.ArrayList m_classValueList
A list of classes, each element is the double value of the class attribute


m_numPotentialPositives

protected int m_numPotentialPositives
The number of possible same-class pairs


m_numPotentialNegatives

protected int m_numPotentialNegatives
The number of possible different-class pairs

Constructor Detail

PairwiseSelector

public PairwiseSelector()
Method Detail

createPairList

public abstract java.util.ArrayList createPairList(Instances instances,
                                                   int numPosPairs,
                                                   int numNegPairs,
                                                   Metric metric)
                                            throws java.lang.Exception
Provide an array of metric pairs metric using given training instances

Parameters:
metric - the metric to train
instances - data to train the metric on
Throws:
java.lang.Exception - if training has gone bad.

initSelector

public void initSelector(Instances instances)
Initialize m_classInstanceMap and m_classValueList using a given set of instances


forName

public static PairwiseSelector forName(java.lang.String pairwiseSelectorName,
                                       java.lang.String[] options)
                                throws java.lang.Exception
Creates a new instance of a metric learner given it's class name and (optional) arguments to pass to it's setOptions method. If the classifier implements OptionHandler and the options parameter is non-null, the classifier will have it's options set.

Parameters:
options - an array of options suitable for passing to setOptions. May be null.
Returns:
the newly created metric learner, ready for use.
Throws:
java.lang.Exception - if the metric learner name is invalid, or the options supplied are not acceptable to the metric learner