|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectweka.core.metrics.MetricLearner
Abstract MetricLearner interface. Given a metric and training data, learn the metric's parameters and set them.
Constructor Summary | |
MetricLearner()
|
Method Summary | |
protected java.util.ArrayList[] |
createDiffInstanceLists(Instances instances,
LearnableMetric metric,
int numPosDiffInstances,
double posNegDiffInstanceRatio)
Create two lists: one of diff-instances belonging to same class, another of diff-instances belonging to different classes. |
protected Instances |
createDiffInstances(java.util.ArrayList posDiffInstanceList,
java.util.ArrayList negDiffInstanceList)
Given two ArrayList of pairs of same-class and different-class diff-instances, create an Instances dataset of DiffInstances |
protected Instances |
createDiffInstances(java.util.ArrayList pairList,
LearnableMetric metric)
Given an ArrayList of TrainingPair's of same-class and different-class diff-instances, create an Instances dataset of DiffInstances |
static MetricLearner |
forName(java.lang.String metricLearnerName,
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. |
protected FastVector |
getAttrInfoForDiffInstance(Instance instance)
Given an instance, return a FastVector of attributes. |
abstract double |
getDistance(Instance instance1,
Instance instance2)
Use the metricLearner's internal model for an estimation of distance, e.g. |
abstract double |
getSimilarity(Instance instance1,
Instance instance2)
Use the metricLearner's internal model for an estimation of similarity, e.g. |
abstract void |
trainMetric(LearnableMetric metric,
Instances instances)
Train a given metric using given training instances |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public MetricLearner()
Method Detail |
public abstract void trainMetric(LearnableMetric metric, Instances instances) throws java.lang.Exception
metric
- the metric to traininstances
- data to train the metric on
java.lang.Exception
- if training has gone bad.public abstract double getSimilarity(Instance instance1, Instance instance2) throws java.lang.Exception
java.lang.Exception
public abstract double getDistance(Instance instance1, Instance instance2) throws java.lang.Exception
java.lang.Exception
protected java.util.ArrayList[] createDiffInstanceLists(Instances instances, LearnableMetric metric, int numPosDiffInstances, double posNegDiffInstanceRatio)
instances
- a set of training instancesmetric
- the metric to trainprotected Instances createDiffInstances(java.util.ArrayList posDiffInstanceList, java.util.ArrayList negDiffInstanceList)
posDiffInstanceList
- list of diff-instances from same classnegDiffInstanceList
- list of diff-instances from different classesprotected Instances createDiffInstances(java.util.ArrayList pairList, LearnableMetric metric)
pairList
- list of TrainingPair's of instancesmetric
- a metric that will create the diffInstancesprotected FastVector getAttrInfoForDiffInstance(Instance instance)
instance
- Instance from which to extract attributespublic static MetricLearner forName(java.lang.String metricLearnerName, java.lang.String[] options) throws java.lang.Exception
metricLearnerName
- the fully qualified class name of the metric learneroptions
- an array of options suitable for passing to setOptions. May
be null.
java.lang.Exception
- if the metric learner name is invalid, or the options
supplied are not acceptable to the metric learner
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |