FourierBase#

class pymc_marketing.mmm.fourier.FourierBase(*, n_order, days_in_period, prefix='fourier', prior=Prior('Laplace', mu=0, b=1), variable_name=None)[source]#

Base class for Fourier seasonality transformations.

Parameters:
  • n_order (int) – Number of fourier modes to use.

  • days_in_period (float) – Number of days in a period.

  • prefix (str) – Alternative prefix for the fourier seasonality, by default None or “fourier”

  • prior (Union[Prior, VariableFactory]) – Prior distribution or VariableFactory for the fourier seasonality beta parameters, by default Prior("Laplace", mu=0, b=1)

  • variable_name (str | None) – Name of the variable that multiplies the fourier modes. By default None, in which case it is set to the {prefix}_beta.

Methods

FourierBase.__init__(**data)

Create a new model by parsing and validating input data from keyword arguments.

FourierBase.apply(dayofperiod[, sum])

Apply fourier seasonality to day of year.

FourierBase.construct([_fields_set])

FourierBase.copy(*[, include, exclude, ...])

Returns a copy of the model.

FourierBase.dict(*[, include, exclude, ...])

FourierBase.from_dict(data)

Deserialize the Fourier seasonality.

FourierBase.from_orm(obj)

FourierBase.get_default_start_date([start_date])

Get the start date for the Fourier curve.

FourierBase.json(*[, include, exclude, ...])

FourierBase.model_parametrized_name(params)

Compute the class name for parametrizations of generic classes.

FourierBase.parse_file(path, *[, ...])

FourierBase.parse_obj(obj)

FourierBase.parse_raw(b, *[, content_type, ...])

FourierBase.plot_curve(curve[, n_samples, ...])

Plot the seasonality for one full period.

FourierBase.plot_curve_hdi(curve[, ...])

Plot full period of the fourier seasonality.

FourierBase.plot_curve_samples(curve[, n, ...])

Plot samples from the curve.

FourierBase.plot_decomposition(curve[, ...])

Plot the decomposition of the Fourier seasonality into individual components.

FourierBase.sample_curve(parameters[, ...])

Create full period of the Fourier seasonality.

FourierBase.sample_prior([coords])

Sample the prior distributions.

FourierBase.schema([by_alias, ref_template])

FourierBase.schema_json(*[, by_alias, ...])

FourierBase.serialize_prior()

Serialize the prior distribution.

FourierBase.to_dict()

Serialize the Fourier seasonality.

FourierBase.update_forward_refs(**localns)

FourierBase.validate(value)

Attributes

FourierBase.model_config

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

FourierBase.nodes

Fourier node names for model coordinates.

FourierBase.n_order

FourierBase.days_in_period

FourierBase.prefix

FourierBase.prior

FourierBase.variable_name