|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.knime.base.node.preproc.sample.Sampler
public final class Sampler
Utility class that allows to create row filters for sampling.
Method Summary | |
---|---|
static RowFilter |
createRangeFilter(DataTable table,
double fraction,
ExecutionMonitor exec)
Creates a filter that to filter the first 100 * fraction
rows from a table. |
static RowFilter |
createRangeFilter(int count)
Creates a filter that passes only the first count rows. |
static RowFilter |
createSampleFilter(DataTable table,
double fraction,
ExecutionMonitor exec)
Creates row filter that samples precisely a given fraction of rows. |
static RowFilter |
createSampleFilter(DataTable table,
double fraction,
Random rand,
ExecutionMonitor exec)
Creates row filter that samples precisely a given fraction of rows. |
static RowFilter |
createSampleFilter(DataTable table,
int count,
ExecutionMonitor exec)
Creates row filter that samples arbitrary count rows from
table . |
static RowFilter |
createSampleFilter(DataTable table,
int count,
Random rand,
ExecutionMonitor exec)
Creates row filter that samples arbitrary count rows from
table . |
static RowFilter |
createSampleFilter(double fraction)
Creates row filter that randomly samples about 100 * fraction percent from a table. |
static DataTable |
createSamplingTable(DataTable table,
RowFilter filter)
Convenience method that creates a new DataTable that samples rows
according to a given row filter. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public static final DataTable createSamplingTable(DataTable table, RowFilter filter)
DataTable
that samples rows
according to a given row filter.
table
- the table to wrap, i.e. to sample fromfilter
- the filter to use
RowFilterTable
RowFilterTable.RowFilterTable(DataTable, RowFilter)
public static final RowFilter createRangeFilter(DataTable table, double fraction, ExecutionMonitor exec) throws CanceledExecutionException
100 * fraction
rows from a table. The row counter is determined based on the row number
of table
.
table
- the table from which to get the final row countfraction
- the fraction of the row count that shall surviveexec
- an execution monitor to check for cancelation
CanceledExecutionException
- if exec cancels the row countingpublic static final RowFilter createRangeFilter(int count)
count
rows.
count
- the number of rows that survive (starting from top)
count
rowspublic static final RowFilter createSampleFilter(double fraction)
100 * fraction
percent from a table.
fraction
- the fraction being used, must be in [0, 1]
RandomFractionRowFilter.RandomFractionRowFilter(double)
public static final RowFilter createSampleFilter(DataTable table, double fraction, ExecutionMonitor exec) throws CanceledExecutionException
table
- to count rows onfraction
- the fraction to be sampled, must be in [0, 1]exec
- to check canceled status on and report progress
CanceledExecutionException
- if canceledpublic static final RowFilter createSampleFilter(DataTable table, double fraction, Random rand, ExecutionMonitor exec) throws CanceledExecutionException
table
- to count rows onfraction
- the fraction to be sampled, must be in [0, 1]rand
- the random object for controlled sampling. (If
null
, uses default)exec
- to check canceled status on and report progress.
CanceledExecutionException
- if canceledpublic static final RowFilter createSampleFilter(DataTable table, int count, ExecutionMonitor exec) throws CanceledExecutionException
count
rows from
table
.
table
- the table from which to create the samplecount
- the number of rows the should go "through" the filterexec
- an execution monitor to check for cancelation (this method
requires an iteration over table - which might take long)
CanceledExecutionException
- if exec was canceledpublic static final RowFilter createSampleFilter(DataTable table, int count, Random rand, ExecutionMonitor exec) throws CanceledExecutionException
count
rows from
table
. A given Random object makes the sampling
"deterministic".
table
- the table from which to create the samplecount
- the number of rows the should go "through" the filterrand
- the random object for controlled sampling. (If
null
, uses default)exec
- an execution monitor to check for cancelation (this method
requires an iteration over table - which might take long)
CanceledExecutionException
- if exec was canceled
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |