@@ -95,13 +95,13 @@ def test_rosenbrock(caplog: pytest.LogCaptureFixture) -> None:
9595 assert 'CmdStanMLE: model=rosenbrock' in repr (mle )
9696 assert 'method=optimize' in repr (mle )
9797 assert mle .converged
98- assert mle .column_names == ('lp__' , 'x' , 'y' )
98+ assert mle .column_names == ('lp__' , 'converged__' , ' x' , 'y' )
9999 np .testing .assert_almost_equal (mle .stan_variable ('x' ), 1 , decimal = 3 )
100100 np .testing .assert_almost_equal (mle .stan_variable ('y' ), 1 , decimal = 3 )
101101 np .testing .assert_almost_equal (
102102 mle .optimized_params_pd ['x' ][0 ], 1 , decimal = 3
103103 )
104- np .testing .assert_almost_equal (mle .optimized_params_np [1 ], 1 , decimal = 3 )
104+ np .testing .assert_almost_equal (mle .optimized_params_np [2 ], 1 , decimal = 3 )
105105 np .testing .assert_almost_equal (mle .optimized_params_dict ['x' ], 1 , decimal = 3 )
106106 with caplog .at_level (logging .WARNING ):
107107 assert mle .optimized_iterations_np is None
@@ -131,8 +131,8 @@ def test_rosenbrock(caplog: pytest.LogCaptureFixture) -> None:
131131 np .testing .assert_almost_equal (mle .stan_variable ('x' ), 1 , decimal = 3 )
132132 np .testing .assert_almost_equal (mle .stan_variable ('y' ), 1 , decimal = 3 )
133133
134- assert mle .optimized_params_np .shape == (3 ,)
135- np .testing .assert_almost_equal (mle .optimized_params_np [1 ], 1 , decimal = 3 )
134+ assert mle .optimized_params_np .shape == (4 ,)
135+ np .testing .assert_almost_equal (mle .optimized_params_np [2 ], 1 , decimal = 3 )
136136 np .testing .assert_almost_equal (
137137 mle .optimized_params_pd ['x' ][0 ], 1 , decimal = 3
138138 )
@@ -143,7 +143,7 @@ def test_rosenbrock(caplog: pytest.LogCaptureFixture) -> None:
143143 mle .optimized_iterations_np [0 , 1 ]
144144 != mle .optimized_iterations_np [last_iter , 1 ]
145145 )
146- for i in range (3 ):
146+ for i in range (4 ):
147147 assert (
148148 mle .optimized_params_np [i ]
149149 == mle .optimized_iterations_np [last_iter , i ]
@@ -162,7 +162,7 @@ def test_eight_schools(caplog: pytest.LogCaptureFixture) -> None:
162162 assert 'method=optimize' in repr (mle )
163163 assert not mle .converged
164164 with caplog .at_level (logging .WARNING ):
165- assert mle .optimized_params_pd .shape == (1 , 11 )
165+ assert mle .optimized_params_pd .shape == (1 , 12 )
166166 check_present (
167167 caplog ,
168168 (
@@ -294,15 +294,15 @@ def test_optimize_good() -> None:
294294 # test numpy output
295295 assert isinstance (mle .optimized_params_np , np .ndarray )
296296 np .testing .assert_almost_equal (mle .optimized_params_np [0 ], - 5 , decimal = 2 )
297- np .testing .assert_almost_equal (mle .optimized_params_np [1 ], 0.2 , decimal = 3 )
297+ np .testing .assert_almost_equal (mle .optimized_params_np [2 ], 0.2 , decimal = 3 )
298298
299299 # test pandas output
300300 assert mle .optimized_params_np [0 ] == mle .optimized_params_pd ['lp__' ][0 ]
301- assert mle .optimized_params_np [1 ] == mle .optimized_params_pd ['theta' ][0 ]
301+ assert mle .optimized_params_np [2 ] == mle .optimized_params_pd ['theta' ][0 ]
302302
303303 # test dict output
304304 assert mle .optimized_params_np [0 ] == mle .optimized_params_dict ['lp__' ]
305- assert mle .optimized_params_np [1 ] == mle .optimized_params_dict ['theta' ]
305+ assert mle .optimized_params_np [2 ] == mle .optimized_params_dict ['theta' ]
306306
307307
308308def test_negative_parameter_values () -> None :
@@ -530,14 +530,14 @@ def test_optimize_good_dict() -> None:
530530 )
531531 # test numpy output
532532 np .testing .assert_almost_equal (mle .optimized_params_np [0 ], - 5 , decimal = 2 )
533- np .testing .assert_almost_equal (mle .optimized_params_np [1 ], 0.2 , decimal = 3 )
533+ np .testing .assert_almost_equal (mle .optimized_params_np [2 ], 0.2 , decimal = 3 )
534534
535535
536536def test_optimize_rosenbrock () -> None :
537537 stan = os .path .join (DATAFILES_PATH , 'optimize' , 'rosenbrock.stan' )
538538 rose_model = CmdStanModel (stan_file = stan )
539539 mle = rose_model .optimize (seed = 1239812093 , inits = None , algorithm = 'BFGS' )
540- assert mle .column_names == ('lp__' , 'x' , 'y' )
540+ assert mle .column_names == ('lp__' , 'converged__' , ' x' , 'y' )
541541 np .testing .assert_almost_equal (mle .optimized_params_dict ['x' ], 1 , decimal = 3 )
542542 np .testing .assert_almost_equal (mle .optimized_params_dict ['y' ], 1 , decimal = 3 )
543543
@@ -546,7 +546,7 @@ def test_optimize_no_data() -> None:
546546 stan = os .path .join (DATAFILES_PATH , 'optimize' , 'no_data.stan' )
547547 rose_model = CmdStanModel (stan_file = stan )
548548 mle = rose_model .optimize (seed = 1239812093 )
549- assert mle .column_names == ('lp__' , 'a' )
549+ assert mle .column_names == ('lp__' , 'converged__' , ' a' )
550550 np .testing .assert_almost_equal (mle .optimized_params_dict ['a' ], 0 , decimal = 3 )
551551
552552
@@ -599,7 +599,7 @@ def test_exe_only() -> None:
599599 jdata = os .path .join (DATAFILES_PATH , 'bernoulli.data.json' )
600600 mle = bern2_model .optimize (data = jdata )
601601 assert mle .optimized_params_np [0 ] == mle .optimized_params_dict ['lp__' ]
602- assert mle .optimized_params_np [1 ] == mle .optimized_params_dict ['theta' ]
602+ assert mle .optimized_params_np [2 ] == mle .optimized_params_dict ['theta' ]
603603
604604
605605def test_complex_output () -> None :
0 commit comments