Skip to content

Samplers Docs

seba-1511 edited this page Mar 14, 2018 · 3 revisions

Class BetaVariate

Generates a randomly sampled value with specified mean and std based on a Beta distribution.

Parameters:

  • alpha - (float) alpha of beta distribution.
  • beta - (float) beta of beta distribution.
  • dtype - (string) data type. Default: float

Return type: n/a

Example:

randopt.BetaVariate(alpha=1,beta=1,dtype='float')

get_state

def get_state(self)

sample

def sample(self)

seed

def seed(self, seed_val)

set_state

def set_state(self, state)

Class Choice

Samples a value from a given list according to the provided sampler.

Parameters:

  • items - (list) itemsm to be sampled.
  • sampler - (Sampler) Sampler used to select an item based on its index.

Return type: n/a

Example:

TODO.

get_state

def get_state(self)

sample

def sample(self)

seed

def seed(self, seed_val)

set_state

def set_state(self, state)

Class Constant

Base class for all samplers.

Note: This class should not be directly instanciated.

get_state

def get_state(self)

sample

def sample(self)

seed

def seed(self, seed_val)

set_state

def set_state(self, state)

Class ExpoVariate

Generates a randomly sampled value with lambda based on an exponential distribution.

Parameters:

  • lam - (float) lambda of exponential distribution (one divided by desired mean).
  • dtype - (string) data type. Default: float

Return type: n/a

Example:

randopt.ExpoVariate(lam=1, dtype='float')

get_state

def get_state(self)

sample

def sample(self)

seed

def seed(self, seed_val)

set_state

def set_state(self, state)

Class Gaussian

Generates a randomly sampled value with specified mean and std based on a Gaussian distribution.

Parameters:

  • mean - (float) mean of Gaussian. Default: 0.0
  • std - (float) standard deviation of Gaussian. Default: 1.0
  • dtype - (string) data type. Default: float

Return type: n/a

Example:

randopt.Gaussian(mean=0.0, std=1.0, dtype='float')

get_state

def get_state(self)

sample

def sample(self)

seed

def seed(self, seed_val)

set_state

def set_state(self, state)

Class LognormVariate

Generates a randomly sampled value with specified mean and std based on a Log normal distribution.

Parameters:

  • mean - (float) mean of Lognormal. Default: 0.0
  • std - (float) standard deviation of Lognormal. Default: 1.0
  • dtype - (string) data type. Default: float

Return type: n/a

Example:

randopt.LognormVariate(mean=0.0, std=1.0, dtype='float')

get_state

def get_state(self)

sample

def sample(self)

seed

def seed(self, seed_val)

set_state

def set_state(self, state)

Class Normal

Generates a randomly sampled value with specified mean and std based on a Gaussian distribution.

Parameters:

  • mean - (float) mean of Gaussian. Default: 0.0
  • std - (float) standard deviation of Gaussian. Default: 1.0
  • dtype - (string) data type. Default: float

Return type: n/a

Example:

randopt.Gaussian(mean=0.0, std=1.0, dtype='float')

get_state

def get_state(self)

sample

def sample(self)

seed

def seed(self, seed_val)

set_state

def set_state(self, state)

Class ParetoVariate

Generates a randomly sampled value with alpha based on the Pareto distribution.

Parameters:

  • alpha - (float) alpha of Pareto distribution (shape parameter).
  • dtype - (string) data type. Default: float

Return type: n/a

Example:

randopt.ParetoVariate(alpha=1,dtype='float')

get_state

def get_state(self)

sample

def sample(self)

seed

def seed(self, seed_val)

set_state

def set_state(self, state)

Class Sampler

Base class for all samplers.

Note: This class should not be directly instanciated.

get_state

def get_state(self)

sample

def sample(self)

seed

def seed(self, seed_val)

set_state

def set_state(self, state)

Class Truncated

Given a sampler, clips the distribution between low and high. If None, not truncated.

Parameters:

  • sampler - (Sampler) Sampler to be truncated.
  • low - (float) minimum value to be sampled. Default: None
  • high - (float) maximum value to be sampled. Default: None

Return type: n/a

Example:

sampler = Gaussian(0.0, 0.1)
truncated = Truncated(sampler, -0.1, 0.1)

get_state

def get_state(self)

sample

def sample(self)

seed

def seed(self, seed_val)

set_state

def set_state(self, state)

Class Uniform

Generates a randomly sampled value from low to high with equal probability.

Parameters:

  • low - (float) minimum value.
  • high - (float) maximum value.
  • dtype - (string) data type. Default: float

Return type: n/a

Example:

randopt.Uniform(low=-1.0, high=1.0, dtype='float')

get_state

def get_state(self)

sample

def sample(self)

seed

def seed(self, seed_val)

set_state

def set_state(self, state)

Class WeibullVariate

Generates a randomly sampled value with specified mean and std based on a Weibull distribution.

Parameters:

  • alpha - (float) alpha of Weibull distribution (scale parameter).
  • beta - (float) beta of Weibull distribution (shape parameter).
  • dtype - (string) data type. Default: float

Return type: n/a

Example:

randopt.WeibullVariate(alpha=1,beta=1,dtype='float')

get_state

def get_state(self)

sample

def sample(self)

seed

def seed(self, seed_val)

set_state

def set_state(self, state)