|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectweka.core.metrics.MetricLearner
weka.core.metrics.ClassifierMetricLearner
ClassifierMetricLearner - learns metric parameters by constructing "difference instances" and then learning weights that classify same-class instances as positive, and different-class instances as negative.
Field Summary | |
protected Classifier |
m_classifier
Classifier that is used for learning metric weights |
protected boolean |
m_isDiffClassNominal
Class attribute for diff-instances can be either nominal or numeric |
protected LearnableMetric |
m_metric
The metric that the classifier was used to learn, useful for external-calculation based metrics |
protected int |
m_numNegPairs
|
protected int |
m_numPosPairs
|
protected PairwiseSelector |
m_selector
The pairwise selector used by the metric |
Constructor Summary | |
ClassifierMetricLearner()
Create a new classifier metric learner |
Method Summary | |
static java.lang.String |
concatStringArray(java.lang.String[] strings)
A little helper to create a single String from an array of Strings |
Classifier |
getClassifier()
Get the classifier |
double |
getDistance(Instance instance1,
Instance instance2)
Use the Classifier for an estimation of distance |
int |
getNumNegPairs()
Get the number of different-class training pairs |
int |
getNumPosPairs()
Get the number of same-class training pairs |
java.lang.String[] |
getOptions()
Gets the current settings of WeightedDotP. |
PairwiseSelector |
getSelector()
Get the pairwise selector |
double |
getSimilarity(Instance instance1,
Instance instance2)
Use the Classifier for an estimation of similarity |
protected static java.lang.String |
getTimestamp()
Gets a string containing current date and time. |
java.util.Enumeration |
listOptions()
Returns an enumeration describing the available options. |
void |
setClassifier(Classifier classifier)
Set the classifier |
void |
setNumNegPairs(int numNegPairs)
Set the number of different-class training pairs |
void |
setNumPosPairs(int numPosPairs)
Set the number of same-class training pairs |
void |
setOptions(java.lang.String[] options)
Parses a given list of options. |
void |
setSelector(PairwiseSelector selector)
Set the pairwise selector |
java.lang.String |
toString()
Obtain a textual description of the metriclearner |
void |
trainMetric(LearnableMetric metric,
Instances instances)
Train a given metric using given training instances |
Methods inherited from class weka.core.metrics.MetricLearner |
createDiffInstanceLists, createDiffInstances, createDiffInstances, forName, getAttrInfoForDiffInstance |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
protected Classifier m_classifier
protected boolean m_isDiffClassNominal
protected LearnableMetric m_metric
protected PairwiseSelector m_selector
protected int m_numPosPairs
protected int m_numNegPairs
Constructor Detail |
public ClassifierMetricLearner()
Method Detail |
public void trainMetric(LearnableMetric metric, Instances instances) throws java.lang.Exception
trainMetric
in class MetricLearner
metric
- the metric to traininstances
- data to train the metric on
java.lang.Exception
- if training has gone bad.public void setClassifier(Classifier classifier)
classifier
- the classifierpublic Classifier getClassifier()
public void setSelector(PairwiseSelector selector)
selector
- the selector for training pairspublic PairwiseSelector getSelector()
public void setNumPosPairs(int numPosPairs)
numPosPairs
- the number of same-class training pairs to create for trainingpublic int getNumPosPairs()
public void setNumNegPairs(int numNegPairs)
numNegPairs
- the number of different-class training pairs to create for trainingpublic int getNumNegPairs()
public double getSimilarity(Instance instance1, Instance instance2) throws java.lang.Exception
getSimilarity
in class MetricLearner
instance1
- first instance of a pairinstance2
- second instance of a pair
java.lang.Exception
public double getDistance(Instance instance1, Instance instance2) throws java.lang.Exception
getDistance
in class MetricLearner
instance1
- first instance of a pairinstance2
- second instance of a pair
java.lang.Exception
public java.lang.String[] getOptions()
getOptions
in interface OptionHandler
public void setOptions(java.lang.String[] options) throws java.lang.Exception
-B classifierstring
setOptions
in interface OptionHandler
options
- the list of options as an array of strings
java.lang.Exception
- if an option is not supportedprotected static java.lang.String getTimestamp()
public java.util.Enumeration listOptions()
listOptions
in interface OptionHandler
public java.lang.String toString()
public static java.lang.String concatStringArray(java.lang.String[] strings)
strings
- an array of strings
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |