|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectweka.deduping.metrics.InstanceMetric
Abstract InstanceMetric class for writing metrics that calculate distance between instances describing database records
Field Summary | |
protected int[] |
m_attrIdxs
indeces of attributes which the metric works on |
protected int |
m_classIndex
index of the class attribute |
protected StringMetric[][] |
m_metrics
|
protected int |
m_numActualNegPairs
|
protected int |
m_numActualPosPairs
The actual number of training pairs used in the last training round |
Constructor Summary | |
InstanceMetric()
|
Method Summary | |
abstract void |
buildInstanceMetric(int[] attrIdxs)
Generates a new InstanceMetric based on specified attributes. |
abstract double |
distance(Instance instance1,
Instance instance2)
Returns a distance value between two instances. |
static InstanceMetric |
forName(java.lang.String metricName,
java.lang.String[] options)
Creates a new instance of a metric given it's class name and (optional) arguments to pass to it's setOptions method. |
int[] |
getAttrIdxs(Instances instances)
This function takes instances, and returns an array of integers 0..(num_attributes-1) |
int[] |
getAttrIdxsWithoutLastClass(Instances instances)
It is often the case that last attribute of the data is the class. |
int[] |
getAttrIndxs()
Returns an array of attribute incece which will be used by the metric |
int |
getClassIndex(int classIndex)
Get the index of the attribute is the class attribute |
int |
getNumActualNegPairs()
Return the actual number of negative training instances used in the last training round |
int |
getNumActualPosPairs()
Return the actual number of positive training instances used in the last training round |
int |
getNumAttributes()
Get the number of attributes that the metric uses |
abstract boolean |
isDistanceBased()
The computation of a metric can be either based on distance, or on similarity |
void |
setAttrIdxs(int[] attrIdxs)
Specifies a list of attributes which will be used by the metric |
void |
setAttrIdxs(int startIdx,
int endIdx)
Specifies an interval of attributes which will be used by the metric |
void |
setClassIndex(int classIndex)
Specify which attribute is the class attribute |
abstract double |
similarity(Instance instance1,
Instance instance2)
Returns a similarity estimate between two instances. |
abstract void |
trainInstanceMetric(Instances trainData,
Instances testData)
Create a new metric for operating on specified instances |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected int[] m_attrIdxs
protected StringMetric[][] m_metrics
protected int m_classIndex
protected int m_numActualPosPairs
protected int m_numActualNegPairs
Constructor Detail |
public InstanceMetric()
Method Detail |
public abstract void buildInstanceMetric(int[] attrIdxs) throws java.lang.Exception
java.lang.Exception
- if the distance metric has not been
generated successfully.public abstract void trainInstanceMetric(Instances trainData, Instances testData) throws java.lang.Exception
trainData
- instances that the metric will be trained ontestData
- instances that the metric will be used on
java.lang.Exception
public void setAttrIdxs(int[] attrIdxs)
public int[] getAttrIndxs()
public void setAttrIdxs(int startIdx, int endIdx)
public abstract double distance(Instance instance1, Instance instance2) throws java.lang.Exception
instance1
- First instance.instance2
- Second instance.
java.lang.Exception
- if distance could not be estimated.public abstract double similarity(Instance instance1, Instance instance2) throws java.lang.Exception
instance1
- First instance.instance2
- Second instance.
java.lang.Exception
- if similarity could not be estimated.public int[] getAttrIdxsWithoutLastClass(Instances instances)
public int[] getAttrIdxs(Instances instances)
public void setClassIndex(int classIndex)
public int getClassIndex(int classIndex)
public int getNumAttributes()
public abstract boolean isDistanceBased()
public int getNumActualPosPairs()
public int getNumActualNegPairs()
public static InstanceMetric forName(java.lang.String metricName, java.lang.String[] options) throws java.lang.Exception
metricName
- the fully qualified class name of the metricoptions
- an array of options suitable for passing to setOptions. May
be null.
java.lang.Exception
- if the metric name is invalid, or the options
supplied are not acceptable to the metric
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |