pywr.recorders.NormalisedGaussianKDEStorageRecorder
- class pywr.recorders.NormalisedGaussianKDEStorageRecorder(*args, **kwargs)
A recorder that fits a KDE to a normalised time-series of volume.
This recorder is an extension to NumpyArrayNormalisedStorageRecorder which, at the end of a simulation, uses kernel density estimation (KDE) to estimate the probability density function of the storage time-series. It returns the probability of being at or below zero of the normalised values in the aggregated_value() method (i.e. used for optimisation). The recorder flattens data from all scenarios before computing the KDE. Therefore, a single PDF is produced and returned via .to_dataframe().
The user can specify an optional resampling (e.g. to create annual minimum time-series) prior to fitting the KDE. By default the KDE is reflected at the normalised storage bounds (-1.0 and 1.0) to represent the boundedness of the distribution. This can be disabled if required.
- Parameters:
- resample_freqstr or None
If not None the resampling frequency used by prior to distribution fitting.
- resample_funcstr or None
If not None the resampling function used prior to distribution fitting.
- num_pdfint
Number of points in the PDF estimate. Defaults to 101.
- use_reflectionbool
Whether to reflect the PDF at the upper and lower normalised bounds (i.e. -1.0 and 1.0 volume) to account for the boundedness of the distribution. Defaults to true.
- __init__(*args, **kwargs)
Methods
__init__
(*args, **kwargs)after
(self)aggregated_value
(self)before
(self)finish
(self)is_constraint_violated
(self)Returns true if the value from this Recorder violates its constraint bounds.
load
(cls, model, data)register
(cls)reset
(self)setup
(self)to_dataframe
()Return a pandas.DataFrame of the estimated PDF.
unregister
(cls)values
()Return the estimated PDF values.
Attributes
agg_func
children
comment
comment: unicode
constraint_lower_bounds
constraint_upper_bounds
data
epsilon
epsilon: 'double'
ignore_nan
ignore_nan: 'bool'
is_constraint
Returns true if either upper or lower constraint bounds is defined.
is_double_bounded_constraint
Returns true if upper and lower constraint bounds are both defined and not-equal to one another.
is_equality_constraint
Returns true if upper and lower constraint bounds are both defined and equal to one another.
is_lower_bounded_constraint
Returns true if lower constraint bounds is defined and upper constraint bounds is not.
is_objective
is_upper_bounded_constraint
Returns true if upper constraint bounds is defined and lower constraint bounds is not.
model
name
node
parameter
parents
tags
tags: dict
temporal_agg_func