|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.rapidminer.example.Example
public class Example
An example consists of a DataRow and some convenience methods to access the data.
Hence, all values are actually doubles, symbolic values are
mapped to integers stored in doubles.
Since ExampleSets are only a view on ExampleTables,
Examples are generated on the fly by ExampleReaders. Since they only
contain the currently selected attributes operators need not to consider
attribute selections or example subsets (samplings).
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from interface java.util.Map |
|---|
java.util.Map.Entry<K,V> |
| Field Summary | |
|---|---|
static java.lang.String |
SEPARATOR
Separator used in the getAttributesAsString() method (tab). |
static java.lang.String |
SPARSE_SEPARATOR
Separates indices from values in sparse format (colon). |
| Constructor Summary | |
|---|---|
Example(DataRow data,
ExampleSet parentExampleSet)
Creates a new Example that uses the data stored in a DataRow. |
|
| Method Summary | |
|---|---|
void |
clear()
|
boolean |
containsKey(java.lang.Object key)
|
boolean |
containsValue(java.lang.Object value)
|
java.util.Set<java.util.Map.Entry<java.lang.String,java.lang.Object>> |
entrySet()
|
boolean |
equalValue(Attribute first,
Attribute second)
Returns true if both nominal values are the same (if both attributes are nominal) or if both real values are the same (if both attributes are real values) or false otherwise. |
java.lang.Object |
get(java.lang.Object key)
|
Attributes |
getAttributes()
Delivers the attributes. |
double |
getConfidence(java.lang.String classValue)
|
DataRow |
getDataRow()
Returns the data row which backs up the example in the example table. |
java.util.Date |
getDateValue(Attribute a)
Returns the date value for the given attribute. |
double |
getId()
|
double |
getLabel()
|
java.lang.String |
getNominalValue(Attribute a)
Returns the nominal value for the given attribute. |
double |
getNumericalValue(Attribute a)
Returns the numerical value for the given attribute. |
double |
getPredictedLabel()
|
double |
getValue(Attribute a)
Returns the value of attribute a. |
java.lang.String |
getValueAsString(Attribute attribute)
Returns the value of this attribute as string representation, i.e. the number as string for numerical attributes and the correctly mapped categorical value for nominal values. |
java.lang.String |
getValueAsString(Attribute attribute,
int fractionDigits,
boolean quoteNominal)
Returns the value of this attribute as string representation, i.e. the number as string for numerical attributes and the correctly mapped categorical value for nominal values. |
double |
getWeight()
|
boolean |
isEmpty()
|
java.util.Set<java.lang.String> |
keySet()
|
java.lang.Object |
put(java.lang.String attributeName,
java.lang.Object value)
|
void |
putAll(java.util.Map<? extends java.lang.String,? extends java.lang.Object> m)
|
java.lang.String |
remove(java.lang.Object key)
|
void |
setConfidence(java.lang.String classValue,
double confidence)
|
void |
setId(double value)
|
void |
setLabel(double value)
|
void |
setPredictedLabel(double value)
|
void |
setValue(Attribute a,
double value)
Sets the value of attribute a. |
void |
setValue(Attribute a,
java.lang.String str)
Sets the value of attribute a which must be a nominal attribute. |
void |
setWeight(double value)
|
int |
size()
|
java.lang.String |
toDenseString(int fractionDigits,
boolean quoteNominal)
This method returns a dense string representation of the example. |
java.lang.String |
toSparseString(int format,
int fractionDigits,
boolean quoteNominal)
Returns regular and some special attributes (label, id, and example weight) in sparse format. |
java.lang.String |
toString()
Returns a dense string representation with all possible fraction digits. |
java.util.Collection<java.lang.Object> |
values()
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface java.util.Map |
|---|
equals, hashCode |
| Field Detail |
|---|
public static final java.lang.String SEPARATOR
public static final java.lang.String SPARSE_SEPARATOR
| Constructor Detail |
|---|
public Example(DataRow data,
ExampleSet parentExampleSet)
| Method Detail |
|---|
public DataRow getDataRow()
public Attributes getAttributes()
public double getValue(Attribute a)
public java.lang.String getNominalValue(Attribute a)
AttributeTypeException - if the given attribute has the wrong value typepublic double getNumericalValue(Attribute a)
AttributeTypeException - if the given attribute has the wrong value typepublic java.util.Date getDateValue(Attribute a)
AttributeTypeException - if the given attribute has the wrong value type
public void setValue(Attribute a,
double value)
public void setValue(Attribute a,
java.lang.String str)
public boolean equalValue(Attribute first,
Attribute second)
public double getLabel()
public void setLabel(double value)
public double getPredictedLabel()
public void setPredictedLabel(double value)
public double getId()
public void setId(double value)
public double getWeight()
public void setWeight(double value)
public double getConfidence(java.lang.String classValue)
public void setConfidence(java.lang.String classValue,
double confidence)
public java.lang.String getValueAsString(Attribute attribute)
Returns the value of this attribute as string representation, i.e. the
number as string for numerical attributes and the correctly mapped
categorical value for nominal values. The used number of fraction
digits is unlimited
(see NumericalAttribute.DEFAULT_NUMBER_OF_DIGITS).
Nominal values containing whitespaces will not be quoted.
Please note that this method should not be used in order to get the
nominal values, please use
getNominalValue(Attribute) instead.
public java.lang.String getValueAsString(Attribute attribute,
int fractionDigits,
boolean quoteNominal)
Returns the value of this attribute as string representation, i.e. the
number as string for numerical attributes and the correctly mapped
categorical value for nominal values. If the value is numerical the given
number of fraction digits is used. If the value is numerical, the given
number of fraction digits is used. This value must be either one out of
NumericalAttribute.DEFAULT_NUMBER_OF_DIGITS or
NumericalAttribute.UNLIMITED_NUMBER_OF_DIGITS or a number greater
or equal to 0. The boolean flag indicates if nominal values containing
whitespaces should be quoted with double quotes.
Please note that this method should not be used in order to get the
nominal values, please use
getNominalValue(Attribute) instead.
public java.lang.String toString()
toString in class java.lang.Object
public java.lang.String toDenseString(int fractionDigits,
boolean quoteNominal)
public java.lang.String toSparseString(int format,
int fractionDigits,
boolean quoteNominal)
format - one of the formats specified in
SparseFormatDataRowReaderpublic java.lang.Object get(java.lang.Object key)
get in interface java.util.Map<java.lang.String,java.lang.Object>
public java.lang.Object put(java.lang.String attributeName,
java.lang.Object value)
put in interface java.util.Map<java.lang.String,java.lang.Object>public void clear()
clear in interface java.util.Map<java.lang.String,java.lang.Object>public boolean containsKey(java.lang.Object key)
containsKey in interface java.util.Map<java.lang.String,java.lang.Object>public boolean containsValue(java.lang.Object value)
containsValue in interface java.util.Map<java.lang.String,java.lang.Object>public java.util.Set<java.util.Map.Entry<java.lang.String,java.lang.Object>> entrySet()
entrySet in interface java.util.Map<java.lang.String,java.lang.Object>public boolean isEmpty()
isEmpty in interface java.util.Map<java.lang.String,java.lang.Object>public java.util.Set<java.lang.String> keySet()
keySet in interface java.util.Map<java.lang.String,java.lang.Object>public void putAll(java.util.Map<? extends java.lang.String,? extends java.lang.Object> m)
putAll in interface java.util.Map<java.lang.String,java.lang.Object>public java.lang.String remove(java.lang.Object key)
remove in interface java.util.Map<java.lang.String,java.lang.Object>public int size()
size in interface java.util.Map<java.lang.String,java.lang.Object>public java.util.Collection<java.lang.Object> values()
values in interface java.util.Map<java.lang.String,java.lang.Object>
|
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||