com.rapidminer.example.set
Class SplittedExampleSet

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.SplittedExampleSet
All Implemented Interfaces:
ExampleSet, IOObject, ResultObject, Saveable, LoggingHandler, java.io.Serializable, java.lang.Cloneable, java.lang.Iterable<Example>

public class SplittedExampleSet
extends AbstractExampleSet

An example set that can be split into subsets by using a Partition.

Author:
Simon Fischer, Ingo Mierswa, Felix Jungermann Exp $
See Also:
Serialized Form

Field Summary
static int LINEAR_SAMPLING
          Indicates a non-shuffled sampling for partition building.
static java.lang.String[] SAMPLING_NAMES
          Indicates a non-shuffled sampling for partition building.
static int SHUFFLED_SAMPLING
          Indicates a shuffled sampling for partition building.
static int STRATIFIED_SAMPLING
          Indicates a stratified shuffled sampling for partition building.
 
Constructor Summary
SplittedExampleSet(ExampleSet exampleSet, double[] splitRatios, int samplingType, int seed)
          Creates an example set that is splitted into n subsets with the given sampling type.
SplittedExampleSet(ExampleSet exampleSet, double splitRatio, int samplingType, int seed)
          Creates an example set that is splitted into two subsets using the given sampling type.
SplittedExampleSet(ExampleSet exampleSet, int numberOfSubsets, int samplingType, int seed)
          Creates an example set that is splitted into numberOfSubsets parts with the given sampling type.
SplittedExampleSet(ExampleSet exampleSet, Partition partition)
          Constructs a SplittedExampleSet with the given partition.
SplittedExampleSet(SplittedExampleSet exampleSet)
          Clone constructor.
 
Method Summary
 void clearSelection()
          Clears the current selection
 boolean equals(java.lang.Object o)
          Returns true, if all attributes including labels and other special attributes are equal.
 int getActualParentIndex(int index)
          Returns the index of the example in the parent example set.
 Attributes getAttributes()
          Returns the data structure holding all attributes.
 Example getExample(int index)
          Searches i-th example in the currently selected partition.
 ExampleTable getExampleTable()
          Returns the underlying example table.
 int getNumberOfSubsets()
          Returns the number of subsets.
 int hashCode()
          Returns the hash code of all attributes.
 void invertSelection()
          Inverts the current selection
 java.util.Iterator<Example> iterator()
          Returns an example reader that splits all examples that are not selected.
 void selectAdditionalSubset(int index)
          Adds the given subset.
 void selectAllSubsets()
          Selects all subsets.
 void selectAllSubsetsBut(int index)
          Selects all but one subset.
 void selectSingleSubset(int index)
          Selects exactly one subset.
 int size()
          Returns the number of examples in this example set.
static SplittedExampleSet splitByAttribute(ExampleSet exampleSet, Attribute attribute)
          Works only for nominal and integer attributes.
static SplittedExampleSet splitByAttribute(ExampleSet exampleSet, Attribute attribute, double value)
          Works only for real-value attributes.
 
Methods inherited from class com.rapidminer.example.set.AbstractExampleSet
clone, copy, createDataTable, getActions, getExampleFromId, getExampleIndicesFromId, getExtension, getFileDescription, getName, getResultIcon, getStatistics, getStatistics, getVisualizationComponent, getVisualizationComponent, recalculateAllAttributeStatistics, recalculateAttributeStatistics, remapIds, toString, writeAttributeFile, writeDataFile, writeSparseAttributeFile, writeSparseDataFile
 
Methods inherited from class com.rapidminer.operator.ResultObjectAdapter
addAction, isSavable, log, logError, logNote, logWarning, save, toHTML, toResultString
 
Methods inherited from class com.rapidminer.operator.AbstractIOObject
getLog, getSource, initWriting, 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
toResultString
 
Methods inherited from interface com.rapidminer.operator.IOObject
getLog, getSource, setLoggingHandler, setSource, write
 

Field Detail

SAMPLING_NAMES

public static final java.lang.String[] SAMPLING_NAMES
Indicates a non-shuffled sampling for partition building.


LINEAR_SAMPLING

public static final int LINEAR_SAMPLING
Indicates a non-shuffled sampling for partition building.

See Also:
Constant Field Values

SHUFFLED_SAMPLING

public static final int SHUFFLED_SAMPLING
Indicates a shuffled sampling for partition building.

See Also:
Constant Field Values

STRATIFIED_SAMPLING

public static final int STRATIFIED_SAMPLING
Indicates a stratified shuffled sampling for partition building.

See Also:
Constant Field Values
Constructor Detail

SplittedExampleSet

public SplittedExampleSet(ExampleSet exampleSet,
                          Partition partition)
Constructs a SplittedExampleSet with the given partition.


SplittedExampleSet

public SplittedExampleSet(ExampleSet exampleSet,
                          double splitRatio,
                          int samplingType,
                          int seed)
Creates an example set that is splitted into two subsets using the given sampling type.


SplittedExampleSet

public SplittedExampleSet(ExampleSet exampleSet,
                          double[] splitRatios,
                          int samplingType,
                          int seed)
Creates an example set that is splitted into n subsets with the given sampling type.


SplittedExampleSet

public SplittedExampleSet(ExampleSet exampleSet,
                          int numberOfSubsets,
                          int samplingType,
                          int seed)
Creates an example set that is splitted into numberOfSubsets parts with the given sampling type.


SplittedExampleSet

public SplittedExampleSet(SplittedExampleSet 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

selectAdditionalSubset

public void selectAdditionalSubset(int index)
Adds the given subset.


selectSingleSubset

public void selectSingleSubset(int index)
Selects exactly one subset.


selectAllSubsetsBut

public void selectAllSubsetsBut(int index)
Selects all but one subset.


selectAllSubsets

public void selectAllSubsets()
Selects all subsets.


invertSelection

public void invertSelection()
Inverts the current selection


clearSelection

public void clearSelection()
Clears the current selection


getNumberOfSubsets

public int getNumberOfSubsets()
Returns the number of subsets.


iterator

public java.util.Iterator<Example> iterator()
Returns an example reader that splits all examples that are not selected.


size

public int size()
Description copied from interface: ExampleSet
Returns the number of examples in this example set. This number should not be used to create for-loops to iterate through all examples.


getExample

public Example getExample(int index)
Searches i-th example in the currently selected partition. This is done in constant time.


getActualParentIndex

public int getActualParentIndex(int index)
Returns the index of the example in the parent example set.


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.


getAttributes

public Attributes getAttributes()
Description copied from interface: ExampleSet
Returns the data structure holding all attributes.


splitByAttribute

public static SplittedExampleSet splitByAttribute(ExampleSet exampleSet,
                                                  Attribute attribute)
Works only for nominal and integer attributes. If k is the number of different values, this method splits the example set into k subsets according to the value of the given attribute.


splitByAttribute

public static SplittedExampleSet splitByAttribute(ExampleSet exampleSet,
                                                  Attribute attribute,
                                                  double value)
Works only for real-value attributes. Returns an example set splitted into two parts containing all examples providing a greater (smaller) value for the given attribute than the given value. The first partition contains all examples providing a smaller or the same value than the given one.



Copyright © 2001-2009 by Rapid-I