com.rapidminer.example.set
Class Partition

java.lang.Object
  extended by com.rapidminer.example.set.Partition
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable

public class Partition
extends java.lang.Object
implements java.lang.Cloneable, java.io.Serializable

Implements a partition. A partition is used to divide an example set into different parts of arbitrary sizes without actually make a copy of the data. Partitions are used by SplittedExampleSets. Partition numbering starts at 0.

Author:
Simon Fischer, Ingo Mierswa
See Also:
Serialized Form

Constructor Summary
Partition(double[] ratio, int size, PartitionBuilder builder)
          Creates a new partition of a given size consisting of ratio.length sets.
Partition(int[] elements, int numberOfPartitions)
          Creates a partition from the given one.
Partition(int noPartitions, int size, PartitionBuilder builder)
          Creates a new partition of a given size consisting of noPartitions equally sized sets.
 
Method Summary
 void clearSelection()
          Clears the selection, i.e. deselects all subsets.
 java.lang.Object clone()
           
 void deselectSubset(int i)
          Marks the given subset as deselected.
 boolean equals(java.lang.Object o)
           
 int getNumberOfSubsets()
          Returns the number of subsets.
 int getSelectionSize()
          Returns the number of selected elements.
 int getTotalSize()
          Returns the total number of examples.
 int hashCode()
           
 boolean hasNext(int index)
          Returns true if the last possible index stored in lastElementIndex for all currently selected partitions is not yet reached.
 void invertSelection()
           
 boolean isSelected(int index)
          Returns true iff the example with the given index is selected according to the current selection mask.
 int mapIndex(int index)
          Returns the actual example table index of the i-th example of the currently selected subset.
 void selectSubset(int i)
          Marks the given subset as selected.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Partition

public Partition(double[] ratio,
                 int size,
                 PartitionBuilder builder)
Creates a new partition of a given size consisting of ratio.length sets. The set i will be of size of size x ratio[i], i.e. the sum of all ratio[i] must be 1. Initially all partitions are selected.


Partition

public Partition(int noPartitions,
                 int size,
                 PartitionBuilder builder)
Creates a new partition of a given size consisting of noPartitions equally sized sets. Initially all partitions are selected.


Partition

public Partition(int[] elements,
                 int numberOfPartitions)
Creates a partition from the given one. Partition numbering starts at 0.

Method Detail

equals

public boolean equals(java.lang.Object o)
Overrides:
equals in class java.lang.Object

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

hasNext

public boolean hasNext(int index)
Returns true if the last possible index stored in lastElementIndex for all currently selected partitions is not yet reached. Might be used to prune iterations (especially useful for linear partitions).


clearSelection

public void clearSelection()
Clears the selection, i.e. deselects all subsets.


invertSelection

public void invertSelection()

selectSubset

public void selectSubset(int i)
Marks the given subset as selected.


deselectSubset

public void deselectSubset(int i)
Marks the given subset as deselected.


getNumberOfSubsets

public int getNumberOfSubsets()
Returns the number of subsets.


getSelectionSize

public int getSelectionSize()
Returns the number of selected elements.


getTotalSize

public int getTotalSize()
Returns the total number of examples.


isSelected

public boolean isSelected(int index)
Returns true iff the example with the given index is selected according to the current selection mask.


mapIndex

public int mapIndex(int index)
Returns the actual example table index of the i-th example of the currently selected subset.


toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

clone

public java.lang.Object clone()
Overrides:
clone in class java.lang.Object


Copyright © 2001-2009 by Rapid-I