com.rapidminer.operator.io
Class ExampleSetWriter

java.lang.Object
  extended by com.rapidminer.operator.Operator
      extended by com.rapidminer.operator.io.AbstractWriter<ExampleSet>
          extended by com.rapidminer.operator.io.AbstractExampleSetWriter
              extended by com.rapidminer.operator.io.ExampleSetWriter
All Implemented Interfaces:
ConfigurationListener, PreviewListener, ParameterHandler, LoggingHandler

public class ExampleSetWriter
extends AbstractExampleSetWriter

Writes values of all examples in an ExampleSet to a file. Dense, sparse, and user defined formats (specified by the parameter 'format') can be used. Attribute description files may be generated for dense and sparse format as well. These formats can be read using the ExampleSource and SparseFormatExampleSource operators.

dense:
Each line of the generated data file is of the form
 regular attributes <special attributes>
 
For example, each line could have the form
 value1 value2 ... valueN <id> <label> <prediction> ... <confidences>
 
Values in parenthesis are optional and are only printed if they are available. The confidences are only given for nominal predictions. Other special attributes might be the example weight or the cluster number.
sparse:
Only non 0 values are written to the file, prefixed by a column index. See the description of SparseFormatExampleSource for details.
special:
Using the parameter 'special_format', the user can specify the exact format. The $ sign has a special meaning and introduces a command (the following character) Additional arguments to this command may be supplied enclosing it in square brackets.
$a:
All attributes separated by the default separator
$a[separator]:
All attributes separated by separator
$s[separator][indexSeparator]:
Sparse format. For all non zero attributes the following strings are concatenated: the column index, the value of indexSeparator, the attribute value. Attributes are separated by separator.
$v[name]:
The value of the attribute with the given name (both regular and special attributes)
$k[index]:
The value of the attribute with the given index
$l:
The label
$p:
The predicted label
$d:
All prediction confidences for all classes in the form conf(class)=value
$d[class]:
The prediction confidence for the defined class as a simple number
$i:
The id
$w:
The weight
$b:
The batch number
$n:
The newline character
$t:
The tabulator character
$$:
The dollar sign
$[:
The '[' character
$]:
The ']' character
Make sure the format string ends with $n if you want examples to be separated by newlines!

Author:
Simon Fischer, Ingo Mierswa
See Also:
ExampleSet

Field Summary
static int OVERWRITE_MODE_APPEND
           
static int OVERWRITE_MODE_NONE
           
static int OVERWRITE_MODE_OVERWRITE
           
static int OVERWRITE_MODE_OVERWRITE_FIRST
           
static java.lang.String[] OVERWRITE_MODES
           
static java.lang.String PARAMETER_ATTRIBUTE_DESCRIPTION_FILE
          The parameter name for "File to save the attribute descriptions to.
static java.lang.String PARAMETER_EXAMPLE_SET_FILE
          The parameter name for "File to save the example set to.
static java.lang.String PARAMETER_FORMAT
          The parameter name for "Format to use for output.
static java.lang.String PARAMETER_FRACTION_DIGITS
          The parameter name for "The number of fraction digits in the output file (-1: all possible digits).
static java.lang.String PARAMETER_OVERWRITE_MODE
          The parameter name for "Indicates if an existing table should be overwritten.
static java.lang.String PARAMETER_QUOTE_NOMINAL_VALUES
          Indicates if nominal values should be quoted with double quotes.
static java.lang.String PARAMETER_SPECIAL_FORMAT
          The parameter name for "Format string to use for output.
static java.lang.String PARAMETER_ZIPPED
          The parameter name for "Indicates if the data file content should be zipped.
 
Constructor Summary
ExampleSetWriter(OperatorDescription description)
           
 
Method Summary
 java.util.List<ParameterType> getParameterTypes()
          Returns a list of ParameterTypes describing the parameters of this operator.
 ExampleSet write(ExampleSet eSet)
          Creates (or reads) the ExampleSet that will be returned by AbstractWriter.apply().
 
Methods inherited from class com.rapidminer.operator.io.AbstractWriter
apply, getInputClasses, getOutputClasses
 
Methods inherited from class com.rapidminer.operator.Operator
addError, addValue, addWarning, apply, checkDeprecations, checkForStop, checkIO, checkProperties, clearErrorList, cloneOperator, createExperimentTree, createExperimentTree, createFromXML, createMarkedExperimentTree, createMarkedProcessTree, createProcessTree, createProcessTree, getAddOnlyAdditionalOutput, getApplyCount, getDeliveredOutputClasses, getDeprecationInfo, getDesiredInputClasses, getEncoding, getErrorList, getExperiment, getInnerOperatorsXML, getInput, getInput, getInput, getInputDescription, getIOContainerForInApplyLoopBreakpoint, getIODescription, getLog, getName, getOperatorClassName, getOperatorDescription, getParameter, getParameterAsBoolean, getParameterAsColor, getParameterAsDouble, getParameterAsFile, getParameterAsFile, getParameterAsInputStream, getParameterAsInt, getParameterAsMatrix, getParameterAsString, getParameterList, getParameters, getParameterType, getParent, getProcess, getStartTime, getStatus, getUserDescription, getValue, getValues, getXML, hasBreakpoint, hasBreakpoint, hasInput, inApplyLoop, isDebugMode, isEnabled, isExpanded, isParallel, isParameterSet, log, logError, logNote, logWarning, performAdditionalChecks, processFinished, processStarts, register, registerOperator, remove, rename, resume, setApplyCount, setBreakpoint, setEnabled, setExpanded, setInput, setListParameter, setOperatorParameters, setParameter, setParameters, setParent, setUserDescription, toString, unregisterOperator, writeXML
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

PARAMETER_EXAMPLE_SET_FILE

public static final java.lang.String PARAMETER_EXAMPLE_SET_FILE
The parameter name for "File to save the example set to."

See Also:
Constant Field Values

PARAMETER_ATTRIBUTE_DESCRIPTION_FILE

public static final java.lang.String PARAMETER_ATTRIBUTE_DESCRIPTION_FILE
The parameter name for "File to save the attribute descriptions to."

See Also:
Constant Field Values

PARAMETER_FORMAT

public static final java.lang.String PARAMETER_FORMAT
The parameter name for "Format to use for output."

See Also:
Constant Field Values

PARAMETER_SPECIAL_FORMAT

public static final java.lang.String PARAMETER_SPECIAL_FORMAT
The parameter name for "Format string to use for output."

See Also:
Constant Field Values

PARAMETER_FRACTION_DIGITS

public static final java.lang.String PARAMETER_FRACTION_DIGITS
The parameter name for "The number of fraction digits in the output file (-1: all possible digits)."

See Also:
Constant Field Values

PARAMETER_QUOTE_NOMINAL_VALUES

public static final java.lang.String PARAMETER_QUOTE_NOMINAL_VALUES
Indicates if nominal values should be quoted with double quotes. Quotes inside of nominal values will be escaped by a backslash.

See Also:
Constant Field Values

PARAMETER_ZIPPED

public static final java.lang.String PARAMETER_ZIPPED
The parameter name for "Indicates if the data file content should be zipped."

See Also:
Constant Field Values

PARAMETER_OVERWRITE_MODE

public static final java.lang.String PARAMETER_OVERWRITE_MODE
The parameter name for "Indicates if an existing table should be overwritten."

See Also:
Constant Field Values

OVERWRITE_MODES

public static final java.lang.String[] OVERWRITE_MODES

OVERWRITE_MODE_NONE

public static final int OVERWRITE_MODE_NONE
See Also:
Constant Field Values

OVERWRITE_MODE_OVERWRITE_FIRST

public static final int OVERWRITE_MODE_OVERWRITE_FIRST
See Also:
Constant Field Values

OVERWRITE_MODE_OVERWRITE

public static final int OVERWRITE_MODE_OVERWRITE
See Also:
Constant Field Values

OVERWRITE_MODE_APPEND

public static final int OVERWRITE_MODE_APPEND
See Also:
Constant Field Values
Constructor Detail

ExampleSetWriter

public ExampleSetWriter(OperatorDescription description)
Method Detail

write

public ExampleSet write(ExampleSet eSet)
                 throws OperatorException
Description copied from class: AbstractWriter
Creates (or reads) the ExampleSet that will be returned by AbstractWriter.apply().

Specified by:
write in class AbstractWriter<ExampleSet>
Returns:
the written IOObject itself
Throws:
OperatorException

getParameterTypes

public java.util.List<ParameterType> getParameterTypes()
Description copied from class: Operator
Returns a list of ParameterTypes describing the parameters of this operator. The default implementation returns an empty list if no input objects can be retained and special parameters for those input objects which can be prevented from being consumed.

Specified by:
getParameterTypes in interface ParameterHandler
Overrides:
getParameterTypes in class Operator


Copyright © 2001-2009 by Rapid-I