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)
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
|
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
|
java.lang.String[] |
getOptions()
Gets the current option settings for the OptionHandler.
|
java.lang.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.
|
java.lang.String |
globalInfo()
Returns a string describing this filter
|
java.lang.String |
HDRankTipText()
Returns the tip text for this property
|
java.util.Enumeration |
listOptions()
Returns an enumeration of all the available options..
|
static void |
main(java.lang.String[] argv)
Main method for testing this class.
|
java.lang.String |
numCitersTipText()
Returns the tip text for this property
|
java.lang.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(java.lang.String[] options)
Sets the OptionHandler's options using the given list.
|
java.lang.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, setDebug
public java.lang.String globalInfo()
public TechnicalInformation getTechnicalInformation()
getTechnicalInformation
in interface TechnicalInformationHandler
public void preprocessData()
public java.lang.String HDRankTipText()
public void setHDRank(int hDRank)
hDRank
- the rank of the Hausdorff distancepublic int getHDRank()
public java.lang.String numReferencesTipText()
public void setNumReferences(int numReferences)
numReferences
- the number of referencespublic int getNumReferences()
public java.lang.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 java.lang.Exception
buildClassifier
in class Classifier
train
- the training data to be used for generating the
boosted classifier.java.lang.Exception
- if the classifier could not be built successfullypublic void buildCNN() throws java.lang.Exception
java.lang.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 calculatedpublic 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 java.lang.Exception
distributionForInstance
in class Classifier
bag
- the exemplar for which distribution is computedjava.lang.Exception
- 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 exemplarpublic java.util.Enumeration listOptions()
listOptions
in interface OptionHandler
listOptions
in class Classifier
public void setOptions(java.lang.String[] options) throws java.lang.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 stringsjava.lang.Exception
- if an option is not supportedpublic java.lang.String[] getOptions()
getOptions
in interface OptionHandler
getOptions
in class Classifier
public java.lang.String toString()
toString
in class java.lang.Object
public java.lang.String getRevision()
getRevision
in interface RevisionHandler
getRevision
in class Classifier
public static void main(java.lang.String[] argv)
argv
- should contain the command line arguments to the
scheme (see Evaluation)