weka.associations
Class Associator

java.lang.Object
  extended byweka.associations.Associator
All Implemented Interfaces:
java.lang.Cloneable, java.io.Serializable
Direct Known Subclasses:
Apriori, Tertius

public abstract class Associator
extends java.lang.Object
implements java.lang.Cloneable, java.io.Serializable

Abstract scheme for learning associations. All schemes for learning associations implemement this class

Version:
$Revision: 1.4 $
Author:
Eibe Frank (eibe@cs.waikato.ac.nz)
See Also:
Serialized Form

Constructor Summary
Associator()
           
 
Method Summary
abstract  void buildAssociations(Instances data)
          Generates an associator.
static Associator forName(java.lang.String associatorName, java.lang.String[] options)
          Creates a new instance of a associator given it's class name and (optional) arguments to pass to it's setOptions method.
static Associator[] makeCopies(Associator model, int num)
          Creates copies of the current associator.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Associator

public Associator()
Method Detail

buildAssociations

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

Parameters:
data - set of instances serving as training data
Throws:
java.lang.Exception - if the associator has not been generated successfully

forName

public static Associator forName(java.lang.String associatorName,
                                 java.lang.String[] options)
                          throws java.lang.Exception
Creates a new instance of a associator given it's class name and (optional) arguments to pass to it's setOptions method. If the associator implements OptionHandler and the options parameter is non-null, the associator will have it's options set.

Parameters:
associatorName - the fully qualified class name of the associator
options - an array of options suitable for passing to setOptions. May be null.
Returns:
the newly created associator, ready for use.
Throws:
java.lang.Exception - if the associator name is invalid, or the options supplied are not acceptable to the associator

makeCopies

public static Associator[] makeCopies(Associator model,
                                      int num)
                               throws java.lang.Exception
Creates copies of the current associator. Note that this method now uses Serialization to perform a deep copy, so the Associator object must be fully Serializable. Any currently built model will now be copied as well.

Parameters:
model - an example associator to copy
num - the number of associators copies to create.
Returns:
an array of associators.
Throws:
java.lang.Exception - if an error occurs