weka.knowledgeflow.steps

## Class SerializedModelSaver

- java.lang.Object
- - weka.knowledgeflow.steps.BaseStep
  - - weka.knowledgeflow.steps.SerializedModelSaver

- All Implemented Interfaces:
    java.io.Serializable, BaseStepExtender, Step

      @KFStep(name="SerializedModelSaver",
              category="DataSinks",
              toolTipText="A step that saves models to the file system",
              iconPath="weka/gui/knowledgeflow/icons/SerializedModelSaver.gif")
      public class SerializedModelSaver
      extends BaseStep

  Step that can save models encapsulated in incoming `Data` objects to the filesystem.
  Version:
    $Revision: $
  Author:
    Mark Hall (mhall{[at]}pentaho{[dot]}com)
  See Also:
    Serialized Form

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `SerializedModelSaver()`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `java.lang.String` | `getFilenamePrefix()` Get the text to prepend to the filename
    `boolean` | `getIncludeRelationNameInFilename()` Get whether to include the relation name as part of the filename
    `java.util.List<java.lang.String>` | `getIncomingConnectionTypes()` Get a list of incoming connection types that this step can accept.
    `int` | `getIncrementalSaveSchedule()` Get how frequently to save an incremental model
    `java.util.List<java.lang.String>` | `getOutgoingConnectionTypes()` Get a list of outgoing connection types that this step can produce.
    `java.io.File` | `getOutputDirectory()` Get the directory to save to
    `void` | `processIncoming(Data data)` Process an incoming data payload (if the step accepts incoming connections)
    `void` | `setFilenamePrefix(java.lang.String filenamePrefix)` Set the text to prepend to the filename
    `void` | `setIncludeRelationNameInFilename(boolean includeRelationName)` Set whether to include the relation name as part of the filename
    `void` | `setIncrementalSaveSchedule(int schedule)` Set how frequently to save an incremental model
    `void` | `setOutputDirectory(java.io.File directory)` Set the directory to save to
    `void` | `stepInit()` Initialize the step

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

      `environmentSubstitute, getCustomEditorForStep, getDefaultSettings, getInteractiveViewers, getInteractiveViewersImpls, getName, getStepManager, globalInfo, isResourceIntensive, isStopRequested, 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 Detail

    - #### SerializedModelSaver

          public SerializedModelSaver()

  - ### Method Detail

    - #### setOutputDirectory

          @FilePropertyMetadata(fileChooserDialogType=1,
                                directoriesOnly=true)
           @OptionMetadata(displayName="Output directory",
                          description="The directory to save models to",
                          displayOrder=0)
          public void setOutputDirectory(java.io.File directory)

      Set the directory to save to
      Parameters:
        `directory` - the directory to save to

    - #### getOutputDirectory

          public java.io.File getOutputDirectory()

      Get the directory to save to
      Returns:
        the directory to save to

    - #### setFilenamePrefix

          @OptionMetadata(displayName="Filename prefix",
                          description="A prefix to prepend to the filename",
                          displayOrder=1)
          public void setFilenamePrefix(java.lang.String filenamePrefix)

      Set the text to prepend to the filename
      Parameters:
        `filenamePrefix` - the prefix to add to the filename

    - #### getFilenamePrefix

          public java.lang.String getFilenamePrefix()

      Get the text to prepend to the filename
      Returns:
        the prefix to add to the filename

    - #### setIncrementalSaveSchedule

          @OptionMetadata(displayName="Incremental save schedule",
                          description="How frequently to save incremental classifiers (<= 0 indicates that the save will happen just once, at the end of the stream",
                          displayOrder=4)
          public void setIncrementalSaveSchedule(int schedule)

      Set how frequently to save an incremental model
      Parameters:
        `schedule` - how often (i.e. every x updates) to save the model. <= 0 indicates that the save will happen just once, at the end of the stream.

    - #### getIncrementalSaveSchedule

          public int getIncrementalSaveSchedule()

      Get how frequently to save an incremental model
      Returns:
        how often (i.e. every x updates) to save the model. <= 0 indicates that the save will happen just once, at the end of the stream.

    - #### setIncludeRelationNameInFilename

          @OptionMetadata(displayName="Include relation name in file name",
                          description="Whether to include the relation name of the data as part of the file name",
                          displayOrder=2)
          public void setIncludeRelationNameInFilename(boolean includeRelationName)

      Set whether to include the relation name as part of the filename
      Parameters:
        `includeRelationName` - true to include the relation name as part of the filename

    - #### getIncludeRelationNameInFilename

          public boolean getIncludeRelationNameInFilename()

      Get whether to include the relation name as part of the filename
      Returns:
        true if the relation name will be included as part of the filename

    - #### getIncomingConnectionTypes

          public java.util.List<java.lang.String> getIncomingConnectionTypes()

      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.
      Returns:
        a list of incoming connections that this step can accept given its current state

    - #### getOutgoingConnectionTypes

          public java.util.List<java.lang.String> getOutgoingConnectionTypes()

      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.
      Returns:
        a list of outgoing connections that this step can produce

    - #### stepInit

          public void stepInit()

      Initialize the step

    - #### processIncoming

          public void processIncoming(Data data)
                               throws WekaException

      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 data to process
      Throws:
        `WekaException` - if a problem occurs