|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.knime.base.data.statistics.Statistics2Table
public class Statistics2Table
New statistic table utility class to compute statistical moments, such as mean, variance, column sum, count missing values, min/max values, median, and count occurrences of all possible values.
Constructor Summary | |
---|---|
Statistics2Table(BufferedDataTable table,
boolean computeMedian,
int numNomValuesOutput,
List<String> nominalValueColumns,
ExecutionContext exec)
Create new statistic table from an existing one. |
Method Summary | |
---|---|
DataTable |
createNominalValueTable(List<String> nominal)
Create nominal value table containing all possible values together with their occurrences. |
static DataTableSpec |
createOutSpecNominal(DataTableSpec inSpec,
List<String> nominalValues)
Create spec containing only nominal columns in same order as the input spec. |
static DataTableSpec |
createOutSpecNumeric(DataTableSpec inSpec)
Create spec containing only numeric columns in same order as the input spec. |
DataTable |
createStatisticMomentsTable()
Creates a table of statistic moments such as minimum, maximum, mean, standard deviation, variance, overall sum, no. |
String[] |
extractNominalColumns(List<String> nominalValues)
Returns an array of valid columns. |
String[] |
getColumnNames()
|
double[] |
getMax()
Returns the maximum for all columns. |
double[] |
getMean()
Returns the means for all columns. |
double |
getMean(int colIdx)
Returns the mean for the desired column. |
double[] |
getMedian()
Returns the median for all columns. |
double |
getMedian(int colIdx)
Returns the median for the desired column. |
double[] |
getMin()
Returns the minimum for all columns. |
Map<DataCell,Integer>[] |
getNominalValues()
Returns an array (for each column) of mappings containing DataCell value to number of occurrences. |
Map<DataCell,Integer> |
getNominalValues(int colIdx)
Returns a map containing DataCell value to number of occurrences. |
double[] |
getNumberMissingValues()
Returns an array of the number of missing values for each dimension. |
double |
getNumberMissingValues(int colIdx)
Returns the number of missing values for the given column index. |
double[] |
getStandardDeviation()
Returns the standard deviation for all columns. |
double |
getStandardDeviation(int colIdx)
Calculates the standard deviation for the desired column. |
double[] |
getSum()
Returns the sum values for all columns. |
double |
getSum(int colIdx)
Returns the sum for the desired column. |
double[] |
getVariance()
Returns the variance for all columns. |
double |
getVariance(int colIdx)
Returns the variance for the desired column. |
String |
getWarning()
Returns warning message if number of possible values exceeds predefined maximum. |
static Statistics2Table |
load(NodeSettingsRO sett)
Load a new statistic table by the given settings object. |
void |
save(NodeSettingsWO sett)
Saves this object to the given settings object. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Statistics2Table(BufferedDataTable table, boolean computeMedian, int numNomValuesOutput, List<String> nominalValueColumns, ExecutionContext exec) throws CanceledExecutionException
table
- table to be wrappedcomputeMedian
- if the median has to be computednumNomValuesOutput
- number of possible values in output tablenominalValueColumns
- columns used to determine all poss. valuesexec
- an object to check with if user canceled operation
CanceledExecutionException
- if user canceledMethod Detail |
---|
public DataTable createStatisticMomentsTable()
public DataTable createNominalValueTable(List<String> nominal)
public static DataTableSpec createOutSpecNumeric(DataTableSpec inSpec)
inSpec
- input spec
public static DataTableSpec createOutSpecNominal(DataTableSpec inSpec, List<String> nominalValues)
inSpec
- input specnominalValues
- used in map of co-occurrences
public final String[] extractNominalColumns(List<String> nominalValues)
public String[] getColumnNames()
public double getMean(int colIdx)
Double.NaN
if the specified column contains only missing cells or
if the table is empty.
colIdx
- the column index for which the mean is calculated
Double.NaN
public double[] getMean()
Double.NaN
if the
column type is not of type DoubleValue
.
Double.NaN
if the column type is not DoubleValue
public double getSum(int colIdx)
Double.NaN
if the specified column contains only missing cells or
if the table is empty.
colIdx
- the column index for which the mean is calculated
Double.NaN
public double[] getSum()
Double.NaN
if the
column type is not of type DoubleValue
.
Double.NaN
if the column type is not DoubleValue
public double[] getNumberMissingValues()
public double getNumberMissingValues(int colIdx)
colIdx
- column index to consider
public double getVariance(int colIdx)
DoubleValue
. Returns
Double.NaN
if the specified column contains only missing cells or
if the table is empty.
colIdx
- the column index for which the variance is calculated
Double.NaN
public double[] getVariance()
Double.NaN
if the
column type is not of type DoubleValue
, if the entire column
contains missing cells, or if the table is empty.
public double getStandardDeviation(int colIdx)
DoubleValue
.
Will return zero if the column contains only missing cells or the table
was empty.
colIdx
- the index of the column for which the standard deviation is
to be calculated
public double[] getStandardDeviation()
Double.NaN
) for column that are
not compatible to DoubleValue
.
public double[] getMin()
Double.NaN
for
columns that only contain missing cells or for empty data tables.
public double[] getMax()
Double.NaN
for
columns that only contain missing cells or for empty data tables.
public double getMedian(int colIdx)
colIdx
- the column index for which the median is calculated
public double[] getMedian()
public Map<DataCell,Integer> getNominalValues(int colIdx)
colIdx
- column index to return map for
public Map<DataCell,Integer>[] getNominalValues()
public String getWarning()
public static Statistics2Table load(NodeSettingsRO sett) throws InvalidSettingsException
sett
- to load this table from
InvalidSettingsException
- if the settings are corruptpublic void save(NodeSettingsWO sett)
sett
- this object is saved to
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |