kpe()¶
kpe.kpe(X, A, Y, propensity=None, *, n_shuffles=100, n_folds=6, n_nuisance_folds=None, is_rct=True, contextual_policy='policy_tree', best_arm='ips', reward_model='random_forest', propensity_model='logistic', policy_features=None, n_jobs=1, random_state=None, verbose=False)
¶
K-Fold Personalization Estimator — kpe2 shared-nuisance cross-fitting.
This kpe2 variant fits all nuisances (reward model, contextual policy,
best single arm, and — when is_rct=False — the propensity) on a shared
set of n_nuisance_folds folds, then evaluates the AIPW influence on the
held-out evaluation block. See :mod:kpe.core.cross_fit.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
X
|
(array - like, shape(n, d))
|
Baseline covariates. |
required |
A
|
array-like of int, shape (n,)
|
Observed treatment, values in 0..K-1. |
required |
Y
|
(array - like, shape(n))
|
Observed outcome. |
required |
propensity
|
scalar, shape (n,), or shape (n, K)
|
Known propensity p(A_i | X_i). Required when |
None
|
n_shuffles
|
int
|
Number of Algorithm-1 repetitions (each with a different seed). |
100
|
n_folds
|
int
|
Number of folds K the data is partitioned into (default 6). |
6
|
n_nuisance_folds
|
int
|
Number of folds m used to fit all nuisances (default |
None
|
is_rct
|
bool
|
If True, |
True
|
contextual_policy
|
Any
|
Each may be a string in the built-in registry or a fit/predict object.
|
'policy_tree'
|
best_arm
|
Any
|
Each may be a string in the built-in registry or a fit/predict object.
|
'policy_tree'
|
reward_model
|
Any
|
Each may be a string in the built-in registry or a fit/predict object.
|
'policy_tree'
|
propensity_model
|
Any
|
Each may be a string in the built-in registry or a fit/predict object.
|
'policy_tree'
|
policy_features
|
sequence of int
|
Columns of X to pass to the contextual policy. Defaults to all columns. |
None
|
n_jobs
|
int
|
Passed through to joblib. |
1
|
random_state
|
int
|
Base seed. Shuffle s uses |
None
|