ema workbench

Table Of Contents

Other Sub Sites

uncertainties

Created on 16 aug. 2011

This module contains various classes that can be used for specifying different types of uncertainties.

Code author: jhkwakkel <j.h.kwakkel (at) tudelft (dot) nl>

AbstractUncertainty

class uncertainties.AbstractUncertainty(values, name)

Bases: object

AbstractUncertainty provides a template for specifying different types of uncertainties.

values

the values that specify the uncertainty

name

the name of the uncertainty

type

the type of integer

dtype

the datatype of the uncertainty

dist

a string denoting the type of distribution to be used in sampling

__init__(values, name)
Parameters:
  • values – the values for specifying the uncertainty from which to sample
  • name – name of the uncertainty
get_values()

get values

ParameterUncertainty

class uncertainties.ParameterUncertainty(values, name, integer=False, default=None)

Bases: uncertainties.AbstractUncertainty

ParameterUncertainty is used for specifying parametric uncertainties. An uncertainty is parametric if the range is continuous from the lower bound to the upper bound.

Parametric uncertainties are either floats or integers.

default

optional attribute for specifying default value for uncertainty

__init__(values, name, integer=False, default=None)
Parameters:
  • values – the values for specifying the uncertainty from which to sample. Values should be a tuple with the lower and upper bound for the uncertainty. These bounds are inclusive.
  • name – name of the uncertainty
  • integer – boolean, if True, the parametric uncertainty is an integer
  • default – optional argument for providing a default value
get_default_value()

return default value

CategoricalUncertainty

class uncertainties.CategoricalUncertainty(values, name, default=None)

Bases: uncertainties.ParameterUncertainty

CategoricalUncertainty can can be used for sampling over categorical variables. The categories can be of any type, including Strings, Integers, Floats, Tuples, or any Object. As values the categories are specified in a collection.

Underneath, this is treated as a integer parametric uncertainty. That is, an integer parametric uncertainty is used with each integer corresponding to a particular category. This class called by the sampler to transform the integer back to the appropriate category.

categories

the categories of the uncertainty

__init__(values, name, default=None)
Parameters:
  • values – the values for specifying the uncertainty from which to sample. Values should be a collection.
  • name – name of the uncertainty
  • default – optional argument for providing a default value
transform(param)

transform an integer to a category

invert(name)

transform a categoy to an integer