weka.classifiers.rules
Class NNge

java.lang.Object
  extended by weka.classifiers.AbstractClassifier
      extended by weka.classifiers.rules.NNge
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, Classifier, UpdateableClassifier, CapabilitiesHandler, OptionHandler, RevisionHandler, TechnicalInformationHandler

public class NNge
extends AbstractClassifier
implements UpdateableClassifier, OptionHandler, TechnicalInformationHandler

Nearest-neighbor-like algorithm using non-nested generalized exemplars (which are hyperrectangles that can be viewed as if-then rules). For more information, see

Brent Martin (1995). Instance-Based learning: Nearest Neighbor With Generalization. Hamilton, New Zealand.

Sylvain Roy (2002). Nearest Neighbor With Generalization. Christchurch, New Zealand.

BibTeX:

 @mastersthesis{Martin1995,
    address = {Hamilton, New Zealand},
    author = {Brent Martin},
    school = {University of Waikato},
    title = {Instance-Based learning: Nearest Neighbor With Generalization},
    year = {1995}
 }
 
 @unpublished{Roy2002,
    address = {Christchurch, New Zealand},
    author = {Sylvain Roy},
    school = {University of Canterbury},
    title = {Nearest Neighbor With Generalization},
    year = {2002}
 }
 

Valid options are:

 -G <value>
  Number of attempts of generalisation.
 
 -I <value>
  Number of folder for computing the mutual information.
 

Version:
$Revision: 5956 $
Author:
Brent Martin (bim20@cosc.canterbury.ac.nz), Sylvain Roy (sro33@student.canterbury.ac.nz)
See Also:
Serialized Form

Constructor Summary
NNge()
           
 
Method Summary
 void buildClassifier(Instances data)
          Generates a classifier.
 double classifyInstance(Instance instance)
          Classifies a given instance.
 Capabilities getCapabilities()
          Returns default capabilities of the classifier.
 int getNumAttemptsOfGeneOption()
          Gets the number of attempts for generalisation.
 int getNumFoldersMIOption()
          Gets the number of folder for mutual information.
 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 classifier
 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 numAttemptsOfGeneOptionTipText()
          Returns the tip text for this property
 java.lang.String numFoldersMIOptionTipText()
          Returns the tip text for this property
 void setNumAttemptsOfGeneOption(int newIntParameter)
          Sets the number of attempts for generalisation.
 void setNumFoldersMIOption(int newIntParameter)
          Sets the number of folder for mutual information.
 void setOptions(java.lang.String[] options)
          Sets the OptionHandler's options using the given list.
 java.lang.String toString()
          Returns a description of this classifier.
 void updateClassifier(Instance instance)
          Updates the classifier using the given instance.
 
Methods inherited from class weka.classifiers.AbstractClassifier
debugTipText, distributionForInstance, forName, getDebug, makeCopies, makeCopy, setDebug
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

NNge

public NNge()
Method Detail

globalInfo

public java.lang.String globalInfo()
Returns a string describing classifier

Returns:
a description 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 interface TechnicalInformationHandler
Returns:
the technical information about this class

getCapabilities

public Capabilities getCapabilities()
Returns default capabilities of the classifier.

Specified by:
getCapabilities in interface Classifier
Specified by:
getCapabilities in interface CapabilitiesHandler
Overrides:
getCapabilities in class AbstractClassifier
Returns:
the capabilities of this classifier
See Also:
Capabilities

buildClassifier

public void buildClassifier(Instances data)
                     throws java.lang.Exception
Generates a classifier. Must initialize all fields of the classifier that are not being set via options (ie. multiple calls of buildClassifier must always lead to the same result). Must not change the dataset in any way.

Specified by:
buildClassifier in interface Classifier
Parameters:
data - set of instances serving as training data
Throws:
java.lang.Exception - if the classifier has not been generated successfully

classifyInstance

public double classifyInstance(Instance instance)
                        throws java.lang.Exception
Classifies a given instance.

Specified by:
classifyInstance in interface Classifier
Overrides:
classifyInstance in class AbstractClassifier
Parameters:
instance - the instance to be classified
Returns:
index of the predicted class as a double
Throws:
java.lang.Exception - if instance could not be classified successfully

updateClassifier

public void updateClassifier(Instance instance)
                      throws java.lang.Exception
Updates the classifier using the given instance.

Specified by:
updateClassifier in interface UpdateableClassifier
Parameters:
instance - the instance to include
Throws:
java.lang.Exception - if instance could not be incorporated successfully

toString

public java.lang.String toString()
Returns a description of this classifier.

Overrides:
toString in class java.lang.Object
Returns:
a description of this classifier as a string.

listOptions

public java.util.Enumeration listOptions()
Returns an enumeration of all the available options..

Specified by:
listOptions in interface OptionHandler
Overrides:
listOptions in class AbstractClassifier
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:

 -G <value>
  Number of attempts of generalisation.
 
 -I <value>
  Number of folder for computing the mutual information.
 

Specified by:
setOptions in interface OptionHandler
Overrides:
setOptions in class AbstractClassifier
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 interface OptionHandler
Overrides:
getOptions in class AbstractClassifier
Returns:
the list of current option settings as an array of strings

numAttemptsOfGeneOptionTipText

public java.lang.String numAttemptsOfGeneOptionTipText()
Returns the tip text for this property

Returns:
tip text for this property suitable for displaying in the explorer/experimenter gui

getNumAttemptsOfGeneOption

public int getNumAttemptsOfGeneOption()
Gets the number of attempts for generalisation.

Returns:
the value of the option G

setNumAttemptsOfGeneOption

public void setNumAttemptsOfGeneOption(int newIntParameter)
Sets the number of attempts for generalisation.

Parameters:
newIntParameter - the new value.

numFoldersMIOptionTipText

public java.lang.String numFoldersMIOptionTipText()
Returns the tip text for this property

Returns:
tip text for this property suitable for displaying in the explorer/experimenter gui

getNumFoldersMIOption

public int getNumFoldersMIOption()
Gets the number of folder for mutual information.

Returns:
the value of the option I

setNumFoldersMIOption

public void setNumFoldersMIOption(int newIntParameter)
Sets the number of folder for mutual information.

Parameters:
newIntParameter - the new value.

getRevision

public java.lang.String getRevision()
Returns the revision string.

Specified by:
getRevision in interface RevisionHandler
Overrides:
getRevision in class AbstractClassifier
Returns:
the revision

main

public static void main(java.lang.String[] argv)
Main method for testing this class.

Parameters:
argv - should contain command line arguments for evaluation (see Evaluation).