Refactor extraction of raw terms from regression result
This commit is contained in:
parent
f9a8a5cf01
commit
fd30a3c1c7
@ -455,6 +455,18 @@ class RegressionModel:
|
||||
|
||||
return out
|
||||
|
||||
def terms_flat(self):
|
||||
"""
|
||||
Iterate over each :class:`SingleTerm` in *self.terms*, recursively stepping through :class:`CategoricalTerm`\ s
|
||||
"""
|
||||
|
||||
for t in self.terms.values():
|
||||
if isinstance(t, CategoricalTerm):
|
||||
for t in t.categories.values():
|
||||
yield t
|
||||
else:
|
||||
yield t
|
||||
|
||||
# --------------------
|
||||
# Post hoc tests, etc.
|
||||
|
||||
@ -477,11 +489,7 @@ class RegressionModel:
|
||||
|
||||
# Get parameters required for AFBF
|
||||
raw_params = {}
|
||||
for t in self.terms.values():
|
||||
if isinstance(t, CategoricalTerm):
|
||||
for t in t.categories.values():
|
||||
raw_params[t.raw_name.replace('[', '_').replace(']', '_')] = t.beta.point
|
||||
else:
|
||||
for t in self.terms_flat():
|
||||
raw_params[t.raw_name.replace('[', '_').replace(']', '_')] = t.beta.point
|
||||
|
||||
# Compute BF matrix
|
||||
|
Loading…
Reference in New Issue
Block a user