|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.knime.base.node.mine.decisiontree2.learner.InMemoryTable
public class InMemoryTable
Implements a table that holds DataRowWeighted
s in memory.
Additionally, this class maintains distribution information about the class
values and possible values of nominal attributes.
Constructor Summary | |
---|---|
InMemoryTable(InMemoryTable tableTemplate)
Creates an empty table from a given template table. |
|
InMemoryTable(ValueMapper<DataCell>[] nominalAttributeValueMapper,
ValueMapper<DataCell> classValueMapper,
ValueMapper<String> attributeNameMapper,
double minNumberRowsPerNode)
Creates an empty table that keeps all rows in memory. |
Method Summary | |
---|---|
void |
addRow(DataRowWeighted row)
Adds a DataRowWeighted . |
boolean |
considerAttribute(int attributeIndex)
Returns true if the given attribute should be considered during learning, false if not. |
void |
freeUnderlyingDataRows()
Frees the underlying data rows. |
String |
getAttributeName(int index)
Returns the name of the attribute specified by the given index. |
LinkedHashMap<DataCell,Double> |
getClassFrequencies()
Returns the class frequencies as a LinkedHashMap
mapping class values (DataCell ) to the frequency as doubles. |
double[] |
getClassFrequencyArray()
Returns the class frequency array representing the class distribution of this table. |
ValueMapper<DataCell> |
getClassValueMapper()
Returns the class value mapper of this table. |
double[] |
getCopyOfClassFrequencyArray()
Returns a copy of the class frequency array representing the class distribution of this table. |
int |
getMajorityClass()
Returns the mapping value of the majority class. |
DataCell |
getMajorityClassAsCell()
Returns the majority class value as DataCell . |
double |
getMajorityClassCount()
Returns the frequency of the majoriy class. |
ValueMapper<DataCell> |
getNominalAttributeValueMapper(int attributeIndex)
Returns the attribute value mapper of this table for the given attribute. |
NominalValueHistogram |
getNominalValueHistogram(int attributeIndex)
Returns the value histogram for the given attribute index. |
DataCell[] |
getNominalValuesInMappingOrder(int attributeIndex)
Returns the nominal values for the given attribute index. |
int |
getNumAttributes()
Returns the number of attributes (excluding the class attribute). |
int |
getNumberDataRows()
Returns the size of this table. |
int |
getNumNominalValues(int attributeIndex)
Returns the number of nominal values for the given attribute. |
double |
getSumOfWeights()
Returns the sum of the weights of all rows. |
boolean |
isNominal(int index)
Whether the attribute at the given index position is nominal or not. |
boolean |
isPureEnough()
Determines if the data distribution (class value distribution) is pure enough. |
Iterator<DataRowWeighted> |
iterator()
|
void |
pack()
Sets the size of the underlying array to the number of elements in the list. |
void |
setConsiderAttribute(int attributeIndex,
boolean consider)
To set if an attribute should be considered during learning or not. |
double[] |
sortDataRows(int attributeIndex)
Sorts the data rows of this table in ascending order on the given attribute index. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public InMemoryTable(ValueMapper<DataCell>[] nominalAttributeValueMapper, ValueMapper<DataCell> classValueMapper, ValueMapper<String> attributeNameMapper, double minNumberRowsPerNode)
ValueMapper
array must contain mappers only at array positions
where a nominal attribute is available. Numeric attributes do not need a
mapper. These array positions must contain null
.
nominalAttributeValueMapper
- the value mapper for the nominal
attributes; the array must only contain mappers at positions
where nominal values are availableclassValueMapper
- the value mapper for the class attribute values
that are also stored in a integer mapped mannerattributeNameMapper
- the value mapper for the attribute namesminNumberRowsPerNode
- the minimum number of nodes per leaf; used to
determine whether this tables distribution of class values is
pure enoughpublic InMemoryTable(InMemoryTable tableTemplate)
tableTemplate
- the table that is used as a template to create this
new tableMethod Detail |
---|
public boolean considerAttribute(int attributeIndex)
attributeIndex
- the index of the attribute to get the considering
information for
public void setConsiderAttribute(int attributeIndex, boolean consider)
attributeIndex
- the index of the attribute to set the considering
information forconsider
- true - the attribute should be considered during
learning, false - the attribute should not be consideredpublic String getAttributeName(int index)
index
- the index of the attribute to get the name for
public boolean isNominal(int index)
index
- the attribute index position
public void freeUnderlyingDataRows()
public Iterator<DataRowWeighted> iterator()
iterator
in interface Iterable<DataRowWeighted>
public void addRow(DataRowWeighted row)
DataRowWeighted
.
row
- the row to addpublic double getMajorityClassCount()
public int getMajorityClass()
public DataCell getMajorityClassAsCell()
DataCell
.
DataCell
public boolean isPureEnough()
public double[] getClassFrequencyArray()
public double[] getCopyOfClassFrequencyArray()
public LinkedHashMap<DataCell,Double> getClassFrequencies()
LinkedHashMap
mapping class values (DataCell
) to the frequency as doubles.
LinkedHashMap
mapping class values (DataCell
) to the frequency as doublespublic int getNumberDataRows()
public ValueMapper<DataCell> getClassValueMapper()
public ValueMapper<DataCell> getNominalAttributeValueMapper(int attributeIndex)
attributeIndex
- the index for which to return the value mapper
null
if the attribute is not nominal
(i.e. numeric)public int getNumAttributes()
public void pack()
public double getSumOfWeights()
public int getNumNominalValues(int attributeIndex)
attributeIndex
- the nominal attribute index for which to get the
number of nominal values
public NominalValueHistogram getNominalValueHistogram(int attributeIndex)
null
is returned.
attributeIndex
- the attribute index for which to return the
histogram
null
is returnedpublic DataCell[] getNominalValuesInMappingOrder(int attributeIndex)
DataCell
mapped with integer 0 is placed first, and so on.
attributeIndex
- the attribute index for which to return the nominal
values; null
if the attribute is not nomnial
public double[] sortDataRows(int attributeIndex)
attributeIndex
- the index of the attribute on which to sort the
data rows
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |