alibi_detect.utils.sampling module

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

Apply reservoir sampling.

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

  • X (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

ndarray

Returns

Updated reservoir.