Class WekaFileWriter

  • All Implemented Interfaces:
    AdditionalInformationHandler, CleanUpHandler, Destroyable, GlobalInfoSupporter, FileWriter, LoggingLevelHandler, LoggingSupporter, OptionHandler, QuickInfoSupporter, ShallowCopySupporter<Actor>, SizeOfHandler, Stoppable, StoppableWithFeedback, VariablesInspectionHandler, VariableChangeListener, Actor, ErrorHandler, InputConsumer, Serializable, Comparable

    public class WekaFileWriter
    extends AbstractFileWriter
    Actor for saving a weka.core.Instances object as file.
    The relation name of the incoming dataset can be used to replace the current filename (path and extension are kept). If the filename points to a directory, the relation name is simply appended.

    Input/output:
    - accepts:
       weka.core.Instances


    -logging-level <OFF|SEVERE|WARNING|INFO|CONFIG|FINE|FINER|FINEST> (property: loggingLevel)
        The logging level for outputting errors and debugging output.
        default: WARNING
     
    -name <java.lang.String> (property: name)
        The name of the actor.
        default: WekaFileWriter
     
    -annotation <adams.core.base.BaseAnnotation> (property: annotations)
        The annotations to attach to this actor.
        default:
     
    -skip <boolean> (property: skip)
        If set to true, transformation is skipped and the input token is just forwarded
        as it is.
        default: false
     
    -stop-flow-on-error <boolean> (property: stopFlowOnError)
        If set to true, the flow execution at this level gets stopped in case this
        actor encounters an error; the error gets propagated; useful for critical
        actors.
        default: false
     
    -silent <boolean> (property: silent)
        If enabled, then no errors are output in the console; Note: the enclosing
        actor handler must have this enabled as well.
        default: false
     
    -output <adams.core.io.PlaceholderFile> (property: outputFile)
        The filename of the dataset to write (the file extension determines the
        file format).
        default: ${CWD}
     
    -use-relation <boolean> (property: useRelationNameAsFilename)
        If set to true, then the relation name replaces the name of the output file;
         eg if the output file is '/some/where/file.arff' and the relation is 'anneal'
         then the resulting file name will be '/some/where/anneal.arff'; if the
        file points to a directory, then the relation name is simple appended.
        default: false
     
    -use-custom <boolean> (property: useCustomSaver)
        If set to true, then the custom saver will be used for saving the data.
        default: false
     
    -saver <weka.core.converters.AbstractFileSaver> (property: customSaver)
        The custom saver to use if enabled.
        default: weka.core.converters.SimpleArffSaver -decimal 6
     
    Author:
    fracpete (fracpete at waikato dot ac dot nz)
    See Also:
    Serialized Form
    • Field Detail

      • m_UseRelationNameAsFilename

        protected boolean m_UseRelationNameAsFilename
        whether to use the relation name as filename.
      • m_UseCustomSaver

        protected boolean m_UseCustomSaver
        whether to use a custom converter.
      • m_CustomSaver

        protected weka.core.converters.AbstractFileSaver m_CustomSaver
        the custom saver.
    • Constructor Detail

      • WekaFileWriter

        public WekaFileWriter()
    • Method Detail

      • setUseRelationNameAsFilename

        public void setUseRelationNameAsFilename​(boolean value)
        Sets whether to use the relation name as filename instead.
        Parameters:
        value - if true then the relation name will be used
      • getUseRelationNameAsFilename

        public boolean getUseRelationNameAsFilename()
        Returns whether the relation name is used as filename.
        Returns:
        true if the relation name is used
      • useRelationNameAsFilenameTipText

        public String useRelationNameAsFilenameTipText()
        Returns the tip text for this property.
        Returns:
        tip text for this property suitable for displaying in the GUI or for listing the options.
      • setUseCustomSaver

        public void setUseCustomSaver​(boolean value)
        Sets whether to use a custom saver or not.
        Parameters:
        value - if true then the custom saver will be used
      • getUseCustomSaver

        public boolean getUseCustomSaver()
        Returns whether a custom saver is used or not.
        Returns:
        true if a custom saver is used
      • useCustomSaverTipText

        public String useCustomSaverTipText()
        Returns the tip text for this property.
        Returns:
        tip text for this property suitable for displaying in the GUI or for listing the options.
      • setCustomSaver

        public void setCustomSaver​(weka.core.converters.AbstractFileSaver value)
        Sets the custom saver to use.
        Parameters:
        value - the custom saver
      • getCustomSaver

        public weka.core.converters.AbstractFileSaver getCustomSaver()
        Returns the custom saver in use.
        Returns:
        the custom saver
      • customSaverTipText

        public String customSaverTipText()
        Returns the tip text for this property.
        Returns:
        tip text for this property suitable for displaying in the GUI or for listing the options.
      • accepts

        public Class[] accepts()
        Returns the class that the consumer accepts.
        Returns:
        weka.core.Instances.class
      • doExecute

        protected String doExecute()
        Executes the flow item.
        Specified by:
        doExecute in class AbstractActor
        Returns:
        null if everything is fine, otherwise error message