Skip to content

Commit 86523b2

Browse files
committed
update tests for CDAP
1 parent e20268c commit 86523b2

File tree

2 files changed

+17
-1
lines changed

2 files changed

+17
-1
lines changed

activitysim/estimation/test/test_larch_estimation.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -226,9 +226,25 @@ def test_school_location(est_data, num_regression, dataframe_regression):
226226

227227

228228
def test_cdap_model(est_data, num_regression, dataframe_regression):
229+
from larch import P
230+
229231
from activitysim.estimation.larch.cdap import cdap_model
230232

231233
m = cdap_model()
234+
235+
assert len(m) == 5
236+
assert len(m[0].utility_co) == 3
237+
assert len(m[1].utility_co) == 9
238+
assert len(m[2].utility_co) == 27
239+
assert len(m[3].utility_co) == 81
240+
assert len(m[4].utility_co) == 243
241+
242+
# check that interaction parameters are assigned correctly
243+
assert P.coef_M_xxx in m[2].utility_co[1]
244+
assert P.coef_M_xxxxx not in m[2].utility_co[1]
245+
assert P.coef_M_xxx not in m[4].utility_co[1]
246+
assert P.coef_M_xxxxx in m[4].utility_co[1]
247+
232248
m.load_data()
233249
loglike_prior = m.loglike()
234250
r = m.maximize_loglike(method="SLSQP", options={"maxiter": 1000, "ftol": 1.0e-7})
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
,loglike_prior,loglike_converge
2-
0,-2460.7280651590818,-2336.352120296393
2+
0,-2414.0584951612909,-2331.9098826175818

0 commit comments

Comments
 (0)