Package table

Class TableMapper

java.lang.Object
table.TableMapper
All Implemented Interfaces:
Serializable

public class TableMapper extends Object implements Serializable
Class for mapping data table rows to real-valued vectors.
Since:
2007.05.16
See Also:
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final int
    use two columns for binary attributes (default: one column)
    static final int
    map both input and target attributes
    static final int
    map only the input attributes
    static final int
    map only marked columns (non-negative)
    static final int
    map only the target attribute
  • Constructor Summary

    Constructors
    Constructor
    Description
    Create a data table mapper.
    TableMapper(Table tab, int mode)
    Create a data table mapper.
  • Method Summary

    Modifier and Type
    Method
    Description
    double[]
    exec(int row)
    Execute the table map for a given row.
    double[]
    exec(int row, double[] vec)
    Execute the table map for a given row.
    double[]
    exec(int row, int mode)
    Execute the table map for a given row.
    double[]
    exec(int row, int mode, double[] vec)
    Execute the table map for a given row.
    getColumn(int id)
    Get a mapped column.
    int
    Get the number of mapped columns.
    int
    getCount(int id)
    Get the number of elements a column is mapped to.
    int
    Get the total number of elements.
    int
    Get the number of input elements.
    int
    getOffset(int id)
    Get the offset to the first element a column is mapped to.
    int
    Get the number of output elements.
    Get the underlying table.
    Get the target column.
    int
    Get the target column id.
    getVarName(int id)
    Get the name of a mapped variable.
    static void
    main(String[] args)
    Main function for testing basic functionality.
    void
    setTarget(int trgid)
    Set the target column.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • MARKED

      public static final int MARKED
      map only marked columns (non-negative)
      See Also:
    • BIN2COL

      public static final int BIN2COL
      use two columns for binary attributes (default: one column)
      See Also:
    • INPUTS

      public static final int INPUTS
      map only the input attributes
      See Also:
    • TARGET

      public static final int TARGET
      map only the target attribute
      See Also:
    • BOTH

      public static final int BOTH
      map both input and target attributes
      See Also:
  • Constructor Details

    • TableMapper

      public TableMapper(Table tab)
      Create a data table mapper.
      Parameters:
      tab - the table to map
      Since:
      2007.05.16 (Christian Borgelt)
    • TableMapper

      public TableMapper(Table tab, int mode)
      Create a data table mapper.
      Parameters:
      tab - the table to map
      mode - the mapping mode
      Since:
      2007.05.16 (Christian Borgelt)
  • Method Details

    • getTable

      public Table getTable()
      Get the underlying table.
      Returns:
      the underlying table
      Since:
      2007.05.16 (Christian Borgelt)
    • getColumnCount

      public int getColumnCount()
      Get the number of mapped columns.
      Returns:
      the number of mapped columns
      Since:
      2007.05.16 (Christian Borgelt)
    • getColumn

      public Column getColumn(int id)
      Get a mapped column.

      Note that the column id in the table mapper may differ from the column id in the underlying table if not all columns were mapped or the target column is not the last column of the table. The target column (if it has been set) can be accessed with a negative column index or with getColumnCount()-1.

      Parameters:
      id - the id of the mapped column
      Returns:
      the id-th mapped column
      Since:
      2007.05.16 (Christian Borgelt)
    • getTarget

      public Column getTarget()
      Get the target column.
      Returns:
      the target column
      Since:
      2007.05.21 (Christian Borgelt)
    • getTargetId

      public int getTargetId()
      Get the target column id.
      Returns:
      the target column id
      Since:
      2007.05.21 (Christian Borgelt)
    • getInputCount

      public int getInputCount()
      Get the number of input elements.
      Returns:
      the number of input elements
      Since:
      2007.05.16 (Christian Borgelt)
    • getOutputCount

      public int getOutputCount()
      Get the number of output elements.
      Returns:
      the number of output elements
      Since:
      2007.05.16 (Christian Borgelt)
    • getInOutCount

      public int getInOutCount()
      Get the total number of elements.
      Returns:
      the total number of elements
      Since:
      2007.05.16 (Christian Borgelt)
    • getOffset

      public int getOffset(int id)
      Get the offset to the first element a column is mapped to.
      Parameters:
      id - the id of the column
      Returns:
      the offset to the first element a column is mapped to
      Since:
      2007.05.16 (Christian Borgelt)
    • getCount

      public int getCount(int id)
      Get the number of elements a column is mapped to.
      Parameters:
      id - the id of the column
      Returns:
      the number of elements a column is mapped to
      Since:
      2007.05.16 (Christian Borgelt)
    • getVarName

      public String getVarName(int id)
      Get the name of a mapped variable.
      Parameters:
      id - the id of the variable (vector index)
      Returns:
      the name of the mapped variable
      Since:
      2007.05.16 (Christian Borgelt)
    • setTarget

      public void setTarget(int trgid)
      Set the target column.
      Parameters:
      trgid - the column id of the target attribute
      Since:
      2007.05.16 (Christian Borgelt)
    • exec

      public double[] exec(int row)
      Execute the table map for a given row.
      Parameters:
      row - the index of the row to map
      Returns:
      the numeric vector the row is mapped to
      Since:
      2007.05.16 (Christian Borgelt)
    • exec

      public double[] exec(int row, int mode)
      Execute the table map for a given row.
      Parameters:
      row - the index of the row to map
      mode - the mapping mode (e.g. INPUTS)
      Returns:
      the numeric vector the row is mapped to
      Since:
      2007.05.16 (Christian Borgelt)
    • exec

      public double[] exec(int row, double[] vec)
      Execute the table map for a given row.
      Parameters:
      row - the index of the row to map
      vec - the vector in which to store the mapped row
      Returns:
      the numeric vector the row is mapped to
      Since:
      2007.05.16 (Christian Borgelt)
    • exec

      public double[] exec(int row, int mode, double[] vec)
      Execute the table map for a given row.
      Parameters:
      row - the index of the row to map
      mode - the mapping mode (e.g. INPUTS)
      vec - the vector in which to store the mapped row
      Returns:
      the numeric vector the row is mapped to
      Since:
      2007.05.16 (Christian Borgelt)
    • main

      public static void main(String[] args)
      Main function for testing basic functionality.
      Parameters:
      args - the command line arguments
      Since:
      2007.05.16 (Christian Borgelt)