com.rapidminer.example.set
Class MappedExampleSet

java.lang.Object
  extended by com.rapidminer.operator.AbstractIOObject
      extended by com.rapidminer.operator.ResultObjectAdapter
          extended by com.rapidminer.example.set.AbstractExampleSet
              extended by com.rapidminer.example.set.MappedExampleSet
All Implemented Interfaces:
ExampleSet, IOObject, ResultObject, LoggingHandler, java.io.Serializable, java.lang.Cloneable, java.lang.Iterable<Example>

public class MappedExampleSet
extends AbstractExampleSet

This example set uses a mapping of indices to access the examples provided by the parent example set. The mapping does not need to contain unique indices which is especially useful for sampling with replacement. For performance reasons (iterations, database access...) the mapping will be sorted during the construction of this example set (based on the parameter sort).

Please note that the constructor takes a boolean flag indicating if the examples from the given array are used or if the examples which are not part of this mapping should be used. This might be useful in the context of bootstrapped validation for example.

Author:
Ingo Mierswa, Martin Scholz
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class com.rapidminer.operator.AbstractIOObject
AbstractIOObject.InputStreamProvider
 
Constructor Summary
MappedExampleSet(ExampleSet parent, int[] mapping)
          Constructs an example set based on the given mapping.
MappedExampleSet(ExampleSet parent, int[] mapping, boolean useMappedExamples)
          Constructs an example set based on the given mapping.
MappedExampleSet(ExampleSet parent, int[] mapping, boolean useMappedExamples, boolean sort)
          Constructs an example set based on the given mapping.
MappedExampleSet(MappedExampleSet exampleSet)
          Clone constructor.
 
Method Summary
static int[] createBootstrappingMapping(ExampleSet exampleSet, int size, java.util.Random random)
          Creates a new mapping for the given example set by sampling with replacement.
static int[] createWeightedBootstrappingMapping(ExampleSet exampleSet, int size, java.util.Random random)
           
 boolean equals(java.lang.Object o)
          Returns true, if all attributes including labels and other special attributes are equal.
 Attributes getAttributes()
          Returns the data structure holding all attributes.
 Example getExample(int index)
          Returns the i-th example in the mapping.
 ExampleTable getExampleTable()
          Returns the underlying example table.
 int hashCode()
          Returns the hash code of all attributes.
 java.util.Iterator<Example> iterator()
          Returns a MappedExampleReader.
 int size()
          Counts the number of examples.
 
Methods inherited from class com.rapidminer.example.set.AbstractExampleSet
clone, copy, createDataTable, getExampleFromId, getExampleIndicesFromId, getExtension, getFileDescription, getName, getStatistics, getStatistics, recalculateAllAttributeStatistics, recalculateAttributeStatistics, remapIds, toString, writeAttributeFile, writeDataFile, writeSparseAttributeFile, writeSparseDataFile
 
Methods inherited from class com.rapidminer.operator.ResultObjectAdapter
addAction, getActions, getAnnotations, getResultIcon, log, log, logError, logNote, logWarning, toHTML, toResultString
 
Methods inherited from class com.rapidminer.operator.AbstractIOObject
appendOperatorToHistory, getLog, getProcessingHistory, getSource, initWriting, read, read, read, read, setLoggingHandler, setSource, write
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface com.rapidminer.operator.ResultObject
getActions, getResultIcon, toResultString
 
Methods inherited from interface com.rapidminer.operator.IOObject
appendOperatorToHistory, getAnnotations, getLog, getProcessingHistory, getSource, setLoggingHandler, setSource, write
 

Constructor Detail

MappedExampleSet

public MappedExampleSet(ExampleSet parent,
                        int[] mapping)
Constructs an example set based on the given mapping.


MappedExampleSet

public MappedExampleSet(ExampleSet parent,
                        int[] mapping,
                        boolean useMappedExamples)
Constructs an example set based on the given mapping. If the boolean flag useMappedExamples is false only examples which are not part of the original mapping are used.


MappedExampleSet

public MappedExampleSet(ExampleSet parent,
                        int[] mapping,
                        boolean useMappedExamples,
                        boolean sort)
Constructs an example set based on the given mapping. If the boolean flag useMappedExamples is false only examples which are not part of the original mapping are used. If the boolean flag sort is false the mapping is used as is.


MappedExampleSet

public MappedExampleSet(MappedExampleSet exampleSet)
Clone constructor.

Method Detail

equals

public boolean equals(java.lang.Object o)
Description copied from class: AbstractExampleSet
Returns true, if all attributes including labels and other special attributes are equal.

Specified by:
equals in interface ExampleSet
Overrides:
equals in class AbstractExampleSet

hashCode

public int hashCode()
Description copied from class: AbstractExampleSet
Returns the hash code of all attributes.

Specified by:
hashCode in interface ExampleSet
Overrides:
hashCode in class AbstractExampleSet

iterator

public java.util.Iterator<Example> iterator()
Returns a MappedExampleReader.


getExample

public Example getExample(int index)
Returns the i-th example in the mapping.


size

public int size()
Counts the number of examples.


getAttributes

public Attributes getAttributes()
Description copied from interface: ExampleSet
Returns the data structure holding all attributes. NOTE! if you intend to iterate over all Attributes of this ExampleSet then you need to create an Iterator by calling ExampleSet#getAttributes()#getAttributes() and use it instead.


getExampleTable

public ExampleTable getExampleTable()
Description copied from interface: ExampleSet
Returns the underlying example table. Most operators should operate on the example set and manipulate example to change table data instead of using the table directly.


createBootstrappingMapping

public static int[] createBootstrappingMapping(ExampleSet exampleSet,
                                               int size,
                                               java.util.Random random)
Creates a new mapping for the given example set by sampling with replacement.


createWeightedBootstrappingMapping

public static int[] createWeightedBootstrappingMapping(ExampleSet exampleSet,
                                                       int size,
                                                       java.util.Random random)


Copyright © 2001-2009 by Rapid-I