superstats.transition.deterministic.linear#

Linear deterministic transition.

Classes

Linear([bounds, intercept, beta, ...])

Deterministic linear transition with an intercept and slope.

class superstats.transition.deterministic.linear.Linear(bounds=None, intercept=None, beta=None, normalize_steps=True)[source]#

Bases: DeterministicTransition

Deterministic linear transition with an intercept and slope.

Parameters:
boundssequence of two floats or None, optional, default: None

Lower and upper bounds for the deterministic trajectory. Tuples and lists are accepted.

interceptfloat, Prior, or None, optional, default: None

Starting value of the trajectory. A Prior samples one intercept per trajectory; None uses the deterministic default prior.

betafloat, Prior, or None, optional, default: None

Change across the trajectory when normalize_steps=True. A Prior samples one slope per trajectory; None uses the deterministic default prior.

normalize_stepsbool, optional, default: True

If True, use a time axis from 0 to 1. If False, use integer step indices, so the slope is applied at every step.

Parameters:

Notes

The sample method returns a dict with keys deterministic_params, hyper_params, and fixed_params. Trajectory values are clipped to bounds.

sample(batch_size, num_steps)[source]#

Draw batch_size linear trajectories of length num_steps.

Parameters:
batch_sizeint

Number of independent trajectories to draw.

num_stepsint

Number of time steps per trajectory.

Returns:
resultdict - dictionary with keys deterministic_params,

hyper_params, and fixed_params

Parameters:
  • batch_size (int)

  • num_steps (int)

Return type:

Dict[str, Any]

sample_from_parameters(params, batch_size, num_steps)[source]#

Generate trajectories from already-resolved transition parameters.

Subclasses used with posterior predictive resimulation should override this method. params contains the subclass’s own hyperparameter names, independent of any name used by a JointPrior.

Parameters:
Return type:

ndarray