public final class Sampler extends Object
Modifier and Type | Method and Description |
---|---|
static IRowFilter |
createRangeFilter(DataTable table,
double fraction,
ExecutionMonitor exec)
Creates a filter that to filter the first
100 * fraction
rows from a table. |
static IRowFilter |
createRangeFilter(long count)
Creates a filter that passes only the first
count rows. |
static IRowFilter |
createSampleFilter(DataTable table,
double fraction,
ExecutionMonitor exec)
Creates row filter that samples precisely a given fraction of rows.
|
static IRowFilter |
createSampleFilter(DataTable table,
double fraction,
Random rand,
ExecutionMonitor exec)
Creates row filter that samples precisely a given fraction of rows.
|
static IRowFilter |
createSampleFilter(DataTable table,
long count,
ExecutionMonitor exec)
Creates row filter that samples arbitrary
count rows from
table . |
static IRowFilter |
createSampleFilter(DataTable table,
long count,
Random rand,
ExecutionMonitor exec)
Creates row filter that samples arbitrary
count rows from
table . |
static IRowFilter |
createSampleFilter(double fraction)
Creates row filter that randomly samples about
100 * fraction percent from a table. |
static DataTable |
createSamplingTable(DataTable table,
IRowFilter filter)
Convenience method that creates a new
DataTable that samples rows
according to a given row filter. |
public static final DataTable createSamplingTable(DataTable table, IRowFilter filter)
DataTable
that samples rows
according to a given row filter.table
- the table to wrap, i.e. to sample fromfilter
- the filter to useRowFilterTable
RowFilterTable.RowFilterTable(DataTable, RowFilter)
public static final IRowFilter 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 cancelationCanceledExecutionException
- if exec cancels the row countingpublic static final IRowFilter createRangeFilter(long count)
count
rows.count
- the number of rows that survive (starting from top)count
rowspublic static final IRowFilter 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 IRowFilter 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 progressCanceledExecutionException
- if canceledpublic static final IRowFilter 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 IRowFilter createSampleFilter(DataTable table, long 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 IRowFilter createSampleFilter(DataTable table, long 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
KNIME GmbH, Konstanz, Germany
You may not modify, publish, transmit, transfer or sell, reproduce, create derivative works from, distribute, perform, display, or in any way exploit any of the content, in whole or in part, except as otherwise expressly permitted in writing by the copyright owner or as specified in the license file distributed with this product.