hpcflow.sdk.core.values.sample_rows#

hpcflow.sdk.core.values.sample_rows(values: NDArray, num_samples: int, seed: int | list[int] | None = None, replace: bool = False) → NDArray#
hpcflow.sdk.core.values.sample_rows(values: list[U], num_samples: int, seed: int | list[int] | None = None, replace: bool = False) → list[U]

Randomly sample rows (items along the first axis) from values.

Parameters:
  • values – A list, or a Numpy array whose first axis indexes the rows.

  • num_samples – The number of rows to sample.

  • seed – Seed for the random number generator.

  • replace – Whether to sample with replacement. If False, num_samples must not exceed the number of rows available.