univariate_gaussian_conjugate

Univariate Gaussian conjugate Bayesian online change-point detection.

class pysatl_cpd.algorithms.online.bayesian.algorithm.univariate_gaussian_conjugate.UnivariateGaussianConjugateBOCPDConfiguration(*, learning_period_size=0, window=None, cpf_type=BayesianCPFType.MAX_RUN_LENGTH, hazard_lambda=10.0, prior_mu=0.0, prior_k=1.0, prior_alpha=1.0, prior_beta=1.0)[source]

Bases: BayesianOnlineCPDConfiguration

Configuration for the univariate Gaussian conjugate BOCPD algorithm.

Parameters:
  • learning_period_size (int)

  • window (int | None)

  • cpf_type (BayesianCPFType)

  • hazard_lambda (float)

  • prior_mu (float)

  • prior_k (float)

  • prior_alpha (float)

  • prior_beta (float)

hazard_lambda: float = 10.0
prior_mu: float = 0.0
prior_k: float = 1.0
prior_alpha: float = 1.0
prior_beta: float = 1.0
__post_init__()[source]

Validate configuration fields after initialisation.

Extends parent validation with hazard and prior checks.

Raises:

ValueError – If hazard_lambda < 1.0 or any prior scale parameter is non-positive.

Return type:

None

__init__(*, learning_period_size=0, window=None, cpf_type=BayesianCPFType.MAX_RUN_LENGTH, hazard_lambda=10.0, prior_mu=0.0, prior_k=1.0, prior_alpha=1.0, prior_beta=1.0)
Parameters:
  • learning_period_size (int)

  • window (int | None)

  • cpf_type (BayesianCPFType)

  • hazard_lambda (float)

  • prior_mu (float)

  • prior_k (float)

  • prior_alpha (float)

  • prior_beta (float)

Return type:

None

class pysatl_cpd.algorithms.online.bayesian.algorithm.univariate_gaussian_conjugate.UnivariateGaussianConjugateBOCPDState(*, is_in_learning_period=False, t=0, run_length_log_posterior=<factory>, mu_params=<factory>, k_params=<factory>, alpha_params=<factory>, beta_params=<factory>)[source]

Bases: BayesianOnlineCPDState

State for the univariate Gaussian conjugate BOCPD algorithm.

Variables:
  • mu_params – Posterior mean parameters per run length.

  • k_params – Posterior pseudo-count parameters per run length.

  • alpha_params – Posterior shape parameters per run length.

  • beta_params – Posterior scale parameters per run length.

Parameters:
mu_params: ndarray
k_params: ndarray
alpha_params: ndarray
beta_params: ndarray
__init__(*, is_in_learning_period=False, t=0, run_length_log_posterior=<factory>, mu_params=<factory>, k_params=<factory>, alpha_params=<factory>, beta_params=<factory>)
Parameters:
  • is_in_learning_period (bool)

  • t (int)

  • run_length_log_posterior (Any)

  • mu_params (np.ndarray)

  • k_params (np.ndarray)

  • alpha_params (np.ndarray)

  • beta_params (np.ndarray)

Return type:

None

class pysatl_cpd.algorithms.online.bayesian.algorithm.univariate_gaussian_conjugate.UnivariateGaussianConjugateBOCPD(learning_period_size=0, hazard_lambda=10.0, prior_mu=0.0, prior_k=1.0, prior_alpha=1.0, prior_beta=1.0, window=None, cpf_type=BayesianCPFType.MAX_RUN_LENGTH)[source]

Bases: AbstractBayesian

Univariate Gaussian conjugate Bayesian online change-point detector.

Wires a ConstantHazard, GaussianConjugate likelihood, and the selected CPF strategy.

Parameters:
  • learning_period_size (int) – Number of initial steps where the score is clamped to 0.

  • hazard_lambda (float) – Expected run length for the constant hazard model (>= 1).

  • prior_mu (float) – Prior mean for the Normal-Inverse-Gamma conjugate prior.

  • prior_k (float) – Prior pseudo-count (> 0).

  • prior_alpha (float) – Prior shape (> 0).

  • prior_beta (float) – Prior scale (> 0).

  • window (int | None) – Maximum number of run-length states to retain.

  • cpf_type (BayesianCPFType) – Change-point function variant (max-run-length or drop).

__init__(learning_period_size=0, hazard_lambda=10.0, prior_mu=0.0, prior_k=1.0, prior_alpha=1.0, prior_beta=1.0, window=None, cpf_type=BayesianCPFType.MAX_RUN_LENGTH)[source]
Parameters:
  • learning_period_size (int)

  • hazard_lambda (float)

  • prior_mu (float)

  • prior_k (float)

  • prior_alpha (float)

  • prior_beta (float)

  • window (int | None)

  • cpf_type (BayesianCPFType)

Return type:

None

property name: str

Human-readable algorithm name.

property configuration: UnivariateGaussianConjugateBOCPDConfiguration

Return the concrete configuration type.

Return type:

UnivariateGaussianConjugateBOCPDConfiguration

property state: UnivariateGaussianConjugateBOCPDState

Materialise an immutable snapshot including likelihood parameters.

Return type:

UnivariateGaussianConjugateBOCPDState

recreate()[source]

Create a fresh algorithm instance with identical configuration.

Return type:

Self