com.rapidminer.example
Class ExampleSetFactory

java.lang.Object
  extended by com.rapidminer.example.ExampleSetFactory

public class ExampleSetFactory
extends java.lang.Object

This class can be used to easily create @link ExampleSet}s and the underlying ExampleTable with simple method calls. Please note that it is often better to explicitly fill the data table yourself, or, if possible, to extend ExampleTable or DataRow to provide the necessary data to RapidMiner. For memory usage reasons, it is also often not recommended to create the data matrix from your existing data in an extra step and then use one of the factory methods. In these cases, it is better to directly fill an ExampleTable from your data source.

However, in some cases it might be more convenient to use this class in order to create example sets from data matrices in a fast and simple way. The resulting example set will be backed up by a MemoryExampleTable. If the data set at hand is completely numerical, one can simply use one of the double matrix methods provided by this class. This will lead to an ExampleSet containing only numerical attributes. Otherwise, one have to use the Object matrix methods. Please note that only String objects and Number objects (Double, Integer) are allowed in this case. Otherwise an Exception will be thrown. In case of the Object matrix methods the method tries to identify the type itself and initialized the example set with the correct attribute types (nominal or numerical).

Please note that the internal representation of the nominal attribute values depend on the order they appear in the data set. If this is not allowed (e.g. for the label attribute of different training and testing sets, where the internal representation should be the same in order to prevent label flips) one should definitely use the usual ExampleTable - ExampleSet construction where the nominal attribute value mapping can and should be performed beforehand. In these cases the usage of this class is definitely not recommended.

Author:
Ingo Mierswa

Constructor Summary
ExampleSetFactory()
           
 
Method Summary
static ExampleSet createExampleSet(double[][] data)
          Create a numerical example set from the given data matrix.
static ExampleSet createExampleSet(double[][] data, double[] labels)
          Create a numerical example set from the given data matrix.
static ExampleSet createExampleSet(double[][] data, int classColumn)
          Create a numerical example set from the given data matrix.
static ExampleSet createExampleSet(java.lang.Object[][] data)
          Create a mixed-type example set from the given data matrix.
static ExampleSet createExampleSet(java.lang.Object[][] data, int classColumn)
          Create a numerical example set from the given data matrix.
static ExampleSet createExampleSet(java.lang.Object[][] data, java.lang.Object[] labels)
          Create a numerical example set from the given data matrix.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ExampleSetFactory

public ExampleSetFactory()
Method Detail

createExampleSet

public static ExampleSet createExampleSet(double[][] data)
Create a numerical example set from the given data matrix. The resulting example set will not contain a label and consists of numerical attributes only.


createExampleSet

public static ExampleSet createExampleSet(double[][] data,
                                          int classColumn)
Create a numerical example set from the given data matrix. The label of the resulting example set be build from the column with the given index. The example set consists of numerical attributes only.


createExampleSet

public static ExampleSet createExampleSet(double[][] data,
                                          double[] labels)
Create a numerical example set from the given data matrix. The label of the resulting example set be build from the given double array. The example set consists of numerical attributes only.


createExampleSet

public static ExampleSet createExampleSet(java.lang.Object[][] data)
Create a mixed-type example set from the given data matrix. The resulting example set will not contain a label and might consist of numerical and nominal attributes.


createExampleSet

public static ExampleSet createExampleSet(java.lang.Object[][] data,
                                          int classColumn)
Create a numerical example set from the given data matrix. The label of the resulting example set be build from the column with the given index. The example set might consist of numerical and nominal attributes.


createExampleSet

public static ExampleSet createExampleSet(java.lang.Object[][] data,
                                          java.lang.Object[] labels)
Create a numerical example set from the given data matrix. The label of the resulting example set be build from the given double array. The example set might consist of numerical and nominal attributes.



Copyright © 2001-2009 by Rapid-I