Transforms and Supporting Types

AMMM3 keeps most reusable modelling primitives under abacus.mmm.

This page lists the main import groups for transformations, seasonality and trend components, HSGP helpers, and scaling types.

Top-level abacus.mmm re-exports

Import these directly from abacus.mmm:

from abacus.mmm import GeometricAdstock, LogisticSaturation, YearlyFourier

Adstock transformations

Top-level import path:

from abacus.mmm import (
    AdstockTransformation,
    BinomialAdstock,
    DelayedAdstock,
    GeometricAdstock,
    NoAdstock,
    WeibullCDFAdstock,
    WeibullPDFAdstock,
    adstock_from_dict,
)

Main public types:

TypePurpose
AdstockTransformationBase adstock interface
NoAdstockNo carryover
GeometricAdstockGeometric decay
DelayedAdstockDelayed peak with decay
BinomialAdstockBinomial-style lag weights
WeibullCDFAdstockWeibull CDF carryover
WeibullPDFAdstockWeibull PDF carryover
adstock_from_dict(...)Rebuild an adstock from serialised config

Saturation transformations

Top-level import path:

from abacus.mmm import (
    HillSaturation,
    HillSaturationSigmoid,
    InverseScaledLogisticSaturation,
    LogisticSaturation,
    MichaelisMentenSaturation,
    NoSaturation,
    RootSaturation,
    SaturationTransformation,
    TanhSaturation,
    TanhSaturationBaselined,
    saturation_from_dict,
)

Main public types:

TypePurpose
SaturationTransformationBase saturation interface
NoSaturationNo diminishing returns
LogisticSaturationLogistic response curve
InverseScaledLogisticSaturationInverse-scaled logistic curve
HillSaturationHill response curve
HillSaturationSigmoidHill-style sigmoid curve
MichaelisMentenSaturationMichaelis-Menten curve
RootSaturationRoot response curve
TanhSaturationHyperbolic tangent curve
TanhSaturationBaselinedTanh curve with baseline handling
saturation_from_dict(...)Rebuild a saturation from serialised config

Fourier and trend components

Top-level import path:

from abacus.mmm import MonthlyFourier, WeeklyFourier, YearlyFourier, LinearTrend

These classes are building blocks for built-in or custom additive effects.

TypePurpose
YearlyFourierYearly Fourier basis
MonthlyFourierMonthly Fourier basis
WeeklyFourierWeekly Fourier basis
LinearTrendPiecewise linear trend component

HSGP and time-varying parameter helpers

Top-level import path:

from abacus.mmm import (
    HSGP,
    CovFunc,
    HSGPPeriodic,
    PeriodicCovFunc,
    SoftPlusHSGP,
    approx_hsgp_hyperparams,
    create_complexity_penalizing_prior,
    create_constrained_inverse_gamma_prior,
    create_eta_prior,
    create_m_and_L_recommendations,
)

Main public types and helpers:

NamePurpose
HSGPGeneral HSGP configuration
SoftPlusHSGPHSGP variant used by time-varying parameter surfaces
HSGPPeriodicPeriodic HSGP configuration
CovFuncCovariance-function enum for HSGP
PeriodicCovFuncPeriodic covariance-function enum
approx_hsgp_hyperparams(...)Approximate HSGP hyperparameter helper
create_eta_prior(...)Eta prior helper
create_m_and_L_recommendations(...)Basis-size and domain recommendations
create_complexity_penalizing_prior(...)Complexity-penalising prior helper
create_constrained_inverse_gamma_prior(...)Inverse-gamma prior helper

Scaling types

Scaling is not re-exported from abacus.mmm. Import it from abacus.mmm.scaling:

from abacus.mmm.scaling import Scaling, VariableScaling

The scaling types are:

TypePurpose
VariableScalingMethod and non-date dims for one variable group
ScalingCombined target and channel scaling configuration

Supported VariableScaling.method values are:

  • "max"
  • "mean"

VariableScaling.dims must not include date, because AMMM3 already assumes the date dimension for scaling.

Special priors

See Special Priors for SpecialPrior, LogNormalPrior, LaplacePrior and experimental MaskedPrior from abacus.special_priors.

Notes on import paths

  • PanelMMM is not re-exported from abacus.mmm. Import it from abacus.mmm.panel.
  • Scaling is not re-exported from abacus.mmm. Import it from abacus.mmm.scaling.