Package weka.classifiers.mi
Class CitationKNN
- java.lang.Object
-
- weka.classifiers.Classifier
-
- weka.classifiers.mi.CitationKNN
-
- All Implemented Interfaces:
java.io.Serializable
,java.lang.Cloneable
,CapabilitiesHandler
,MultiInstanceCapabilitiesHandler
,OptionHandler
,RevisionHandler
,TechnicalInformationHandler
public class CitationKNN extends Classifier implements OptionHandler, MultiInstanceCapabilitiesHandler, TechnicalInformationHandler
Modified version of the Citation kNN multi instance classifier.
For more information see:
Jun Wang, Zucker, Jean-Daniel: Solving Multiple-Instance Problem: A Lazy Learning Approach. In: 17th International Conference on Machine Learning, 1119-1125, 2000. BibTeX:@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)
- Version:
- $Revision: 9146 $
- Author:
- Miguel Garcia Torres (mgarciat@ull.es)
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description CitationKNN()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
buildClassifier(Instances train)
Builds the classifiervoid
buildCNN()
generates all the variables associated to the citation classifiervoid
countBagCiters(Instance bag)
calculates the citers associated to a bagvoid
countBagReferences(Instance bag)
Calculates the references of the exemplar bagdouble
distance(Instance first, Instance second)
distance between two instancesdouble
distanceSet(Instance first, Instance second)
Calculates the distance between two instancesdouble[]
distributionForInstance(Instance bag)
Computes the distribution for a given exemplarboolean
equalExemplars(Instance exemplar1, Instance exemplar2)
Wether the instances of two exemplars are or are not equalCapabilities
getCapabilities()
Returns default capabilities of the classifier.int
getHDRank()
Returns the rank associated to the Hausdorff distanceCapabilities
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 bagsint
getNumReferences()
Returns the number of references considered to estimate the class prediction of tests bagsjava.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 filterjava.lang.String
HDRankTipText()
Returns the tip text for this propertyjava.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 propertyjava.lang.String
numReferencesTipText()
Returns the tip text for this propertyvoid
preprocessData()
Calculates the normalization of each attribute.void
setHDRank(int hDRank)
Sets the rank associated to the Hausdorff distancevoid
setNumCiters(int numCiters)
Sets the number of citers considered to estimate the class prediction of tests bagsvoid
setNumReferences(int numReferences)
Sets the number of references considered to estimate the class prediction of tests bagsvoid
setOptions(java.lang.String[] options)
Sets the OptionHandler's options using the given list.java.lang.String
toString()
returns a string representation of the classifiervoid
updateNormalization(Instance bag)
Updates the normalization of each attribute.-
Methods inherited from class weka.classifiers.Classifier
classifyInstance, debugTipText, forName, getDebug, makeCopies, makeCopy, setDebug
-
-
-
-
Method Detail
-
globalInfo
public java.lang.String globalInfo()
Returns a string describing this filter- Returns:
- a description of the filter suitable for displaying in the explorer/experimenter gui
-
getTechnicalInformation
public 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.- Specified by:
getTechnicalInformation
in interfaceTechnicalInformationHandler
- Returns:
- the technical information about this class
-
preprocessData
public void preprocessData()
Calculates the normalization of each attribute.
-
HDRankTipText
public java.lang.String HDRankTipText()
Returns the tip text for this property- Returns:
- tip text for this property suitable for displaying in the explorer/experimenter gui
-
setHDRank
public void setHDRank(int hDRank)
Sets the rank associated to the Hausdorff distance- Parameters:
hDRank
- the rank of the Hausdorff distance
-
getHDRank
public int getHDRank()
Returns the rank associated to the Hausdorff distance- Returns:
- the rank number
-
numReferencesTipText
public java.lang.String numReferencesTipText()
Returns the tip text for this property- Returns:
- tip text for this property suitable for displaying in the explorer/experimenter gui
-
setNumReferences
public void setNumReferences(int numReferences)
Sets the number of references considered to estimate the class prediction of tests bags- Parameters:
numReferences
- the number of references
-
getNumReferences
public int getNumReferences()
Returns the number of references considered to estimate the class prediction of tests bags- Returns:
- the number of references
-
numCitersTipText
public java.lang.String numCitersTipText()
Returns the tip text for this property- Returns:
- tip text for this property suitable for displaying in the explorer/experimenter gui
-
setNumCiters
public void setNumCiters(int numCiters)
Sets the number of citers considered to estimate the class prediction of tests bags- Parameters:
numCiters
- the number of citers
-
getNumCiters
public int getNumCiters()
Returns the number of citers considered to estimate the class prediction of tests bags- Returns:
- the number of citers
-
getCapabilities
public Capabilities getCapabilities()
Returns default capabilities of the classifier.- Specified by:
getCapabilities
in interfaceCapabilitiesHandler
- Overrides:
getCapabilities
in classClassifier
- Returns:
- the capabilities of this classifier
- See Also:
Capabilities
-
getMultiInstanceCapabilities
public Capabilities getMultiInstanceCapabilities()
Returns the capabilities of this multi-instance classifier for the relational data.- Specified by:
getMultiInstanceCapabilities
in interfaceMultiInstanceCapabilitiesHandler
- Returns:
- the capabilities of this object
- See Also:
Capabilities
-
buildClassifier
public void buildClassifier(Instances train) throws java.lang.Exception
Builds the classifier- Specified by:
buildClassifier
in classClassifier
- Parameters:
train
- the training data to be used for generating the boosted classifier.- Throws:
java.lang.Exception
- if the classifier could not be built successfully
-
buildCNN
public void buildCNN() throws java.lang.Exception
generates all the variables associated to the citation classifier- Throws:
java.lang.Exception
- if generation fails
-
countBagCiters
public void countBagCiters(Instance bag)
calculates the citers associated to a bag- Parameters:
bag
- the bag cited
-
countBagReferences
public void countBagReferences(Instance bag)
Calculates the references of the exemplar bag- Parameters:
bag
- the exemplar to which the nearest references will be calculated
-
distanceSet
public double distanceSet(Instance first, Instance second)
Calculates the distance between two instances- Parameters:
first
- instancesecond
- instance- Returns:
- the distance value
-
distance
public double distance(Instance first, Instance second)
distance between two instances- Parameters:
first
- the first instancesecond
- the other instance- Returns:
- the distance in double precision
-
distributionForInstance
public double[] distributionForInstance(Instance bag) throws java.lang.Exception
Computes the distribution for a given exemplar- Overrides:
distributionForInstance
in classClassifier
- Parameters:
bag
- the exemplar for which distribution is computed- Returns:
- the distribution
- Throws:
java.lang.Exception
- if the distribution can't be computed successfully
-
updateNormalization
public void updateNormalization(Instance bag)
Updates the normalization of each attribute.- Parameters:
bag
- the exemplar to update the normalization for
-
equalExemplars
public boolean equalExemplars(Instance exemplar1, Instance exemplar2)
Wether the instances of two exemplars are or are not equal- Parameters:
exemplar1
- first exemplarexemplar2
- second exemplar- Returns:
- if the instances of the exemplars are equal or not
-
listOptions
public java.util.Enumeration listOptions()
Returns an enumeration of all the available options..- Specified by:
listOptions
in interfaceOptionHandler
- Overrides:
listOptions
in classClassifier
- Returns:
- an enumeration of all available options.
-
setOptions
public void setOptions(java.lang.String[] options) throws java.lang.Exception
Sets the OptionHandler's options using the given list. All options will be set (or reset) during this call (i.e. incremental setting of options is not possible). 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)
- Specified by:
setOptions
in interfaceOptionHandler
- Overrides:
setOptions
in classClassifier
- Parameters:
options
- the list of options as an array of strings- Throws:
java.lang.Exception
- if an option is not supported
-
getOptions
public java.lang.String[] getOptions()
Gets the current option settings for the OptionHandler.- Specified by:
getOptions
in interfaceOptionHandler
- Overrides:
getOptions
in classClassifier
- Returns:
- the list of current option settings as an array of strings
-
toString
public java.lang.String toString()
returns a string representation of the classifier- Overrides:
toString
in classjava.lang.Object
- Returns:
- the string representation
-
getRevision
public java.lang.String getRevision()
Returns the revision string.- Specified by:
getRevision
in interfaceRevisionHandler
- Overrides:
getRevision
in classClassifier
- Returns:
- the revision
-
main
public static void main(java.lang.String[] argv)
Main method for testing this class.- Parameters:
argv
- should contain the command line arguments to the scheme (see Evaluation)
-
-