|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectweka.core.Instances
weka.classifiers.rules.NNge.Exemplar
Implements Exemplar as used by NNge : parallel axis hyperrectangle.
Field Summary | |
private double |
m_ClassValue
class of the Exemplar |
private double[] |
m_MaxBorder
The max borders of the rectangle for numeric attributes |
private double[] |
m_MinBorder
The min borders of the rectangle for numeric attributes |
private int |
m_NegativeCount
Number of incorrect prediction for this examplar |
private NNge |
m_NNge
The NNge which owns this Exemplar |
private int |
m_PositiveCount
Number of correct prediction for this examplar |
private Instance |
m_PreInst
|
private double[] |
m_PreMaxBorder
the arrays used by preGeneralise |
private double[] |
m_PreMinBorder
|
private boolean[][] |
m_PreRange
|
private boolean[][] |
m_Range
The ranges of the hyperrectangle for nominal attributes |
private NNge.Exemplar |
next
|
private NNge.Exemplar |
nextWithClass
|
private NNge.Exemplar |
previous
List of all the Exemplar |
private NNge.Exemplar |
previousWithClass
List of all the Exemplar with the same class |
Fields inherited from class weka.core.Instances |
FILE_EXTENSION, m_Attributes, m_ClassIndex, m_IndicesBuffer, m_Instances, m_RelationName, m_ValueBuffer |
Constructor Summary | |
private |
NNge.Exemplar(NNge nnge,
Instances inst,
int size,
double classV)
Build a new empty Exemplar |
Method Summary | |
private double |
attrDistance(Instance inst,
int attrIndex)
Compute the distance between the projection of inst and this Exemplar along the attribute attrIndex. |
private void |
cancelGeneralisation()
Cancels a generalisation started with preGeneralise. |
private double |
classValue()
Return the class of the Exemplar |
private void |
generalise(Instance inst)
Generalise the Exemplar with inst |
private double |
getMaxBorder(int attrIndex)
Returns the value of the sup border of the hyperrectangle Returns NaN if the HyperRectangle doesn't have any border for this attribute |
private double |
getMinBorder(int attrIndex)
Returns the value of the inf border of the Exemplar. |
private int |
getNegativeCount()
Returns the number of negative classifications |
private int |
getPositiveCount()
Returns the number of positive classifications |
private boolean |
holds(Instance inst)
return true if inst is held by this Exemplar, false otherwise |
private boolean |
holds(int attrIndex,
double value)
return true if value is inside the Exemplar along the attrIndex attribute. |
private void |
incrNegativeCount()
Increment the number of negative Classifications |
private void |
incrPositiveCount()
Increment the number of positive Classifications |
private boolean |
isEmpty()
Returns true if the Exemplar is empty (i.e. doesn't yield any Instance) |
private boolean |
overlaps(NNge.Exemplar ex)
Check if the Examplar overlaps ex |
private void |
preGeneralise(Instance inst)
pre-generalise the Exemplar with inst i.e. the boundaries of the Exemplar include inst but the Exemplar still doesn't 'own' inst. |
private void |
setNegativeCount(int value)
Set the number of negative classifications |
private void |
setPositiveCount(int value)
Set the number of positive classifications |
private double |
squaredDistance(Instance inst)
Returns the square of the distance between inst and the Exemplar. |
private java.lang.String |
toRules()
Returns a string of the rules induced by this examplar |
private java.lang.String |
toString2()
Returns a description of this Exemplar |
private void |
validateGeneralisation()
Validates a generalisation started with preGeneralise. |
private double |
weight()
Return the weight of the Examplar |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
private NNge.Exemplar previous
private NNge.Exemplar next
private NNge.Exemplar previousWithClass
private NNge.Exemplar nextWithClass
private NNge m_NNge
private double m_ClassValue
private int m_PositiveCount
private int m_NegativeCount
private double[] m_MaxBorder
private double[] m_MinBorder
private boolean[][] m_Range
private double[] m_PreMaxBorder
private double[] m_PreMinBorder
private boolean[][] m_PreRange
private Instance m_PreInst
Constructor Detail |
private NNge.Exemplar(NNge nnge, Instances inst, int size, double classV)
nnge
- the classifier which owns this Exemplarinst
- the instances from which the header information is to be takensize
- the capacity of the ExemplarclassV
- the class of the ExemplarMethod Detail |
private void generalise(Instance inst) throws java.lang.Exception
java.lang.Exception
- if either the class of inst is not equal to the class of the Exemplar or inst misses a value.private void preGeneralise(Instance inst) throws java.lang.Exception
java.lang.Exception
- if either the class of inst is not equal to the class of the Exemplar or inst misses a value.private void validateGeneralisation() throws java.lang.Exception
java.lang.Exception
- is thrown if preGeneralise hasn't been called beforeprivate void cancelGeneralisation() throws java.lang.Exception
java.lang.Exception
- is thrown if preGeneralise hasn't been called beforeprivate boolean holds(Instance inst)
inst
- an Instance
private boolean holds(int attrIndex, double value)
attrIndex
- the index of an attributevalue
- a value along the attrIndexth attribute
private boolean overlaps(NNge.Exemplar ex)
ex
- an Exemplar
java.lang.Exception
private double attrDistance(Instance inst, int attrIndex)
inst
- an instanceattrIndex
- the index of the attribute
private double squaredDistance(Instance inst)
inst
- an instance
private double weight()
private double classValue()
private double getMinBorder(int attrIndex) throws java.lang.Exception
attrIndex
- the index of the attribute
java.lang.Exception
- is thrown either if the attribute is nominal or if the Exemplar is emptyprivate double getMaxBorder(int attrIndex) throws java.lang.Exception
attrIndex
- the index of the attribute
java.lang.Exception
- is thrown either if the attribute is nominal or if the Exemplar is emptyprivate int getPositiveCount()
private int getNegativeCount()
private void setPositiveCount(int value)
value
- an integer value (greater than 0 is wise...)private void setNegativeCount(int value)
value
- an integer valueprivate void incrPositiveCount()
private void incrNegativeCount()
private boolean isEmpty()
private java.lang.String toString2()
private java.lang.String toRules()
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |