|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.knime.base.node.preproc.filter.row.rowfilter.RowFilter
org.knime.base.node.preproc.sample.StratifiedSamplingRowFilter
public class StratifiedSamplingRowFilter
This row filter retains the distribution of values in a certain column upon filtering out rows.
Constructor Summary | |
---|---|
StratifiedSamplingRowFilter(DataTable table,
String classColumn,
double fraction,
ExecutionMonitor exec)
Creates a new stratified sampling row filter. |
|
StratifiedSamplingRowFilter(DataTable table,
String classColumn,
double fraction,
Random random,
ExecutionMonitor exec)
Creates a new stratified sampling row filter. |
|
StratifiedSamplingRowFilter(DataTable table,
String classColumn,
int includeCount,
ExecutionMonitor exec)
Creates a new stratified sampling row filter. |
|
StratifiedSamplingRowFilter(DataTable table,
String classColumn,
int includeCount,
Random random,
ExecutionMonitor exec)
Creates a new stratified sampling row filter. |
Method Summary | |
---|---|
DataTableSpec |
configure(DataTableSpec inSpec)
Called when a new DataTableSpec is available. |
int |
getClassCount()
Returns the number of distinct values (classes) in the class column that is used for the stratified sampling. |
void |
loadSettingsFrom(NodeSettingsRO cfg)
Load your internal settings from the configuration object. |
boolean |
matches(DataRow row,
int rowIndex)
Return true if the specified row matches the criteria set
in the filter. |
protected void |
saveSettings(NodeSettingsWO cfg)
Do not call this function - rather call RowFilter.saveSettingsTo(NodeSettingsWO) . |
Methods inherited from class org.knime.base.node.preproc.filter.row.rowfilter.RowFilter |
---|
clone, saveSettingsTo |
Methods inherited from class java.lang.Object |
---|
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public StratifiedSamplingRowFilter(DataTable table, String classColumn, double fraction, ExecutionMonitor exec) throws CanceledExecutionException
table
- the table whose rows should be filtered afterwardsclassColumn
- the column with the "class" labelsfraction
- the fraction of rows that should be passed on,
i.e. not filtered outexec
- an execution monitor for cancel checking
CanceledExecutionException
- if the user canceled the executionpublic StratifiedSamplingRowFilter(DataTable table, String classColumn, double fraction, Random random, ExecutionMonitor exec) throws CanceledExecutionException
table
- the table whose rows should be filtered afterwardsclassColumn
- the column with the "class" labelsfraction
- the fraction of rows that should be passed on,
i.e. not filtered outrandom
- a random number generatorexec
- an execution monitor for cancel checking
CanceledExecutionException
- if the user canceled the executionpublic StratifiedSamplingRowFilter(DataTable table, String classColumn, int includeCount, ExecutionMonitor exec) throws CanceledExecutionException
table
- the table whose rows should be filtered afterwardsclassColumn
- the column with the "class" labelsincludeCount
- the number of rows that should be passed on i.e.
not filtered outexec
- an execution monitor for cancel checking
CanceledExecutionException
- if the user canceled the executionpublic StratifiedSamplingRowFilter(DataTable table, String classColumn, int includeCount, Random random, ExecutionMonitor exec) throws CanceledExecutionException
table
- the table whose rows should be filtered afterwardsclassColumn
- the column with the "class" labelsincludeCount
- the number of rows that should be passed on i.e.
not filtered outrandom
- a random number generatorexec
- an execution monitor for cancel checking
CanceledExecutionException
- if the user canceled the executionMethod Detail |
---|
public DataTableSpec configure(DataTableSpec inSpec) throws InvalidSettingsException
DataTableSpec
is available. The filters can
grab whatever they need from that new config (e.g. a comparator), should
do some error checking (e.g. col number against number of columns) -
throw an InvalidSettingsException
if settings are invalid, and
can return a new table spec according to their settings - if they can. If
a filter cannot tell how it would modify the spec, it should return null.
(Returned table specs are not used right now anyway.)
configure
in class RowFilter
inSpec
- the new spec propagated into the row filter node. Could be
null or empty!
InvalidSettingsException
- if the settings in the row filter are
not compatible with the table spec coming inpublic void loadSettingsFrom(NodeSettingsRO cfg) throws InvalidSettingsException
loadSettingsFrom
in class RowFilter
cfg
- the object holding the settings to load
InvalidSettingsException
- if cfg contains
invalid/incorrect/inconsistent settingspublic boolean matches(DataRow row, int rowIndex) throws EndOfTableException, IncludeFromNowOn
true
if the specified row matches the criteria set
in the filter. Can throw a EndOfTableException
if the filter can
tell that no more rows of the table will be able to fulfill the criteria.
matches
in class RowFilter
row
- the row to testrowIndex
- the row index of the passed row in the original table
true
if the row matches the criteria set in the
filter, false
if not
EndOfTableException
- if there is no chance that any of the rows
coming (including the current rowIndex
) will
fulfill the criteria, thus no further row in the original
table will be a match to this filter. (In general this is
hard to tell, but a row number filter can certainly use it.)
If the exception is received the row filter table iterator
will flag an end of table.
IncludeFromNowOn
- if the current and all following rows from now
on are to be included into the result tableprotected void saveSettings(NodeSettingsWO cfg)
RowFilter.saveSettingsTo(NodeSettingsWO)
. This is just a helper function
for RowFilter.saveSettingsTo(NodeSettingsWO)
. Row filters implement this
and do the work usually done in RowFilter.saveSettingsTo(NodeSettingsWO)
.
The passed config is prepared in a way that the factory will be able to
recreate this object from it.
saveSettings
in class RowFilter
cfg
- object to add the current internal settings topublic int getClassCount()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |