Package weka.knowledgeflow.steps

# Class Classifier

java.lang.Object
weka.knowledgeflow.steps.BaseStep
weka.knowledgeflow.steps.WekaAlgorithmWrapper
weka.knowledgeflow.steps.Classifier

All Implemented Interfaces:
  `Serializable`, `BaseStepExtender`, `PairedDataHelper.PairedProcessor<Classifier>`, `Step`

@KFStep(name="Classifier", category="Classifiers", toolTipText="Weka classifier wrapper", iconPath="", resourceIntensive=true) public class Classifier extends WekaAlgorithmWrapper implements PairedDataHelper.PairedProcessor<Classifier>
Step that wraps a Weka classifier. Handles instance, trainingSet and testSet incoming connections. If the base classifier is Updateable, then it can be optionally updated incrementall on an incoming connection of type instance. Otherwise, instance connections are used for testing a classifier incrementally. In the case of a single incoming testSet connection it is assumed that the classifier has already been trained.

Version:
  $Revision: $
Author:
  Mark Hall (mhall{[at]}pentaho{[dot]}com)
See Also:
  - Serialized Form

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `Classifier()`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `Classifier`
  `getClassifier()`
  Get the classifier to train
  `List<String>`
  `getIncomingConnectionTypes()`
  Get a list of incoming connection types that this step can accept.
  `File`
  `getLoadClassifierFileName()`
  Get the name of the classifier to load at execution time.
  `List<String>`
  `getOutgoingConnectionTypes()`
  Get a list of outgoing connection types that this step can produce.
  `boolean`
  `getResetIncrementalClassifier()`
  Get whether to reset an incremental classifier at the start of an incoming instance stream
  `boolean`
  `getUpdateIncrementalClassifier()`
  Get whether to update an incremental classifier on an incoming instance stream
  `Class`
  `getWrappedAlgorithmClass()`
  Get the class of the algorithm being wrapped
  `void`
  `processIncoming(Data data)`
  Process an incoming data payload (if the step accepts incoming connections)
  `Classifier`
  `processPrimary(Integer setNum, Integer maxSetNum, Data data, PairedDataHelper<Classifier> helper)`
  Process a training split (primary data handled by the PairedDataHelper)
  `void`
  `processSecondary(Integer setNum, Integer maxSetNum, Data data, PairedDataHelper<Classifier> helper)`
  Process a test split/fold (secondary data handled by PairedDataHelper)
  `void`
  `setClassifier(Classifier classifier)`
  Set the classifier to train
  `void`
  `setLoadClassifierFileName(File filename)`
  Set the name of the classifier to load at execution time.
  `void`
  `setResetIncrementalClassifier(boolean reset)`
  Set whether to reset an incremental classifier at the start of an incoming instance stream
  `void`
  `setUpdateIncrementalClassifier(boolean update)`
  Set whether to update an incremental classifier on an incoming instance stream
  `void`
  `setWrappedAlgorithm(Object algo)`
  Set the wrapped algorithm
  `void`
  `stepInit()`
  Initialize the step.

  ### Methods inherited from class weka.knowledgeflow.steps.WekaAlgorithmWrapper

  `getDefaultIconPath, getDefaultPackageLevelIconPath, getIconPath, getWrappedAlgorithm, globalInfo`

  ### Methods inherited from class weka.knowledgeflow.steps.BaseStep

  `environmentSubstitute, getCustomEditorForStep, getDefaultSettings, getInteractiveViewers, getInteractiveViewersImpls, getName, getStepManager, isResourceIntensive, isStopRequested, outputStructureForConnectionType, outputStructureForConnectionType, setName, setStepIsResourceIntensive, setStepManager, setStepMustRunSingleThreaded, start, stepMustRunSingleThreaded, stop`

  ### Methods inherited from class java.lang.Object

  `equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Constructor Details

  - ### Classifier

    public Classifier()

- ## Method Details

  - ### getWrappedAlgorithmClass

    public Class getWrappedAlgorithmClass()
    Description copied from class: `WekaAlgorithmWrapper`
    Get the class of the algorithm being wrapped
    Specified by:
      `getWrappedAlgorithmClass` in class `WekaAlgorithmWrapper`
    Returns:
      the class of the algorithm being wrapped

  - ### setWrappedAlgorithm

    public void setWrappedAlgorithm(Object algo)
    Description copied from class: `WekaAlgorithmWrapper`
    Set the wrapped algorithm
    Overrides:
      `setWrappedAlgorithm` in class `WekaAlgorithmWrapper`
    Parameters:
      `algo` - the algorithm to wrao

  - ### getClassifier

    public Classifier getClassifier()
    Get the classifier to train
    Returns:
      the classifier to train

  - ### setClassifier

    @ProgrammaticProperty public void setClassifier(Classifier classifier)
    Set the classifier to train
    Parameters:
      `classifier` - the classifier to train

  - ### stepInit

    public void stepInit() throws WekaException
    Description copied from interface: `Step`
    Initialize the step.
    Specified by:
      `stepInit` in interface `BaseStepExtender`
    Specified by:
      `stepInit` in interface `Step`
    Throws:
      `WekaException` - if a problem occurs during initialization

  - ### getLoadClassifierFileName

    public File getLoadClassifierFileName()
    Get the name of the classifier to load at execution time. This only applies in the case where the only incoming connection is a test set connection (batch mode) or an instance connection (incremental mode).
    Returns:
      the name of the file to load the model from

  - ### setLoadClassifierFileName

    @OptionMetadata(displayName="Classifier model to load", description="Optional Path to a classifier to load at execution time (only applies when using testSet or instance connections)") @FilePropertyMetadata(fileChooserDialogType=0, directoriesOnly=false) public void setLoadClassifierFileName(File filename)
    Set the name of the classifier to load at execution time. This only applies in the case where the only incoming connection is a test set connection (batch mode) or an instance connection (incremental mode).
    Parameters:
      `filename` - the name of the file to load the model from

  - ### getResetIncrementalClassifier

    public boolean getResetIncrementalClassifier()
    Get whether to reset an incremental classifier at the start of an incoming instance stream
    Returns:
      true if the classifier should be reset

  - ### setResetIncrementalClassifier

    @OptionMetadata(displayName="Reset incremental classifier", description="Reset classifier (if it is incremental) at the start of the incoming instance stream") public void setResetIncrementalClassifier(boolean reset)
    Set whether to reset an incremental classifier at the start of an incoming instance stream
    Parameters:
      `reset` - true if the classifier should be reset

  - ### getUpdateIncrementalClassifier

    public boolean getUpdateIncrementalClassifier()
    Get whether to update an incremental classifier on an incoming instance stream
    Returns:
      true if an incremental classifier should be updated

  - ### setUpdateIncrementalClassifier

    @OptionMetadata(displayName="Update incremental classifier", description=" Update an incremental classifier on incoming instance stream") public void setUpdateIncrementalClassifier(boolean update)
    Set whether to update an incremental classifier on an incoming instance stream
    Parameters:
      `update` - true if an incremental classifier should be updated

  - ### processIncoming

    public void processIncoming(Data data) throws WekaException
    Description copied from class: `BaseStep`
    Process an incoming data payload (if the step accepts incoming connections)
    Specified by:
      `processIncoming` in interface `BaseStepExtender`
    Specified by:
      `processIncoming` in interface `Step`
    Overrides:
      `processIncoming` in class `BaseStep`
    Parameters:
      `data` - the payload to process
    Throws:
      `WekaException` - if a problem occurs

  - ### processPrimary

    public Classifier processPrimary(Integer setNum, Integer maxSetNum, Data data, PairedDataHelper<Classifier> helper) throws WekaException
    Process a training split (primary data handled by the PairedDataHelper)
    Specified by:
      `processPrimary` in interface `PairedDataHelper.PairedProcessor<Classifier>`
    Parameters:
      `setNum` - the number of this split/fold
      `maxSetNum` - the maximum number of splits/folds in the group
      `data` - the actual split/fold data
      `helper` - the PairedDataHelper managing the paired data
    Returns:
      a Classifier trained on this training split
    Throws:
      `WekaException` - if a problem occurs

  - ### processSecondary

    public void processSecondary(Integer setNum, Integer maxSetNum, Data data, PairedDataHelper<Classifier> helper) throws WekaException
    Process a test split/fold (secondary data handled by PairedDataHelper)
    Specified by:
      `processSecondary` in interface `PairedDataHelper.PairedProcessor<Classifier>`
    Parameters:
      `setNum` - the set number of this split/fold
      `maxSetNum` - the maximum number of splits/folds in the group
      `data` - the actual split/fold data
      `helper` - the PairedDataHelper managing the paried data
    Throws:
      `WekaException` - if a problem occurs

  - ### getIncomingConnectionTypes

    public List<String> getIncomingConnectionTypes()
    Description copied from interface: `Step`
    Get a list of incoming connection types that this step can accept. Ideally (and if appropriate), this should take into account the state of the step and any existing incoming connections. E.g. a step might be able to accept one (and only one) incoming batch data connection.
    Specified by:
      `getIncomingConnectionTypes` in interface `BaseStepExtender`
    Specified by:
      `getIncomingConnectionTypes` in interface `Step`
    Returns:
      a list of incoming connections that this step can accept given its current state

  - ### getOutgoingConnectionTypes

    public List<String> getOutgoingConnectionTypes()
    Description copied from interface: `Step`
    Get a list of outgoing connection types that this step can produce. Ideally (and if appropriate), this should take into account the state of the step and the incoming connections. E.g. depending on what incoming connection is present, a step might be able to produce a trainingSet output, a testSet output or neither, but not both.
    Specified by:
      `getOutgoingConnectionTypes` in interface `BaseStepExtender`
    Specified by:
      `getOutgoingConnectionTypes` in interface `Step`
    Returns:
      a list of outgoing connections that this step can produce