TypeError Traceback (most recent call last)
Input In [22], in <cell line: 1>()
2 print(series[‘title’])
4 (zero_centered_y, centre_offset, n_polls, n_days, day_zero, poll_day,
5 poll_brand, brand_map, n_brands, measurement_error_sd) = (
6 prepare_data_for_analysis(tpp, series[‘column’]))
----> 8 model = define_model(n_brands, n_days, poll_brand, zero_centered_y,
9 measurement_error_sd)
11 trace, summary = draw_samples(model)
13 plot_aggregation(trace, tpp, series[‘column’], day_zero, n_days,
14 centre_offset, series[‘point_color’],
15 series[‘line_color’], series[‘title’])
Input In [16], in define_model(n_brands, n_days, poll_brand, zero_centered_y, measurement_error_sd)
20 start_dist = pm.Normal.dist(mu=educated_guess, sigma=SIGMA)
21 print(f’DRIFT: {DRIFT}, INNOVATION: {INNOVATION}, ’
22 f’educated_guess: {educated_guess}, SIGMA: {SIGMA}’
23 f’\ninit: {type(start_dist)}’)
—> 24 grw = pm.GaussianRandomWalk(‘grw’, mu=DRIFT, sigma=INNOVATION,
25 init=start_dist, steps=n_days) ### FAILS HERE
27 # the observational model
28 observed = pm.Normal(“observed”,
29 mu=grw[poll_day]
30 + zero_sum_house_bias[poll_brand.to_list()],
31 sigma=measurement_error_sd, observed=zero_centered_y)
File /opt/homebrew/Caskroom/miniforge/base/lib/python3.9/site-packages/pymc/distributions/distribution.py:267, in Distribution.new(cls, name, rng, dims, initval, observed, total_size, transform, *args, **kwargs)
263 rng = model.next_rng()
265 # Create the RV and process dims and observed to determine
266 # a shape by which the created RV may need to be resized.
→ 267 rv_out, dims, observed, resize_shape = _make_rv_and_resize_shape(
268 cls=cls, dims=dims, model=model, observed=observed, args=args, rng=rng, **kwargs
269 )
271 if resize_shape:
272 # A batch size was specified through dims
, or implied by observed
.
273 rv_out = change_rv_size(rv_var=rv_out, new_size=resize_shape, expand=True)
File /opt/homebrew/Caskroom/miniforge/base/lib/python3.9/site-packages/pymc/distributions/distribution.py:166, in _make_rv_and_resize_shape(cls, dims, model, observed, args, **kwargs)
163 “”“Creates the RV and processes dims or observed to determine a resize shape.”""
164 # Create the RV without dims information, because that’s not something tracked at the Aesara level.
165 # If necessary we’ll later replicate to a different size implied by already known dims.
→ 166 rv_out = cls.dist(*args, **kwargs)
167 ndim_actual = rv_out.ndim
168 resize_shape = None
TypeError: dist() missing 1 required positional argument: ‘dist_params’