reno.components.Distribution#
- class reno.components.Distribution(*operands, per_timestep=False)#
Bases:
EquationPartRepresents a probability distribution or set that is drawn from for each sample (n) in a simulation.
Probably shouldn’t directly be using this, although you can in theory likely pass in ``partial()``s with numpy functions (just minus the size variable.)
- Parameters:
per_timestep (bool) – Whether to draw a different value from the distribution for each timestep.
Methods
__init__(*operands[, per_timestep])clip(min, max)equal(obj)eval([t, save, force])Get the vector of samples pulled from the probability distribution.
find_refs_of_type(search_type[, already_checked])Actually recursive as opposed to seek_refs, returns a list of all equation parts matching passed type.
For now this is returning an integer because we only allow a single additional dimension.
get_type()Similar to shape, this gets computed recursively, used to automatically determine if the value needs to be initialized with a certain numpy type.
is_static()Convenience shortcut for
reno.utils.is_static()- True if this equation doesn't rely on any dynamic values (thus constant), False if it does.latex(**kwargs)Construct a string representation of this portion of the equation for use in a latex display.
not_equal(obj)populate(n[, steps, dim])Generate n x dim samples based on this probability distribution, assigns as a vector/matrix to
self.value.pt(**refs)Get a pytensor graph representing this piece of an equation.
pt_str(**refs)Construct a string containing relevant pytensor code for this piece of the equation.
seek_refs()Immediate refs only, depth=1.
series_max()series_min()sum([axis])Attributes
dtypeThe type of each underlying value.
shapeThe size of the data dimension, 1 by default.
timeseriesGet a timeseries view of the data (includes all historical data across all timesteps.)
- __annotations__ = {}#
- __module__ = 'reno.components'#
- eval(t=0, save=False, force=False, **kwargs)#
Get the vector of samples pulled from the probability distribution.
Note that this expects
populate()to already have been called.- Parameters:
t (int)
save (bool)
force (bool)
- Return type:
ndarray
- get_shape()#
For now this is returning an integer because we only allow a single additional dimension. Note that this shape _does not_ incoporate time or batch dimensions, only the “data” dimension if applicable. This should be overridden by subclasses, e.g. operations which would change the shape.
- Return type:
int
- populate(n, steps=0, dim=1)#
Generate n x dim samples based on this probability distribution, assigns as a vector/matrix to
self.value.- Parameters:
n (int) – Number of samples to draw.
steps (int) – Number of timesteps for which to draw samples for, only relevant if
per_timestepisTrue.dim (int) – If > 1, draw samples into a vector of this size for each n.