org.encog.ml.data.versatile

## Class NormalizationHelper

- java.lang.Object
- - org.encog.ml.data.versatile.NormalizationHelper

- All Implemented Interfaces:
    Serializable

      public class NormalizationHelper
      extends Object
      implements Serializable

  This class is used to perform normalizations for methods trained with the versatile dataset.
  See Also:
    Serialized Form

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `NormalizationHelper()`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `addSourceColumn(ColumnDefinition def)` Add a source column.
    `MLData` | `allocateInputVector()` Allocate a data item large enough to hold a single input vector.
    `MLData` | `allocateInputVector(int multiplier)` Allocate a data item large enough to hold several input vectors.
    `int` | `calculateNormalizedInputCount()`
    `int` | `calculateNormalizedOutputCount()`
    `void` | `clearInputOutput()` Clear the input/output columns, but not the source columns.
    `void` | `defineMissingHandler(ColumnDefinition colDef, MissingHandler handler)` Define a missing value handler.
    `ColumnDefinition` | `defineSourceColumn(String name, int index, ColumnType colType)` Define a source column.
    `void` | `defineUnknownValue(String str)` Define the string that signifies an unknown value (eg "?")
    `String[]` | `denormalizeOutputVectorToString(MLData output)` Denormalize a complete output vector to an array of strings.
    `CSVFormat` | `getFormat()`
    `List<ColumnDefinition>` | `getInputColumns()`
    `NormalizationStrategy` | `getNormStrategy()`
    `List<ColumnDefinition>` | `getOutputColumns()`
    `List<ColumnDefinition>` | `getSourceColumns()`
    `List<String>` | `getUnknownValues()`
    `double[]` | `normalizeInputColumn(int i, String value)` Normalize a single input column.
    `void` | `normalizeInputVector(String[] line, double[] data, boolean originalOrder)` Normalize a string array to an input vector.
    `double[]` | `normalizeOutputColumn(int i, String value)` Normalize a single output column.
    `int` | `normalizeToVector(ColumnDefinition colDef, int outputColumn, double[] output, boolean isInput, String value)` Normalize a single column to the input vector.
    `double` | `parseDouble(String str)` Parse a double, using the correct formatter.
    `void` | `setFormat(CSVFormat format)`
    `void` | `setInputColumns(List<ColumnDefinition> inputColumns)`
    `void` | `setNormStrategy(NormalizationStrategy normStrategy)`
    `void` | `setOutputColumns(List<ColumnDefinition> outputColumns)`
    `void` | `setSourceColumns(List<ColumnDefinition> sourceColumns)`
    `void` | `setStrategy(NormalizationStrategy strat)` Set the normalization strategy.
    `String` | `toString()`

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

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- - ### Constructor Detail

    - #### NormalizationHelper

          public NormalizationHelper()

  - ### Method Detail

    - #### getSourceColumns

          public List<ColumnDefinition> getSourceColumns()

      Returns:
        the sourceColumns

    - #### setSourceColumns

          public void setSourceColumns(List<ColumnDefinition> sourceColumns)

      Parameters:
        `sourceColumns` - the sourceColumns to set

    - #### getInputColumns

          public List<ColumnDefinition> getInputColumns()

      Returns:
        the inputColumns

    - #### setInputColumns

          public void setInputColumns(List<ColumnDefinition> inputColumns)

      Parameters:
        `inputColumns` - the inputColumns to set

    - #### getOutputColumns

          public List<ColumnDefinition> getOutputColumns()

      Returns:
        the outputColumns

    - #### setOutputColumns

          public void setOutputColumns(List<ColumnDefinition> outputColumns)

      Parameters:
        `outputColumns` - the outputColumns to set

    - #### getNormStrategy

          public NormalizationStrategy getNormStrategy()

      Returns:
        the normStrategy

    - #### setNormStrategy

          public void setNormStrategy(NormalizationStrategy normStrategy)

      Parameters:
        `normStrategy` - the normStrategy to set

    - #### addSourceColumn

          public void addSourceColumn(ColumnDefinition def)

      Add a source column. These define the raw input.
      Parameters:
        `def` - The column definition.

    - #### defineSourceColumn

          public ColumnDefinition defineSourceColumn(String name,
                                            int index,
                                            ColumnType colType)

      Define a source column. These define the raw input. Use this function if you know the index of the column in a non-header file.
      Parameters:
        `name` - The name of the column.
        `index` - The index of the column, needed for non-headered files.
        `colType` - The column type.
      Returns:
        The column definition

    - #### toString

          public String toString()

      Overrides:
        `toString` in class `Object`

    - #### clearInputOutput

          public void clearInputOutput()

      Clear the input/output columns, but not the source columns.

    - #### normalizeInputColumn

          public double[] normalizeInputColumn(int i,
                                      String value)

      Normalize a single input column.
      Parameters:
        `i` - The column definition index (from the input columns).
        `value` - The value to normalize.
      Returns:
        The normalized result.

    - #### normalizeOutputColumn

          public double[] normalizeOutputColumn(int i,
                                       String value)

      Normalize a single output column.
      Parameters:
        `i` - The column definition index (from the output columns).
        `value` - The value to normalize.
      Returns:
        The normalized result.

    - #### calculateNormalizedInputCount

          public int calculateNormalizedInputCount()

      Returns:
        The number of elements the input will normalize to.

    - #### calculateNormalizedOutputCount

          public int calculateNormalizedOutputCount()

      Returns:
        The number of elements the output will normalize to.

    - #### allocateInputVector

          public MLData allocateInputVector()

      Allocate a data item large enough to hold a single input vector.
      Returns:
        The data element.

    - #### allocateInputVector

          public MLData allocateInputVector(int multiplier)

      Allocate a data item large enough to hold several input vectors. This is normally used for timeslices.
      Parameters:
        `multiplier` - How many input vectors.
      Returns:
        The data element.

    - #### denormalizeOutputVectorToString

          public String[] denormalizeOutputVectorToString(MLData output)

      Denormalize a complete output vector to an array of strings.
      Parameters:
        `output` - The data vector to denorm, the source.
      Returns:
        The denormalized vector.

    - #### setStrategy

          public void setStrategy(NormalizationStrategy strat)

      Set the normalization strategy.
      Parameters:
        `strat` - The strategy.

    - #### getFormat

          public CSVFormat getFormat()

      Returns:
        the format

    - #### setFormat

          public void setFormat(CSVFormat format)

      Parameters:
        `format` - the format to set

    - #### getUnknownValues

          public List<String> getUnknownValues()

      Returns:
        the unknownValues

    - #### defineUnknownValue

          public void defineUnknownValue(String str)

      Define the string that signifies an unknown value (eg "?")
      Parameters:
        `str` - The string for unknowns.

    - #### normalizeToVector

          public int normalizeToVector(ColumnDefinition colDef,
                              int outputColumn,
                              double[] output,
                              boolean isInput,
                              String value)

      Normalize a single column to the input vector.
      Parameters:
        `colDef` - The column to normalize.
        `outputColumn` - The current position in the vector.
        `output` - The vector to output to.
        `isInput` - Is this an input column.
        `value` - The value to normalize.
      Returns:
        The new current position in the vector.

    - #### parseDouble

          public double parseDouble(String str)

      Parse a double, using the correct formatter.
      Parameters:
        `str` - The string.
      Returns:
        The double.

    - #### defineMissingHandler

          public void defineMissingHandler(ColumnDefinition colDef,
                                  MissingHandler handler)

      Define a missing value handler.
      Parameters:
        `colDef` - The column this handler applies to.
        `handler` - The handler.

    - #### normalizeInputVector

          public void normalizeInputVector(String[] line,
                                  double[] data,
                                  boolean originalOrder)

      Normalize a string array to an input vector.
      Parameters:
        `line` - The unnormalized string array.
        `data` - The output data.
        `originalOrder` - Should the output be forced into the original column order?

Copyright © 2014. All Rights Reserved.