alibi_detect.utils.sampling module

alibi_detect.utils.sampling.reservoir_sampling(X_ref, X, reservoir_size, n)[source]

Apply reservoir sampling.

Parameters
  • X_ref (numpy.ndarray) – Current instances in reservoir.

  • X (numpy.ndarray) – Data to update reservoir with.

  • reservoir_size (int) – Size of reservoir.

  • n (int) – Number of total instances that have passed so far.

Return type

numpy.ndarray

Returns

Updated reservoir.