com.rapidminer.example.table
Class SparseFormatDataRowReader

java.lang.Object
  extended by com.rapidminer.example.table.AbstractDataRowReader
      extended by com.rapidminer.example.table.SparseFormatDataRowReader
All Implemented Interfaces:
DataRowReader, java.util.Iterator<DataRow>

public class SparseFormatDataRowReader
extends AbstractDataRowReader

Reads the data rows in sparse format. The format is specified in the class comment of SparseFormatExampleSource. Attributes may be passed to the reader in its constructor. If they are ommitted, they are generated on the fly. In either case, indices are assigned to the attributes. If an AbstractExampleTable is generated using instances of this class, the constructor of AbstractExampleTable will reassign these indexes.

Author:
Simon Fischer, Ingo Mierswa ingomierswa Exp $

Field Summary
static java.lang.String[] FORMAT_NAMES
          Names of the formats.
static int FORMAT_NO_LABEL
          Label is missing.
static int FORMAT_PREFIX
          Label has a prefix specified in the prefix map.
static int FORMAT_SEPARATE_FILE
          Label is in separate file.
static int FORMAT_XY
          Label succeeds attributes.
static int FORMAT_YX
          Label preceeds attributes.
 
Constructor Summary
SparseFormatDataRowReader(DataRowFactory factory, int format, java.util.Map<java.lang.String,java.lang.String> prefixMap, AttributeSet attributeSet, java.io.Reader attributeReader, java.io.Reader labelReader, int sampleSize)
          Creates a new data row reader for sparse format.
 
Method Summary
 boolean hasNext()
          Checks if futher examples exist.
 DataRow next()
          Returns the next Example.
 
Methods inherited from class com.rapidminer.example.table.AbstractDataRowReader
getFactory, remove
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

FORMAT_NAMES

public static final java.lang.String[] FORMAT_NAMES
Names of the formats.


FORMAT_XY

public static final int FORMAT_XY
Label succeeds attributes.

See Also:
Constant Field Values

FORMAT_YX

public static final int FORMAT_YX
Label preceeds attributes.

See Also:
Constant Field Values

FORMAT_PREFIX

public static final int FORMAT_PREFIX
Label has a prefix specified in the prefix map.

See Also:
Constant Field Values

FORMAT_SEPARATE_FILE

public static final int FORMAT_SEPARATE_FILE
Label is in separate file.

See Also:
Constant Field Values

FORMAT_NO_LABEL

public static final int FORMAT_NO_LABEL
Label is missing.

See Also:
Constant Field Values
Constructor Detail

SparseFormatDataRowReader

public SparseFormatDataRowReader(DataRowFactory factory,
                                 int format,
                                 java.util.Map<java.lang.String,java.lang.String> prefixMap,
                                 AttributeSet attributeSet,
                                 java.io.Reader attributeReader,
                                 java.io.Reader labelReader,
                                 int sampleSize)
Creates a new data row reader for sparse format. The attributes indices must not be set. If they are, they are reassigned new values when this constructor is called!

Parameters:
factory - Factory used to create DataRow instances.
format - One Out of FORMAT_XY, FORMAT_YX, FORMAT_PREFIX, and FORMAT_SEPARATE_FILE.
prefixMap - Maps prefixes to special attribute names (e.g. "l" to "label").
attributeSet - Set of regular and special attributes.
attributeReader - Reader for the data
labelReader - Reader for the labels. Only necessary if format is FORMAT_SEPARATE_FILE.
sampleSize - sample size, may be -1 for no limit.
Method Detail

hasNext

public boolean hasNext()
Checks if futher examples exist. Returns false if one of the files end.


next

public DataRow next()
Returns the next Example.



Copyright © 2001-2009 by Rapid-I