Transforms and Supporting Types

Abacus 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:

Type Purpose
AdstockTransformation Base adstock interface
NoAdstock No carryover
GeometricAdstock Geometric decay
DelayedAdstock Delayed peak with decay
BinomialAdstock Binomial-style lag weights
WeibullCDFAdstock Weibull CDF carryover
WeibullPDFAdstock Weibull 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:

Type Purpose
SaturationTransformation Base saturation interface
NoSaturation No diminishing returns
LogisticSaturation Logistic response curve
InverseScaledLogisticSaturation Inverse-scaled logistic curve
HillSaturation Hill response curve
HillSaturationSigmoid Hill-style sigmoid curve
MichaelisMentenSaturation Michaelis-Menten curve
RootSaturation Root response curve
TanhSaturation Hyperbolic tangent curve
TanhSaturationBaselined Tanh 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.

Type Purpose
YearlyFourier Yearly Fourier basis
MonthlyFourier Monthly Fourier basis
WeeklyFourier Weekly Fourier basis
LinearTrend Piecewise 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:

Name Purpose
HSGP General HSGP configuration
SoftPlusHSGP HSGP variant used by time-varying parameter surfaces
HSGPPeriodic Periodic HSGP configuration
CovFunc Covariance-function enum for HSGP
PeriodicCovFunc Periodic 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:

Type Purpose
VariableScaling Method and non-date dims for one variable group
Scaling Combined target and channel scaling configuration

Supported VariableScaling.method values are:

  • "max"
  • "mean"

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

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.