sampling_random_stratified ¶
sampling_random_stratified(
n: int,
seed: int | None = None,
min_subsample: int | None = None,
) -> FeatureSpec
lets_plot's stratified random sampling. Not applied by ggrust.
Built as lets_plot builds it, so ported code runs; rendering warns
(GgrustWarning) and draws every row. Use sampling_random instead.
Parameters:
-
n(int) –Number of rows to keep.
-
seed(int, default:None) –Seed of the random generator.
-
min_subsample(int, default:None) –Smallest sample per group.
Returns:
-
FeatureSpec–The lets_plot spec.
Examples:
>>> from ggrust import *
>>> sampling_random_stratified(100, seed=1).as_dict()
{'name': 'random_stratified', 'n': 100, 'seed': 1}