Random Sample#

class sycamore.transforms.random_sample.RandomSample(child: Node, fraction: float, seed: int | None = None, **resource_args)[source]#

Bases: Transform

Generates a random sample of documents in a collection.

  • child – The plan node providing the dataset.

  • fraction – The fraction of documents to retain.

  • seed – The seed to use to initialize the RNG.

  • resource_args – Additional resource-related arguments to pass to the execution env.