|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface ExampleSet
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.
Field Summary | |
---|---|
static java.lang.String |
ATTRIBUTE_NAME
The name of regular attributes. |
static java.lang.String |
BATCH_NAME
The name of the special attribute batch. |
static java.lang.String |
CLUSTER_NAME
The name of the special attribute cluster. |
static java.lang.String |
CONFIDENCE_NAME
The name of the confidence special attributes. |
static java.lang.String |
ID_NAME
The name of the special attribute id. |
static java.lang.String[] |
KNOWN_ATTRIBUTE_TYPES
All known names of regular and special attribute types as an array. |
static java.lang.String |
LABEL_NAME
The name of the special attribute label. |
static java.lang.String |
PREDICTION_NAME
The name of the special attribute prediction. |
static int |
TYPE_ATTRIBUTE
Indicates a regular attribute type. |
static int |
TYPE_BATCH
Indicates the special attribute type batch (example batches). |
static int |
TYPE_CLUSTER
Indicates the special attribute type cluster. |
static int |
TYPE_ID
Indicates the special attribute type id. |
static int |
TYPE_LABEL
Indicates the special attribute type label. |
static int |
TYPE_PREDICTION
Indicates the special attribute type prediction. |
static int |
TYPE_WEIGHT
Indicates the special attribute type weight (example weights). |
static java.lang.String |
WEIGHT_NAME
The name of the special attribute weight (example weights). |
Method Summary | |
---|---|
void |
addAllAttributes(java.util.Collection<Attribute> c)
Adds all new attributes in the collection, i.e. all attributes from the given collection which were not already part of this example set. |
void |
addAttribute(Attribute attribute)
Adds a new attribute. |
void |
clearPredictedLabel()
Removes the predicted label. |
void |
clearUserData()
Clears all user data. |
void |
clearWeight()
Removes the weight attribute. |
java.lang.Object |
clone()
Clones the example set. |
boolean |
contains(Attribute attribute)
Returns true if this example set contains the given attribute. |
boolean |
containsValueType(int valueType)
Returns true if this example set contains an attribute with the given value type (see Ontology ). |
Attribute |
createClusterAttribute()
Creates a new cluster attribute of appropriate type. |
Attribute |
createSpecialAttribute(java.lang.String name,
int valueType)
Creates a new (single) special attribute with given name and value type. |
Attribute |
createWeightAttribute()
Creates a new weight attribute. |
boolean |
equals(java.lang.Object o)
True if all attributes are equal. |
Attribute |
getAttribute(int index)
Returns the Attribute with the given index. |
Attribute |
getAttribute(java.lang.String name)
Returns the attribute with the given name. |
int |
getBlockEndIndex(int startindex)
Returns the last attribute index belonging to the block starting at startindex. |
Attribute |
getCluster()
Returns the cluster attribute. |
Example |
getExample(int index)
Returns the i-th example. |
Example |
getExampleFromId(double value)
Returns the example with the given id value. |
ExampleReader |
getExampleReader()
Deprecated. Please use Iterable.iterator() instead |
ExampleTable |
getExampleTable()
Returns the underlying example table. |
Attribute |
getId()
Returns the ID attribute, i.e. an attribute containing a unique integer for each example. |
Attribute |
getLabel()
Returns the label attribute used for classification and regression. |
int |
getNumberOfAttributes()
Returns the number of attributes of the examples in this set. |
Attribute |
getPredictedLabel()
Returns the label predicted by some model. |
int |
getSize()
Deprecated. Please use the method size() instead |
Attribute |
getSpecialAttribute(java.lang.String name)
Returns the special attribute with the given name or null if no special attribute with this name exists. |
java.util.Collection<java.lang.String> |
getSpecialAttributeNames()
Returns a collection of all keys of special attributes. |
java.util.Map<java.lang.String,Attribute> |
getSpecialAttributes()
Returns a map of all special attribute names to the corresponding attributes. |
java.lang.Object |
getUserData(java.lang.String key)
Returns the user data set by setUserData() |
java.util.Set<java.lang.String> |
getUserDataKeys()
Returns all askable keys of user data. |
Attribute |
getWeight()
Returns the weight attribute. |
void |
recalculateAllAttributeStatistics()
Recalculate all attribute statistics. |
void |
recalculateAttributeStatistics(Attribute attribute)
Recalculate the attribute statistics of the given attribute. |
void |
remapAllIds()
Remaps all ids. |
void |
removeAllAttributes()
Removes all attributes. |
void |
removeAttribute(Attribute attribute)
Removes an attribute. |
Attribute |
removeAttribute(int index)
Removes the attribute with the given index. |
Attribute |
replaceAttribute(Attribute first,
Attribute second)
Replaces the first attribute by the second. |
void |
setAttributes(ExampleSet exampleSet)
Copies thie list of attributes from the given example set. |
void |
setCluster(Attribute cluster)
Sets the cluster attribute. |
void |
setId(Attribute idAttribute)
Sets the ID attribute. |
void |
setLabel(Attribute label)
Sets the label attribute used for classification and regression. |
void |
setPredictedLabel(Attribute predictedLabel)
Sets the predicted label. |
void |
setSpecialAttribute(java.lang.String name,
Attribute attribute)
Adds a special, i.e. named Attribute to the example set. |
void |
setUserData(java.lang.String key,
java.lang.Object data)
Sets arbitrary user data, e.g. to cache certain performance values etc. |
void |
setWeight(Attribute weight)
Seturns the weight attribute. |
int |
size()
Returns the number of examples in this example set. |
void |
writeAttributeFile(java.io.File attFile,
java.io.File dataFile)
Writes the attribute meta descriptions into a file. |
void |
writeDataFile(java.io.File dataFile)
Writes the data and the attribute description to a file. |
void |
writeSparseAttributeFile(java.io.File attFile,
java.io.File dataFile,
int format)
Writes the attribute meta descriptions for a sparse data file into a file. |
void |
writeSparseDataFile(java.io.File dataFile,
int format)
Writes the data and the attribute description to a sparse data file. |
Methods inherited from interface edu.udo.cs.yale.operator.ResultObject |
---|
getActions, getName, getVisualisationComponent, toResultString |
Methods inherited from interface edu.udo.cs.yale.operator.IOObject |
---|
copy, write, write |
Methods inherited from interface java.lang.Iterable |
---|
iterator |
Field Detail |
---|
static final java.lang.String ATTRIBUTE_NAME
static final java.lang.String ID_NAME
static final java.lang.String LABEL_NAME
static final java.lang.String PREDICTION_NAME
static final java.lang.String CLUSTER_NAME
static final java.lang.String WEIGHT_NAME
static final java.lang.String BATCH_NAME
static final java.lang.String CONFIDENCE_NAME
static final java.lang.String[] KNOWN_ATTRIBUTE_TYPES
static final int TYPE_ATTRIBUTE
static final int TYPE_LABEL
static final int TYPE_ID
static final int TYPE_WEIGHT
static final int TYPE_BATCH
static final int TYPE_CLUSTER
static final int TYPE_PREDICTION
Method Detail |
---|
int getNumberOfAttributes()
Attribute getAttribute(int index)
Attribute getAttribute(java.lang.String name)
boolean contains(Attribute attribute)
boolean containsValueType(int valueType)
Ontology
).
void addAttribute(Attribute attribute)
java.lang.RuntimeException
- Iff the ExampleSet already contains the attribute.void addAllAttributes(java.util.Collection<Attribute> c)
void setAttributes(ExampleSet exampleSet)
Attribute replaceAttribute(Attribute first, Attribute second)
void removeAttribute(Attribute attribute)
java.util.NoSuchElementException
- If the attribute does not exist.Attribute removeAttribute(int index)
void removeAllAttributes()
void setSpecialAttribute(java.lang.String name, Attribute attribute)
Attribute
to the example set. Special
attributes are labels, weights, etc., i.e. all non-regular attributes. If
the attribute is already defined, it is replaced. By convention, special
attributes are named lowercase. Special attributes are also delivered by
getAttribute(String name)
.
Attribute getSpecialAttribute(java.lang.String name)
java.util.Collection<java.lang.String> getSpecialAttributeNames()
java.util.Map<java.lang.String,Attribute> getSpecialAttributes()
Attribute getLabel()
void setLabel(Attribute label)
Attribute getWeight()
void setWeight(Attribute weight)
Attribute createWeightAttribute()
Attribute getPredictedLabel()
void setPredictedLabel(Attribute predictedLabel)
void clearPredictedLabel()
void clearWeight()
Attribute getCluster()
void setCluster(Attribute cluster)
Attribute createClusterAttribute() throws OperatorException
OperatorException
Attribute createSpecialAttribute(java.lang.String name, int valueType) throws OperatorException
OperatorException
Attribute getId()
void setId(Attribute idAttribute)
@Deprecated int getSize()
size()
instead
int size()
@Deprecated ExampleReader getExampleReader()
Iterable.iterator()
instead
ExampleTable getExampleTable()
Example getExampleFromId(double value)
Example getExample(int index)
ExampleReader
should be used.
void remapAllIds()
void writeDataFile(java.io.File dataFile) throws java.io.IOException
java.io.IOException
void writeAttributeFile(java.io.File attFile, java.io.File dataFile) throws java.io.IOException
java.io.IOException
void writeSparseDataFile(java.io.File dataFile, int format) throws java.io.IOException
format
- specified by SparseFormatExampleSource
java.io.IOException
void writeSparseAttributeFile(java.io.File attFile, java.io.File dataFile, int format) throws java.io.IOException
format
- specified by SparseFormatExampleSource
java.io.IOException
void setUserData(java.lang.String key, java.lang.Object data)
java.lang.Object getUserData(java.lang.String key)
setUserData(String,Object)
java.util.Set<java.lang.String> getUserDataKeys()
void clearUserData()
int getBlockEndIndex(int startindex)
java.lang.Object clone()
boolean equals(java.lang.Object o)
equals
in class java.lang.Object
void recalculateAllAttributeStatistics()
void recalculateAttributeStatistics(Attribute attribute)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |