Skip to content

Error when setting enable_aks=True in version 1.2.0 #1042

@Jon77Ruler

Description

@Jon77Ruler

When I set enable_aks=True in my ModelSpec, the model allows me to generate the instanced object, however when I sample from either prior or posterior distributions I get an error :

459 population_scaled_mean = np.mean(population_scaled_kpi)
460 population_scaled_stdev = np.std(population_scaled_kpi)

_UFuncTypeError: Cannot cast ufunc 'divide' output from dtype('float64') to dtype('int64') with casting rule 'same_kind'_

My previous set up is as follows:

prior = prior_distribution.PriorDistribution(
    contribution_m=tfp.distributions.Beta(scaled_spends, 100 - scaled_spends),
    gamma_c = tfp.distributions.Normal(0, 5),     # Default, broad uninformative (used for seasonality control)
    alpha_m = tfp.distributions.Beta(alpha_m_alpha, alpha_m_beta) 
)

model_spec = spec.ModelSpec(
    #knots = 8,  
    enable_aks=True,
    max_lag = 12,  # elongate from default 8 weeks, but control using alpha_m
    media_prior_type = 'contribution',
    prior=prior)

mmm = model.Meridian(input_data=data, model_spec=model_spec)

and my calls (which error)

mmm.sample_prior(500)
mmm.sample_posterior(n_chains=4, n_adapt=500, n_burnin=500, n_keep=1000)

I'm running a national model.
If I comment out enable_aks and uncomment knots=8 then the sampling proceeds as normal.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions