- Warning
- This MADlib method is still in early stage development. There may be some issues that will be addressed in a future version. Interface and implementation is 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.