public class CitationKNN extends Classifier implements OptionHandler, MultiInstanceCapabilitiesHandler, TechnicalInformationHandler
@inproceedings{Wang2000, author = {Jun Wang and Zucker and Jean-Daniel}, booktitle = {17th International Conference on Machine Learning}, editor = {Pat Langley}, pages = {1119-1125}, title = {Solving Multiple-Instance Problem: A Lazy Learning Approach}, year = {2000} }Valid options are:
-R <number of references> Number of Nearest References (default 1)
-C <number of citers> Number of Nearest Citers (default 1)
-H <rank> Rank of the Hausdorff Distance (default 1)
Modifier and Type | Field and Description |
---|---|
protected Instances |
m_Attributes
attribute name structure of the relational attribute
|
protected int[] |
m_Citers
C nearest citers
|
protected boolean |
m_CitersDebug |
protected int[] |
m_Classes
Class labels for each bag
|
protected int |
m_ClassIndex
The index of the class attribute
|
protected weka.classifiers.mi.CitationKNN.NeighborList[] |
m_CNN
C nearest neighbors considering all the bags
|
protected boolean |
m_CNNDebug
Different debugging output
|
protected boolean |
m_Debug
Debugging output
|
protected boolean |
m_HDistanceDebug |
protected int |
m_HDRank
Rank associated to the Hausdorff distance
|
protected int |
m_IdIndex |
protected boolean |
m_NeighborListDebug |
protected int |
m_NumCiters
Number of citers
|
protected int |
m_NumClasses
The number of the class labels
|
protected int |
m_NumReferences
Number of references
|
protected int[] |
m_References
R nearest references
|
protected boolean |
m_ReferencesDebug |
protected Instances |
m_TrainBags
Training bags
|
Constructor and Description |
---|
CitationKNN() |
Modifier and Type | Method and Description |
---|---|
void |
buildClassifier(Instances train)
Builds the classifier
|
void |
buildCNN()
generates all the variables associated to the citation
classifier
|
void |
countBagCiters(Instance bag)
calculates the citers associated to a bag
|
void |
countBagReferences(Instance bag)
Calculates the references of the exemplar bag
|
double |
distance(Instance first,
Instance second)
distance between two instances
|
double |
distanceSet(Instance first,
Instance second)
Calculates the distance between two instances
|
double[] |
distributionForInstance(Instance bag)
Computes the distribution for a given exemplar
|
boolean |
equalExemplars(Instance exemplar1,
Instance exemplar2)
Wether the instances of two exemplars are or are not equal
|
protected weka.classifiers.mi.CitationKNN.NeighborList |
findNeighbors(Instance bag,
int kNN,
Instances bags)
Build the list of nearest k neighbors to the given test instance.
|
Capabilities |
getCapabilities()
Returns default capabilities of the classifier.
|
int |
getHDRank()
Returns the rank associated to the Hausdorff distance
|
Capabilities |
getMultiInstanceCapabilities()
Returns the capabilities of this multi-instance classifier for the
relational data.
|
int |
getNumCiters()
Returns the number of citers considered to estimate
the class prediction of tests bags
|
int |
getNumReferences()
Returns the number of references considered to estimate
the class prediction of tests bags
|
String[] |
getOptions()
Gets the current option settings for the OptionHandler.
|
String |
getRevision()
Returns the revision string.
|
TechnicalInformation |
getTechnicalInformation()
Returns an instance of a TechnicalInformation object, containing
detailed information about the technical background of this class,
e.g., paper reference or book this class is based on.
|
String |
globalInfo()
Returns a string describing this filter
|
String |
HDRankTipText()
Returns the tip text for this property
|
Enumeration |
listOptions()
Returns an enumeration of all the available options..
|
static void |
main(String[] argv)
Main method for testing this class.
|
protected double[] |
makeDistribution()
Turn the references and citers list into a probability distribution
|
String |
numCitersTipText()
Returns the tip text for this property
|
String |
numReferencesTipText()
Returns the tip text for this property
|
void |
preprocessData()
Calculates the normalization of each attribute.
|
void |
setHDRank(int hDRank)
Sets the rank associated to the Hausdorff distance
|
void |
setNumCiters(int numCiters)
Sets the number of citers considered to estimate
the class prediction of tests bags
|
void |
setNumReferences(int numReferences)
Sets the number of references considered to estimate
the class prediction of tests bags
|
void |
setOptions(String[] options)
Sets the OptionHandler's options using the given list.
|
String |
toString()
returns a string representation of the classifier
|
void |
updateNormalization(Instance bag)
Updates the normalization of each attribute.
|
classifyInstance, debugTipText, forName, getDebug, makeCopies, makeCopy, runClassifier, setDebug
protected int m_ClassIndex
protected int m_NumClasses
protected int m_IdIndex
protected boolean m_Debug
protected int[] m_Classes
protected Instances m_Attributes
protected int m_NumReferences
protected int m_NumCiters
protected Instances m_TrainBags
protected boolean m_CNNDebug
protected boolean m_CitersDebug
protected boolean m_ReferencesDebug
protected boolean m_HDistanceDebug
protected boolean m_NeighborListDebug
protected weka.classifiers.mi.CitationKNN.NeighborList[] m_CNN
protected int[] m_Citers
protected int[] m_References
protected int m_HDRank
public String globalInfo()
public TechnicalInformation getTechnicalInformation()
getTechnicalInformation
in interface TechnicalInformationHandler
public void preprocessData()
public String HDRankTipText()
public void setHDRank(int hDRank)
hDRank
- the rank of the Hausdorff distancepublic int getHDRank()
public String numReferencesTipText()
public void setNumReferences(int numReferences)
numReferences
- the number of referencespublic int getNumReferences()
public String numCitersTipText()
public void setNumCiters(int numCiters)
numCiters
- the number of citerspublic int getNumCiters()
public Capabilities getCapabilities()
getCapabilities
in interface CapabilitiesHandler
getCapabilities
in class Classifier
Capabilities
public Capabilities getMultiInstanceCapabilities()
getMultiInstanceCapabilities
in interface MultiInstanceCapabilitiesHandler
Capabilities
public void buildClassifier(Instances train) throws Exception
buildClassifier
in class Classifier
train
- the training data to be used for generating the
boosted classifier.Exception
- if the classifier could not be built successfullypublic void buildCNN() throws Exception
Exception
- if generation failspublic void countBagCiters(Instance bag)
bag
- the bag citedpublic void countBagReferences(Instance bag)
bag
- the exemplar to which the nearest references
will be calculatedprotected weka.classifiers.mi.CitationKNN.NeighborList findNeighbors(Instance bag, int kNN, Instances bags)
bag
- the bag to search for neighbors ofkNN
- the number of nearest neighborsbags
- the datapublic double distanceSet(Instance first, Instance second)
first
- instancesecond
- instancepublic double distance(Instance first, Instance second)
first
- the first instancesecond
- the other instancepublic double[] distributionForInstance(Instance bag) throws Exception
distributionForInstance
in class Classifier
bag
- the exemplar for which distribution is computedException
- if the distribution can't be computed successfullypublic void updateNormalization(Instance bag)
bag
- the exemplar to update the normalization forpublic boolean equalExemplars(Instance exemplar1, Instance exemplar2)
exemplar1
- first exemplarexemplar2
- second exemplarprotected double[] makeDistribution() throws Exception
Exception
- if computation of distribution failspublic Enumeration listOptions()
listOptions
in interface OptionHandler
listOptions
in class Classifier
public void setOptions(String[] options) throws Exception
-R <number of references> Number of Nearest References (default 1)
-C <number of citers> Number of Nearest Citers (default 1)
-H <rank> Rank of the Hausdorff Distance (default 1)
setOptions
in interface OptionHandler
setOptions
in class Classifier
options
- the list of options as an array of stringsException
- if an option is not supportedpublic String[] getOptions()
getOptions
in interface OptionHandler
getOptions
in class Classifier
public String toString()
public String getRevision()
getRevision
in interface RevisionHandler
getRevision
in class Classifier
public static void main(String[] argv)
argv
- should contain the command line arguments to the
scheme (see Evaluation)Copyright © 2015 University of Waikato, Hamilton, NZ. All rights reserved.