- Warning
- This MADlib method is still in early stage development. Interface and implementation are subject to change.
The random sampling module consists of useful utility functions for sampling operations. These functions can be used while implementing new algorithms.
- Functions
Sample a single row according to weights.
weighted_sample( value,
weight
)
Arguments
- value
- BIGINT or FLOAT8[]. Value of row. Uniqueness is not enforced. If a value occurs multiple times, the probability of sampling this value is proportional to the sum of its weights.
- weight
- FLOAT8. Weight for row. A negative value here is treated has zero weight.
Refer to the file for documentation on each of the utility functions.
- Related Topics
- See also
- File sample.sql_in documenting the SQL functions.