You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: stochtree/bart.py
+9-9Lines changed: 9 additions & 9 deletions
Original file line number
Diff line number
Diff line change
@@ -2193,25 +2193,19 @@ def compute_contrast(
2193
2193
2194
2194
defcompute_posterior_interval(
2195
2195
self,
2196
-
terms: Union[list[str], str] ="all",
2197
-
level: float=0.95,
2198
-
scale: str="linear",
2199
2196
X: np.array=None,
2200
2197
leaf_basis: np.array=None,
2201
2198
rfx_group_ids: np.array=None,
2202
2199
rfx_basis: np.array=None,
2200
+
terms: Union[list[str], str] ="all",
2201
+
level: float=0.95,
2202
+
scale: str="linear",
2203
2203
) ->dict:
2204
2204
"""
2205
2205
Compute posterior credible intervals for specified terms from a fitted BART model. It supports intervals for mean functions, variance functions, random effects, and overall predictions.
2206
2206
2207
2207
Parameters
2208
2208
----------
2209
-
terms : str, optional
2210
-
Character string specifying the model term(s) for which to compute intervals. Options for BART models are `"mean_forest"`, `"variance_forest"`, `"rfx"`, `"y_hat"`, or `"all"`. Defaults to `"all"`.
2211
-
scale : str, optional
2212
-
Scale of mean function predictions. Options are "linear", which returns predictions on the original scale of the mean forest / RFX terms, and "probability", which transforms predictions into a probability of observing `y == 1`. "probability" is only valid for models fit with a probit outcome model. Defaults to `"linear"`.
2213
-
level : float, optional
2214
-
A numeric value between 0 and 1 specifying the credible interval level. Defaults to 0.95 for a 95% credible interval.
2215
2209
X : np.array, optional
2216
2210
Optional array or data frame of covariates at which to compute the intervals. Required if the requested term depends on covariates (e.g., mean forest, variance forest, or overall predictions).
Optional vector of group IDs for random effects. Required if the requested term includes random effects.
2221
2215
rfx_basis : np.array, optional
2222
2216
Optional matrix of basis function evaluations for random effects. Required if the requested term includes random effects.
2217
+
terms : str, optional
2218
+
Character string specifying the model term(s) for which to compute intervals. Options for BART models are `"mean_forest"`, `"variance_forest"`, `"rfx"`, `"y_hat"`, or `"all"`. Defaults to `"all"`.
2219
+
scale : str, optional
2220
+
Scale of mean function predictions. Options are "linear", which returns predictions on the original scale of the mean forest / RFX terms, and "probability", which transforms predictions into a probability of observing `y == 1`. "probability" is only valid for models fit with a probit outcome model. Defaults to `"linear"`.
2221
+
level : float, optional
2222
+
A numeric value between 0 and 1 specifying the credible interval level. Defaults to 0.95 for a 95% credible interval.
Copy file name to clipboardExpand all lines: stochtree/bcf.py
+9-9Lines changed: 9 additions & 9 deletions
Original file line number
Diff line number
Diff line change
@@ -3260,26 +3260,20 @@ def compute_contrast(
3260
3260
3261
3261
defcompute_posterior_interval(
3262
3262
self,
3263
-
terms: Union[list[str], str] ="all",
3264
-
level: float=0.95,
3265
-
scale: str="linear",
3266
3263
X: np.array=None,
3267
3264
Z: np.array=None,
3268
3265
propensity: np.array=None,
3269
3266
rfx_group_ids: np.array=None,
3270
3267
rfx_basis: np.array=None,
3268
+
terms: Union[list[str], str] ="all",
3269
+
level: float=0.95,
3270
+
scale: str="linear",
3271
3271
) ->dict:
3272
3272
"""
3273
3273
Compute posterior credible intervals for specified terms from a fitted BART model. It supports intervals for mean functions, variance functions, random effects, and overall predictions.
3274
3274
3275
3275
Parameters
3276
3276
----------
3277
-
terms : str, optional
3278
-
Character string specifying the model term(s) for which to compute intervals. Options for BCF models are `"prognostic_function"`, `"mu"`, `"cate"`, `"tau"`, `"variance_forest"`, `"rfx"`, or `"y_hat"`. Defaults to `"all"`. Note that `"mu"` is only different from `"prognostic_function"` if random effects are included with a model spec of `"intercept_only"` or `"intercept_plus_treatment"` and `"tau"` is only different from `"cate"` if random effects are included with a model spec of `"intercept_plus_treatment"`.
3279
-
scale : str, optional
3280
-
Scale of mean function predictions. Options are "linear", which returns predictions on the original scale of the mean forest / RFX terms, and "probability", which transforms predictions into a probability of observing `y == 1`. "probability" is only valid for models fit with a probit outcome model. Defaults to `"linear"`.
3281
-
level : float, optional
3282
-
A numeric value between 0 and 1 specifying the credible interval level. Defaults to 0.95 for a 95% credible interval.
3283
3277
X : np.array, optional
3284
3278
Optional array or data frame of covariates at which to compute the intervals. Required if the requested term depends on covariates (e.g., prognostic forest, treatment effect forest, variance forest, or overall predictions).
Optional vector of group IDs for random effects. Required if the requested term includes random effects.
3291
3285
rfx_basis : np.array, optional
3292
3286
Optional matrix of basis function evaluations for random effects. Required if the requested term includes random effects.
3287
+
terms : str, optional
3288
+
Character string specifying the model term(s) for which to compute intervals. Options for BCF models are `"prognostic_function"`, `"mu"`, `"cate"`, `"tau"`, `"variance_forest"`, `"rfx"`, or `"y_hat"`. Defaults to `"all"`. Note that `"mu"` is only different from `"prognostic_function"` if random effects are included with a model spec of `"intercept_only"` or `"intercept_plus_treatment"` and `"tau"` is only different from `"cate"` if random effects are included with a model spec of `"intercept_plus_treatment"`.
3289
+
scale : str, optional
3290
+
Scale of mean function predictions. Options are "linear", which returns predictions on the original scale of the mean forest / RFX terms, and "probability", which transforms predictions into a probability of observing `y == 1`. "probability" is only valid for models fit with a probit outcome model. Defaults to `"linear"`.
3291
+
level : float, optional
3292
+
A numeric value between 0 and 1 specifying the credible interval level. Defaults to 0.95 for a 95% credible interval.
0 commit comments