com.rapidminer.example
Interface ExampleSet

All Superinterfaces:
java.lang.Cloneable, IOObject, java.lang.Iterable<Example>, ResultObject, java.io.Serializable
All Known Implementing Classes:
AbstractExampleSet, AttributeSelectionExampleSet, AttributeWeightedExampleSet, ConditionedExampleSet, HeaderExampleSet, MappedExampleSet, ModelViewExampleSet, NonSpecialAttributesExampleSet, RemappedExampleSet, ReplaceMissingExampleSet, SimilarityExampleSet, SimpleExampleSet, SingleExampleExampleSet, SortedExampleSet, SplittedExampleSet

public interface ExampleSet
extends ResultObject, java.lang.Cloneable, java.lang.Iterable<Example>

Interface definition for all example sets. Usually, example sets do not contain any data but are only views on an example table (for example for sampling or feature selection purposes). It should be possible to create a layered view on the data, hence the name multi-layered data view. ExampleSet implementation should support this view concept.

Author:
Ingo Mierswa

Method Summary
 java.lang.Object clone()
          Clones the example set.
 boolean equals(java.lang.Object o)
          True if all attributes are equal.
 Attributes getAttributes()
          Returns the data structure holding all attributes.
 Example getExample(int index)
          Returns the i-th example.
 Example getExampleFromId(double value)
          Returns the example with the given id value.
 int[] getExampleIndicesFromId(double value)
          Returns all examples which have the given id.
 ExampleTable getExampleTable()
          Returns the underlying example table.
 double getStatistics(Attribute attribute, java.lang.String statisticsName)
          Returns the desired statistic for the given attribute.
 double getStatistics(Attribute attribute, java.lang.String statisticsName, java.lang.String statisticsParameter)
          Returns the desired statistic for the given attribute.
 int hashCode()
          Returns the hash code.
 void recalculateAllAttributeStatistics()
          Recalculate all attribute statistics.
 void recalculateAttributeStatistics(Attribute attribute)
          Recalculate the attribute statistics of the given attribute.
 void remapIds()
          Remaps all ids.
 int size()
          Returns the number of examples in this example set.
 void writeAttributeFile(java.io.File attFile, java.io.File dataFile, java.nio.charset.Charset encoding)
          Writes the attribute meta descriptions into a file.
 void writeDataFile(java.io.File dataFile, int fractionDigits, boolean quoteNominal, boolean zipped, boolean append, java.nio.charset.Charset encoding)
          Writes the data and the attribute description to a file.
 void writeSparseAttributeFile(java.io.File attFile, java.io.File dataFile, int format, java.nio.charset.Charset encoding)
          Writes the attribute meta descriptions for a sparse data file into a file.
 void writeSparseDataFile(java.io.File dataFile, int format, int fractionDigits, boolean quoteNominal, boolean zipped, boolean append, java.nio.charset.Charset encoding)
          Writes the data and the attribute description to a sparse data file.
 
Methods inherited from interface com.rapidminer.operator.ResultObject
getActions, getName, getResultIcon, getVisualizationComponent, toResultString
 
Methods inherited from interface com.rapidminer.operator.IOObject
copy, getLog, getSource, setLoggingHandler, setSource, write
 
Methods inherited from interface java.lang.Iterable
iterator
 

Method Detail

clone

java.lang.Object clone()
Clones the example set.


equals

boolean equals(java.lang.Object o)
True if all attributes are equal.

Overrides:
equals in class java.lang.Object

hashCode

int hashCode()
Returns the hash code. Two example sets must deliver the same hash code if they are equal.

Overrides:
hashCode in class java.lang.Object

getAttributes

Attributes getAttributes()
Returns the data structure holding all attributes.


size

int size()
Returns the number of examples in this example set. This number should not be used to create for-loops to iterate through all examples.


getExampleTable

ExampleTable getExampleTable()
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.


getExampleFromId

Example getExampleFromId(double value)
Returns the example with the given id value. If the example set does not contain an id attribute this method should return null.


getExampleIndicesFromId

int[] getExampleIndicesFromId(double value)
Returns all examples which have the given id. Should return null in the case that there are no examples matching that id.


getExample

Example getExample(int index)
Returns the i-th example. It is not guaranteed that asking for an example by using the index in the example table is efficiently implemented. Therefore for-loops for iterations are not an option and an ExampleReader should be used.


remapIds

void remapIds()
Remaps all ids. This method should be invoked before the method getExampleFromId(double) is used.


writeDataFile

void writeDataFile(java.io.File dataFile,
                   int fractionDigits,
                   boolean quoteNominal,
                   boolean zipped,
                   boolean append,
                   java.nio.charset.Charset encoding)
                   throws java.io.IOException
Writes the data and the attribute description to a file.

Throws:
java.io.IOException

writeAttributeFile

void writeAttributeFile(java.io.File attFile,
                        java.io.File dataFile,
                        java.nio.charset.Charset encoding)
                        throws java.io.IOException
Writes the attribute meta descriptions into a file. The data file is used in order to determine the relative file positions and is not allowed to be null.

Throws:
java.io.IOException

writeSparseDataFile

void writeSparseDataFile(java.io.File dataFile,
                         int format,
                         int fractionDigits,
                         boolean quoteNominal,
                         boolean zipped,
                         boolean append,
                         java.nio.charset.Charset encoding)
                         throws java.io.IOException
Writes the data and the attribute description to a sparse data file.

Parameters:
dataFile - the file to write the data to
format - specified by SparseFormatExampleSource
fractionDigits - the number of fraction digits (-1 for all possible digits)
Throws:
java.io.IOException

writeSparseAttributeFile

void writeSparseAttributeFile(java.io.File attFile,
                              java.io.File dataFile,
                              int format,
                              java.nio.charset.Charset encoding)
                              throws java.io.IOException
Writes the attribute meta descriptions for a sparse data file into a file. The data file is used in order to determine the relative file positions and is not allowed to be null.

Parameters:
format - specified by SparseFormatExampleSource
Throws:
java.io.IOException

recalculateAllAttributeStatistics

void recalculateAllAttributeStatistics()
Recalculate all attribute statistics.


recalculateAttributeStatistics

void recalculateAttributeStatistics(Attribute attribute)
Recalculate the attribute statistics of the given attribute.


getStatistics

double getStatistics(Attribute attribute,
                     java.lang.String statisticsName)
Returns the desired statistic for the given attribute. This method should be preferred over the deprecated method Attribute#getStatistics(String) since it correctly calculates and keep the statistics for the current example set and does not overwrite the statistics in the attribute.


getStatistics

double getStatistics(Attribute attribute,
                     java.lang.String statisticsName,
                     java.lang.String statisticsParameter)
Returns the desired statistic for the given attribute. This method should be preferred over the deprecated method Attribute#getStatistics(String) since it correctly calculates and keep the statistics for the current example set and does not overwrite the statistics in the attribute.



Copyright © 2001-2009 by Rapid-I