issue with setting parameter to defaults

87 views
Skip to first unread message

Harrison Ritz

unread,
Jan 31, 2024, 6:41:02 PM1/31/24
to hddm-users
Trying to fix a parameter by omitting it from the `include`.

eg.

base_config = hddm.model_config.model_config['angle']
base_config['params_default'][4] = 0.0

 m = hddm.HDDMnnRegressor(data,
            ['v ~ -1 + A + B', 'a ~ 1 + C + D'],
            include = {'v','a','t','z'},
            informative = False,
            group_only_regressors=False,
            model = 'angle',
            model_config=base_config,
            )


Whenever I don't include a parameter, I get this error:

Traceback (most recent call last):
  File "/mnt/run_model.py", line 160, in <module>
    m = hddm.HDDMnnRegressor(data,
  File "/opt/conda/lib/python3.8/site-packages/hddm/models/hddm_nn_regression.py", line 149, in __init__
    super(HDDMnnRegressor, self).__init__(
  File "/opt/conda/lib/python3.8/site-packages/hddm/models/hddm_regression.py", line 273, in __init__
    super(HDDMRegressor, self).__init__(data, **kwargs)
  File "/opt/conda/lib/python3.8/site-packages/hddm/models/hddm_info.py", line 158, in __init__
    super(HDDM, self).__init__(*args, **kwargs)
  File "/opt/conda/lib/python3.8/site-packages/hddm/models/base.py", line 1392, in __init__
    super(HDDMBase, self).__init__(data, **kwargs)
  File "/opt/conda/lib/python3.8/site-packages/hddm/models/base.py", line 74, in __init__
    super(AccumulatorModel, self).__init__(data, **kwargs)
  File "/opt/conda/lib/python3.8/site-packages/kabuki/hierarchical.py", line 401, in __init__
    self._setup_model()
  File "/opt/conda/lib/python3.8/site-packages/kabuki/hierarchical.py", line 412, in _setup_model
    self.create_model()
  File "/opt/conda/lib/python3.8/site-packages/kabuki/hierarchical.py", line 501, in create_model
    _create()
  File "/opt/conda/lib/python3.8/site-packages/kabuki/hierarchical.py", line 497, in _create
    knode.create()
  File "/opt/conda/lib/python3.8/site-packages/kabuki/hierarchical.py", line 196, in create
    node = self.create_node(node_name, kwargs, grouped_data)
  File "/opt/conda/lib/python3.8/site-packages/kabuki/hierarchical.py", line 203, in create_node
    return self.pymc_node(name=node_name, **kwargs)
  File "/opt/conda/lib/python3.8/site-packages/pymc/distributions.py", line 308, in __init__
    Stochastic.__init__(
  File "/opt/conda/lib/python3.8/site-packages/pymc/PyMCObjects.py", line 749, in __init__
    Variable.__init__(self,
  File "/opt/conda/lib/python3.8/site-packages/pymc/Node.py", line 214, in __init__
    Node.__init__(self, doc, name, parents, cache_depth, verbose=verbose)
  File "/opt/conda/lib/python3.8/site-packages/pymc/Node.py", line 129, in __init__
    self.parents = parents
  File "/opt/conda/lib/python3.8/site-packages/pymc/Node.py", line 147, in _set_parents
    self.gen_lazy_function()
  File "/opt/conda/lib/python3.8/site-packages/pymc/PyMCObjects.py", line 806, in gen_lazy_function
    self._logp.force_compute()
  File "LazyFunction.pyx", line 257, in pymc.LazyFunction.LazyFunction.force_compute (pymc/LazyFunction.c:2409)
  File "/opt/conda/lib/python3.8/site-packages/pymc/distributions.py", line 2974, in wrapper
    return f(value, **kwds)
  File "<string>", line 9, in custom_likelihood_reg
AttributeError: 'float' object has no attribute 'loc'

Renu

unread,
Apr 15, 2025, 9:50:10 AMApr 15
to hddm-users
Hey,

I am also getting the same error. Did you manage to fix it? If yes, could you please tell me?

Thanks,
Renu

Harrison Ritz

unread,
Apr 15, 2025, 11:42:47 AMApr 15
to hddm-...@googlegroups.com

I can confirm that the code snippet in OP did end up working.
IIRC I needed the latest version of HDDM. I can’t access my slurm outputs anymore to double-check exactly what version that was.

Good luck!

 

 

Harrison

 

--
You received this message because you are subscribed to a topic in the Google Groups "hddm-users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/hddm-users/c-GyK7XoiDY/unsubscribe.
To unsubscribe from this group and all its topics, send an email to hddm-users+...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/hddm-users/67df323f-874b-4e05-be59-f444f6bf835cn%40googlegroups.com.

Reply all
Reply to author
Forward
0 new messages