Skip to content

Commit 392638d

Browse files
committed
Fix python warm-start cloglog residual corruption bug
1 parent 017bca9 commit 392638d

3 files changed

Lines changed: 11 additions & 2 deletions

File tree

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
## Bug Fixes
1111

12-
* Fixed initialization and probability prediction bugs for cloglog in R [#357](https://github.com/StochasticTree/stochtree/pull/357)
12+
* Fixed several initialization, sampling and prediction bugs for cloglog [#357](https://github.com/StochasticTree/stochtree/pull/357)
1313
* Fixed num_threads pass-through bug in R BART [#339](https://github.com/StochasticTree/stochtree/pull/339)
1414
* Fixed probit offset bug in R and Python [#337](https://github.com/StochasticTree/stochtree/pull/337)
1515
* Standardized multi-chain BCF handling of internal propensity models [#334](https://github.com/StochasticTree/stochtree/pull/334)

NEWS.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
## Bug Fixes
99

10-
* Fixed initialization and probability prediction bugs for cloglog in R [#357](https://github.com/StochasticTree/stochtree/pull/357)
10+
* Fixed several initialization, sampling and prediction bugs for cloglog [#357](https://github.com/StochasticTree/stochtree/pull/357)
1111
* Fixed num_threads pass-through bug in R BART [#339](https://github.com/StochasticTree/stochtree/pull/339)
1212
* Fixed probit offset bug in R and Python [#337](https://github.com/StochasticTree/stochtree/pull/337)
1313
* Standardized multi-chain BCF handling of internal propensity models [#334](https://github.com/StochasticTree/stochtree/pull/334)

stochtree/bart.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1699,6 +1699,9 @@ def sample(
16991699
residual_train,
17001700
True,
17011701
)
1702+
# Undo residual update done by reconstitute_from_forest for the cloglog model
1703+
if link_is_cloglog:
1704+
residual_train.update_data(resid_train[:, 0])
17021705
# Reset leaf scale
17031706
if sample_sigma2_leaf:
17041707
leaf_scale_double = self.leaf_scale_samples[
@@ -1754,6 +1757,9 @@ def sample(
17541757
residual_train,
17551758
True,
17561759
)
1760+
# Undo residual update done by reconstitute_from_forest for the cloglog model
1761+
if link_is_cloglog:
1762+
residual_train.update_data(resid_train[:, 0])
17571763
# Reset leaf scale
17581764
if sample_sigma2_leaf and previous_leaf_var_samples is not None:
17591765
leaf_scale_double = previous_leaf_var_samples[
@@ -1818,6 +1824,9 @@ def sample(
18181824
residual_train,
18191825
True,
18201826
)
1827+
# Undo residual update done by reconstitute_from_forest for the cloglog model
1828+
if link_is_cloglog:
1829+
residual_train.update_data(resid_train[:, 0])
18211830
# Reset mean forest leaf scale
18221831
if sample_sigma2_leaf and previous_leaf_var_samples is not None:
18231832
current_leaf_scale[0, 0] = sigma2_leaf

0 commit comments

Comments
 (0)