Package csb :: Package statistics :: Package pdf :: Class AbstractDensity |
[frames] | no frames]

# Class AbstractDensity

source code

    object --+
             |
            AbstractDensity

Known Subclasses:
  - BaseDensity
  - , parameterized.ParameterizedDensity

Defines the interface and common operations for all probability density functions. This is a generic class which can operate on parameters of any type (e.g. simple floats or custom parameter objects).

Subclasses must complete the implementation by implementing the AbstractDensity.log_prob method. Subclasses could also consider--but are not obliged to--override the AbstractDensity.random method. If any of the density parameters need validation, subclasses are expected to override the AbstractDensity._validate method and raise ParameterValueError on validation failure. Note that implementing parameter validation in property setters has almost no effect and is discouraged.

Nested Classes
| __metaclass__ Metaclass for defining Abstract Base Classes (ABCs).

Instance Methods
__call__(self, x) | source code
__getitem__(self, param) | source code
__init__(self) x.__init__(...) initializes x; see help(type(x)) for signature | source code
__setitem__(self, param, value) | source code
__str__(self) str(x) | source code
estimate(self, data) Estimate and load the parameters of the distribution from sample `data` using the current AbstractEstimator strategy. | source code
array |
evaluate(self, x) Evaluate the probability of observing values `x`. | source code
get_params(self) | source code
array |
log_prob(self, x) Evaluate the logarithm of the probability of observing values `x`. | source code
random(self, size=None) Generate random samples from the probability distribution. | source code
set_params(self, *values, **named_params) | source code
Inherited from `object`: `__delattr__`, `__format__`, `__getattribute__`, `__hash__`, `__new__`, `__reduce__`, `__reduce_ex__`, `__repr__`, `__setattr__`, `__sizeof__`, `__subclasshook__`

Class Variables
| __abstractmethods__ = ``frozenset([``'``log_prob``'``])``

Properties
| estimator
| parameters Get a list of all distribution parameter names.
Inherited from `object`: `__class__`

Method Details

### __init__(self) (Constructor) | source code
x.__init__(...) initializes x; see help(type(x)) for signature Overrides: object.__init__ (inherited documentation)

### __str__(self) (Informal representation operator) | source code
str(x) Overrides: object.__str__ (inherited documentation)

### estimate(self, data) | source code
Estimate and load the parameters of the distribution from sample `data` using the current AbstractEstimator strategy. Parameters: `data` (array) - sample values Raises: `NotImplementedError` - when no estimator is available for this distribution `IncompatibleEstimatorError` - when the current estimator is not compatible with this pdf

### evaluate(self, x) | source code
Evaluate the probability of observing values `x`. Parameters: `x` (array) - values Returns: array

### log_prob(self, x) | source code
Evaluate the logarithm of the probability of observing values `x`. Parameters: `x` (array) - values Returns: array

### random(self, size=None) | source code
Generate random samples from the probability distribution. Parameters: `size` (int) - number of values to sample

Property Details

### estimator Get Method: unreachable.estimator(self) Set Method: unreachable.estimator(self, strategy)

### parameters Get a list of all distribution parameter names. Get Method: unreachable.parameters(self) - Get a list of all distribution parameter names.