chemicalchecker.tool.targetmate.utils.splitters.ToppedSampler

class ToppedSampler(max_samples, max_ensemble_size, chance, try_balance, shuffle, brute=True)[source]

Bases: object

Sample so that coverage is maximized.

Initialize the topped sampler.

Parameters:
  • max_samples (int) – Maximum number of samples allowed per draw.

  • max_ensemble_size (int) – Maximum number of draws.

  • chance (float) – Desired probability of drawing a sample at least once.

  • try_balance (bool) – Try to balance, given the available samples. That is, instead of stratifying, give higher probability to the minority class.

  • shuffle (bool) – Shuffle indices.

  • brute (bool) – When trying to balance, be brute and do not sample by probability (default=True).

Methods

brute_sample

calc_ensemble_size

get_resamp

probabilities

ret

sample

Main method

sample(X=None, y=None, bins=10)[source]

Main method