econml.iv.dml.NonParamDMLIV¶

class
econml.iv.dml.
NonParamDMLIV
(*, model_Y_X, model_T_X, model_T_XZ, model_final, featurizer=None, cv=2, mc_iters=None, mc_agg='mean', discrete_instrument=False, discrete_treatment=False, categories='auto', random_state=None)[source]¶ Bases:
econml.iv.dml._dml._BaseDMLIV
A child of the _BaseDMLIV class that allows for an arbitrary square loss based ML method in the final stage of the DMLIV algorithm. The method has to support sample weights and the fit method has to take as input sample_weights (e.g. random forests), i.e. fit(X, y, sample_weight=None) It achieves this by rewriting the final stage square loss of the DMLIV algorithm as:
\[\sum_i (\E[TX_i, Z_i]  \E[TX_i])^2 * ((Y_i  \E[YX_i])/(\E[TX_i, Z_i]  \E[TX_i])  \theta(X))^2\]Then this can be viewed as a weighted square loss regression, where the target label is
\[\tilde{Y}_i = (Y_i  \E[YX_i])/(\E[TX_i, Z_i]  \E[TX_i])\]and each sample has a weight of
\[V(X_i) = (\E[TX_i, Z_i]  \E[TX_i])^2\]Thus we can call any regression model with inputs:
fit(X, \(\tilde{Y}_i\), sample_weight= \(V(X_i)\))
 Parameters
model_Y_X (estimator) – model to estimate \(\E[Y  X]\). Must support fit and predict methods.
model_T_X (estimator) – model to estimate \(\E[T  X]\). Must support fit and either predict or predict_proba methods, depending on whether the treatment is discrete.
model_T_XZ (estimator) – model to estimate \(\E[T  X, Z]\). Must support fit and either predict or predict_proba methods, depending on whether the treatment is discrete.
model_final (estimator) – final model for predicting \(\tilde{Y}\) from X with sample weights V(X)
cv (int, crossvalidation generator or an iterable, optional, default 2) – Determines the crossvalidation splitting strategy. Possible inputs for cv are:
None, to use the default 3fold crossvalidation,
integer, to specify the number of folds.
An iterable yielding (train, test) splits as arrays of indices.
For integer/None inputs, if the treatment is discrete
StratifiedKFold
is used, else,KFold
is used (with a random shuffle in either case).Unless an iterable is used, we call split(concat[W, X], T) to generate the splits. If all W, X are None, then we call split(ones((T.shape[0], 1)), T).
mc_iters (int, optional (default=None)) – The number of times to rerun the first stage models to reduce the variance of the nuisances.
mc_agg ({‘mean’, ‘median’}, optional (default=’mean’)) – How to aggregate the nuisance value for each sample across the mc_iters monte carlo iterations of crossfitting.
discrete_instrument (bool, optional, default False) – Whether the instrument values should be treated as categorical, rather than continuous, quantities
discrete_treatment (bool, optional, default False) – Whether the treatment values should be treated as categorical, rather than continuous, quantities
categories (‘auto’ or list, default ‘auto’) – The categories to use when encoding discrete treatments (or ‘auto’ to use the unique sorted values). The first category will be treated as the control treatment.
random_state (int,
RandomState
instance or None, optional (default=None)) – If int, random_state is the seed used by the random number generator; IfRandomState
instance, random_state is the random number generator; If None, the random number generator is theRandomState
instance used bynp.random
.

__init__
(*, model_Y_X, model_T_X, model_T_XZ, model_final, featurizer=None, cv=2, mc_iters=None, mc_agg='mean', discrete_instrument=False, discrete_treatment=False, categories='auto', random_state=None)[source]¶ Initialize self. See help(type(self)) for accurate signature.
Methods
__init__
(*, model_Y_X, model_T_X, …[, …])Initialize self.
ate
([X, T0, T1])Calculate the average treatment effect \(E_X[\tau(X, T0, T1)]\).
ate_inference
([X, T0, T1])Inference results for the quantity \(E_X[\tau(X, T0, T1)]\) produced by the model.
ate_interval
([X, T0, T1, alpha])Confidence intervals for the quantity \(E_X[\tau(X, T0, T1)]\) produced by the model.
cate_feature_names
([feature_names])Get the output feature names.
cate_output_names
([output_names])Public interface for getting output names.
cate_treatment_names
([treatment_names])Get treatment names.
const_marginal_ate
([X])Calculate the average constant marginal CATE \(E_X[\theta(X)]\).
Inference results for the quantities \(E_X[\theta(X)]\) produced by the model.
const_marginal_ate_interval
([X, alpha])Confidence intervals for the quantities \(E_X[\theta(X)]\) produced by the model.
Calculate the constant marginal CATE \(\theta(·)\).
Inference results for the quantities \(\theta(X)\) produced by the model.
const_marginal_effect_interval
([X, alpha])Confidence intervals for the quantities \(\theta(X)\) produced by the model.
effect
([X, T0, T1])Calculate the heterogeneous treatment effect \(\tau(X, T0, T1)\).
effect_inference
([X, T0, T1])Inference results for the quantities \(\tau(X, T0, T1)\) produced by the model.
effect_interval
([X, T0, T1, alpha])Confidence intervals for the quantities \(\tau(X, T0, T1)\) produced by the model.
fit
(Y, T, Z[, X, sample_weight, …])Estimate the counterfactual model from data, i.e.
marginal_ate
(T[, X])Calculate the average marginal effect \(E_{T, X}[\partial\tau(T, X)]\).
marginal_ate_inference
(T[, X])Inference results for the quantities \(E_{T,X}[\partial \tau(T, X)]\) produced by the model.
marginal_ate_interval
(T[, X, alpha])Confidence intervals for the quantities \(E_{T,X}[\partial \tau(T, X)]\) produced by the model.
marginal_effect
(T[, X])Calculate the heterogeneous marginal effect \(\partial\tau(T, X)\).
marginal_effect_inference
(T[, X])Inference results for the quantities \(\partial \tau(T, X)\) produced by the model.
marginal_effect_interval
(T[, X, alpha])Confidence intervals for the quantities \(\partial \tau(T, X)\) produced by the model.
refit_final
([inference])Estimate the counterfactual model using a new final model specification but with cached first stage results.
score
(Y, T, Z[, X])Score the fitted CATE model on a new data set.
shap_values
(X, *[, feature_names, …])Shap value for the final stage models (const_marginal_effect)
Attributes
Get an instance of
DoWhyWrapper
to allow other functionalities from dowhy package.featurizer_
Get the fitted final CATE model.
model_final_
Get the fitted models for \(\E[T  X]\).
Get the fitted models for \(\E[T  X, Z]\).
Get the fitted models for \(\E[Y  X]\).
models_nuisance_
Get the scores for T_X model on the outofsample training data
Get the scores for T_XZ model on the outofsample training data
Get the scores for Y_X model on the outofsample training data
original_featurizer
ortho_learner_model_final_
transformer

ate
(X=None, *, T0=0, T1=1)¶ Calculate the average treatment effect \(E_X[\tau(X, T0, T1)]\).
The effect is calculated between the two treatment points and is averaged over the population of X variables.
 Parameters
T0 ((m, d_t) matrix or vector of length m) – Base treatments for each sample
T1 ((m, d_t) matrix or vector of length m) – Target treatments for each sample
X (optional (m, d_x) matrix) – Features for each sample
 Returns
τ – Average treatment effects on each outcome Note that when Y is a vector rather than a 2dimensional array, the result will be a scalar
 Return type
float or (d_y,) array

ate_inference
(X=None, *, T0=0, T1=1)¶ Inference results for the quantity \(E_X[\tau(X, T0, T1)]\) produced by the model. Available only when
inference
is notNone
, when calling the fit method. Parameters
X (optional (m, d_x) matrix) – Features for each sample
T0 (optional (m, d_t) matrix or vector of length m (Default=0)) – Base treatments for each sample
T1 (optional (m, d_t) matrix or vector of length m (Default=1)) – Target treatments for each sample
 Returns
PopulationSummaryResults – The inference results instance contains prediction and prediction standard error and can on demand calculate confidence interval, z statistic and p value. It can also output a dataframe summary of these inference results.
 Return type

ate_interval
(X=None, *, T0=0, T1=1, alpha=0.1)¶ Confidence intervals for the quantity \(E_X[\tau(X, T0, T1)]\) produced by the model. Available only when
inference
is notNone
, when calling the fit method. Parameters
X (optional (m, d_x) matrix) – Features for each sample
T0 (optional (m, d_t) matrix or vector of length m (Default=0)) – Base treatments for each sample
T1 (optional (m, d_t) matrix or vector of length m (Default=1)) – Target treatments for each sample
alpha (optional float in [0, 1] (Default=0.1)) – The overall level of confidence of the reported interval. The alpha/2, 1alpha/2 confidence interval is reported.
 Returns
lower, upper – The lower and the upper bounds of the confidence interval for each quantity.
 Return type
tuple(type of
ate(X, T0, T1)
, type ofate(X, T0, T1))
)

cate_feature_names
(feature_names=None)¶ Get the output feature names.
 Parameters
feature_names (list of strings of length X.shape[1] or None) – The names of the input features. If None and X is a dataframe, it defaults to the column names from the dataframe.
 Returns
out_feature_names – The names of the output features \(\phi(X)\), i.e. the features with respect to which the final constant marginal CATE model is linear. It is the names of the features that are associated with each entry of the
coef_()
parameter. Not available when the featurizer is not None and does not have a method: get_feature_names(feature_names). Otherwise None is returned. Return type
list of strings or None

cate_output_names
(output_names=None)¶ Public interface for getting output names.
To be overriden by estimators that apply transformations the outputs.
 Parameters
output_names (list of strings of length Y.shape[1] or None) – The names of the outcomes. If None and the Y passed to fit was a dataframe, it defaults to the column names from the dataframe.
 Returns
output_names – Returns output names.
 Return type
list of strings

cate_treatment_names
(treatment_names=None)¶ Get treatment names.
If the treatment is discrete, it will return expanded treatment names.
 Parameters
treatment_names (list of strings of length T.shape[1] or None) – The names of the treatments. If None and the T passed to fit was a dataframe, it defaults to the column names from the dataframe.
 Returns
out_treatment_names – Returns (possibly expanded) treatment names.
 Return type
list of strings

const_marginal_ate
(X=None)¶ Calculate the average constant marginal CATE \(E_X[\theta(X)]\).
 Parameters
X (optional (m, d_x) matrix or None (Default=None)) – Features for each sample.
 Returns
theta – Average constant marginal CATE of each treatment on each outcome. Note that when Y or T is a vector rather than a 2dimensional array, the corresponding singleton dimensions in the output will be collapsed (e.g. if both are vectors, then the output of this method will be a scalar)
 Return type
(d_y, d_t) matrix

const_marginal_ate_inference
(X=None)¶ Inference results for the quantities \(E_X[\theta(X)]\) produced by the model. Available only when
inference
is notNone
, when calling the fit method. Parameters
X (optional (m, d_x) matrix or None (Default=None)) – Features for each sample
 Returns
PopulationSummaryResults – The inference results instance contains prediction and prediction standard error and can on demand calculate confidence interval, z statistic and p value. It can also output a dataframe summary of these inference results.
 Return type

const_marginal_ate_interval
(X=None, *, alpha=0.1)¶ Confidence intervals for the quantities \(E_X[\theta(X)]\) produced by the model. Available only when
inference
is notNone
, when calling the fit method. Parameters
X (optional (m, d_x) matrix or None (Default=None)) – Features for each sample
alpha (optional float in [0, 1] (Default=0.1)) – The overall level of confidence of the reported interval. The alpha/2, 1alpha/2 confidence interval is reported.
 Returns
lower, upper – The lower and the upper bounds of the confidence interval for each quantity.
 Return type
tuple(type of
const_marginal_ate(X)
, type ofconst_marginal_ate(X)
)

const_marginal_effect
(X=None)¶ Calculate the constant marginal CATE \(\theta(·)\).
The marginal effect is conditional on a vector of features on a set of m test samples X[i].
 Parameters
X (optional (m, d_x) matrix or None (Default=None)) – Features for each sample.
 Returns
theta – Constant marginal CATE of each treatment on each outcome for each sample X[i]. Note that when Y or T is a vector rather than a 2dimensional array, the corresponding singleton dimensions in the output will be collapsed (e.g. if both are vectors, then the output of this method will also be a vector)
 Return type
(m, d_y, d_t) matrix or (d_y, d_t) matrix if X is None

const_marginal_effect_inference
(X=None)¶ Inference results for the quantities \(\theta(X)\) produced by the model. Available only when
inference
is notNone
, when calling the fit method. Parameters
X (optional (m, d_x) matrix or None (Default=None)) – Features for each sample
 Returns
InferenceResults – The inference results instance contains prediction and prediction standard error and can on demand calculate confidence interval, z statistic and p value. It can also output a dataframe summary of these inference results.
 Return type

const_marginal_effect_interval
(X=None, *, alpha=0.1)¶ Confidence intervals for the quantities \(\theta(X)\) produced by the model. Available only when
inference
is notNone
, when calling the fit method. Parameters
X (optional (m, d_x) matrix or None (Default=None)) – Features for each sample
alpha (optional float in [0, 1] (Default=0.1)) – The overall level of confidence of the reported interval. The alpha/2, 1alpha/2 confidence interval is reported.
 Returns
lower, upper – The lower and the upper bounds of the confidence interval for each quantity.
 Return type
tuple(type of
const_marginal_effect(X)
, type ofconst_marginal_effect(X)
)

effect
(X=None, *, T0=0, T1=1)¶ Calculate the heterogeneous treatment effect \(\tau(X, T0, T1)\).
The effect is calculated between the two treatment points conditional on a vector of features on a set of m test samples \(\{T0_i, T1_i, X_i\}\).
 Parameters
T0 ((m, d_t) matrix or vector of length m) – Base treatments for each sample
T1 ((m, d_t) matrix or vector of length m) – Target treatments for each sample
X (optional (m, d_x) matrix) – Features for each sample
 Returns
τ – Heterogeneous treatment effects on each outcome for each sample Note that when Y is a vector rather than a 2dimensional array, the corresponding singleton dimension will be collapsed (so this method will return a vector)
 Return type
(m, d_y) matrix

effect_inference
(X=None, *, T0=0, T1=1)¶ Inference results for the quantities \(\tau(X, T0, T1)\) produced by the model. Available only when
inference
is notNone
, when calling the fit method. Parameters
X (optional (m, d_x) matrix) – Features for each sample
T0 (optional (m, d_t) matrix or vector of length m (Default=0)) – Base treatments for each sample
T1 (optional (m, d_t) matrix or vector of length m (Default=1)) – Target treatments for each sample
 Returns
InferenceResults – The inference results instance contains prediction and prediction standard error and can on demand calculate confidence interval, z statistic and p value. It can also output a dataframe summary of these inference results.
 Return type

effect_interval
(X=None, *, T0=0, T1=1, alpha=0.1)¶ Confidence intervals for the quantities \(\tau(X, T0, T1)\) produced by the model. Available only when
inference
is notNone
, when calling the fit method. Parameters
X (optional (m, d_x) matrix) – Features for each sample
T0 (optional (m, d_t) matrix or vector of length m (Default=0)) – Base treatments for each sample
T1 (optional (m, d_t) matrix or vector of length m (Default=1)) – Target treatments for each sample
alpha (optional float in [0, 1] (Default=0.1)) – The overall level of confidence of the reported interval. The alpha/2, 1alpha/2 confidence interval is reported.
 Returns
lower, upper – The lower and the upper bounds of the confidence interval for each quantity.
 Return type
tuple(type of
effect(X, T0, T1)
, type ofeffect(X, T0, T1))
)

fit
(Y, T, Z, X=None, *, sample_weight=None, freq_weight=None, sample_var=None, groups=None, cache_values=False, inference=None)¶ Estimate the counterfactual model from data, i.e. estimates function \(\theta(\cdot)\).
 Parameters
Y ((n, d_y) matrix or vector of length n) – Outcomes for each sample
T ((n, d_t) matrix or vector of length n) – Treatments for each sample
Z ((n, d_z) matrix) – Instruments for each sample
X (optional(n, d_x) matrix or None (Default=None)) – Features for each sample
sample_weight ((n,) array like, default None) – Individual weights for each sample. If None, it assumes equal weight.
freq_weight ((n,) array like of integers, default None) – Weight for the observation. Observation i is treated as the mean outcome of freq_weight[i] independent observations. When
sample_var
is not None, this should be provided.sample_var ({(n,), (n, d_y)} nd array like, default None) – Variance of the outcome(s) of the original freq_weight[i] observations that were used to compute the mean outcome represented by observation i.
groups ((n,) vector, optional) – All rows corresponding to the same group will be kept together during splitting. If groups is not None, the cv argument passed to this class’s initializer must support a ‘groups’ argument to its split method.
cache_values (bool, default False) – Whether to cache inputs and first stage results, which will allow refitting a different final model
inference (string,:class:.Inference instance, or None) – Method for performing inference. This estimator supports ‘bootstrap’ (or an instance of:class:.BootstrapInference).
 Returns
self
 Return type
_BaseDMLIV

marginal_ate
(T, X=None)¶ Calculate the average marginal effect \(E_{T, X}[\partial\tau(T, X)]\).
The marginal effect is calculated around a base treatment point and averaged over the population of X.
 Parameters
T ((m, d_t) matrix) – Base treatments for each sample
X (optional (m, d_x) matrix) – Features for each sample
 Returns
grad_tau – Average marginal effects on each outcome Note that when Y or T is a vector rather than a 2dimensional array, the corresponding singleton dimensions in the output will be collapsed (e.g. if both are vectors, then the output of this method will be a scalar)
 Return type
(d_y, d_t) array

marginal_ate_inference
(T, X=None)¶ Inference results for the quantities \(E_{T,X}[\partial \tau(T, X)]\) produced by the model. Available only when
inference
is notNone
, when calling the fit method. Parameters
T ((m, d_t) matrix) – Base treatments for each sample
X (optional (m, d_x) matrix or None (Default=None)) – Features for each sample
 Returns
PopulationSummaryResults – The inference results instance contains prediction and prediction standard error and can on demand calculate confidence interval, z statistic and p value. It can also output a dataframe summary of these inference results.
 Return type

marginal_ate_interval
(T, X=None, *, alpha=0.1)¶ Confidence intervals for the quantities \(E_{T,X}[\partial \tau(T, X)]\) produced by the model. Available only when
inference
is notNone
, when calling the fit method. Parameters
T ((m, d_t) matrix) – Base treatments for each sample
X (optional (m, d_x) matrix or None (Default=None)) – Features for each sample
alpha (optional float in [0, 1] (Default=0.1)) – The overall level of confidence of the reported interval. The alpha/2, 1alpha/2 confidence interval is reported.
 Returns
lower, upper – The lower and the upper bounds of the confidence interval for each quantity.
 Return type
tuple(type of
marginal_ate(T, X)
, type ofmarginal_ate(T, X)
)

marginal_effect
(T, X=None)¶ Calculate the heterogeneous marginal effect \(\partial\tau(T, X)\).
The marginal effect is calculated around a base treatment point conditional on a vector of features on a set of m test samples \(\{T_i, X_i\}\). Since this class assumes a linear model, the base treatment is ignored in this calculation.
 Parameters
T ((m, d_t) matrix) – Base treatments for each sample
X (optional (m, d_x) matrix) – Features for each sample
 Returns
grad_tau – Heterogeneous marginal effects on each outcome for each sample Note that when Y or T is a vector rather than a 2dimensional array, the corresponding singleton dimensions in the output will be collapsed (e.g. if both are vectors, then the output of this method will also be a vector)
 Return type
(m, d_y, d_t) array

marginal_effect_inference
(T, X=None)¶ Inference results for the quantities \(\partial \tau(T, X)\) produced by the model. Available only when
inference
is notNone
, when calling the fit method. Parameters
T ((m, d_t) matrix) – Base treatments for each sample
X (optional (m, d_x) matrix or None (Default=None)) – Features for each sample
 Returns
InferenceResults – The inference results instance contains prediction and prediction standard error and can on demand calculate confidence interval, z statistic and p value. It can also output a dataframe summary of these inference results.
 Return type

marginal_effect_interval
(T, X=None, *, alpha=0.1)¶ Confidence intervals for the quantities \(\partial \tau(T, X)\) produced by the model. Available only when
inference
is notNone
, when calling the fit method. Parameters
T ((m, d_t) matrix) – Base treatments for each sample
X (optional (m, d_x) matrix or None (Default=None)) – Features for each sample
alpha (optional float in [0, 1] (Default=0.1)) – The overall level of confidence of the reported interval. The alpha/2, 1alpha/2 confidence interval is reported.
 Returns
lower, upper – The lower and the upper bounds of the confidence interval for each quantity.
 Return type
tuple(type of
marginal_effect(T, X)
, type ofmarginal_effect(T, X)
)

refit_final
(inference=None)¶ Estimate the counterfactual model using a new final model specification but with cached first stage results.
In order for this to succeed,
fit
must have been called withcache_values=True
. This call will only refit the final model. This call we use the current setting of any parameters that change the final stage estimation. If any parameters that change how the first stage nuisance estimates has also been changed then it will have no effect. You need to call fit again to change the first stage estimation results. Parameters
inference (inference method, optional) – The string or object that represents the inference method
 Returns
self – This instance
 Return type

score
(Y, T, Z, X=None)¶ Score the fitted CATE model on a new data set. Generates nuisance parameters for the new data set based on the fitted residual nuisance models created at fit time. It uses the mean prediction of the models fitted by the different crossfit folds. Then calculates the MSE of the final residual Y on residual T regression.
If model_final does not have a score method, then it raises an
AttributeError
 Parameters
Y ((n, d_y) matrix or vector of length n) – Outcomes for each sample
T ((n, d_t) matrix or vector of length n) – Treatments for each sample
Z (optional(n, d_z) matrix) – Instruments for each sample
X (optional(n, d_x) matrix or None (Default=None)) – Features for each sample
 Returns
score – The MSE of the final CATE model on the new data.
 Return type

shap_values
(X, *, feature_names=None, treatment_names=None, output_names=None, background_samples=100)¶ Shap value for the final stage models (const_marginal_effect)
 Parameters
X ((m, d_x) matrix) – Features for each sample. Should be in the same shape of fitted X in final stage.
feature_names (optional None or list of strings of length X.shape[1] (Default=None)) – The names of input features.
treatment_names (optional None or list (Default=None)) – The name of treatment. In discrete treatment scenario, the name should not include the name of the baseline treatment (i.e. the control treatment, which by default is the alphabetically smaller)
output_names (optional None or list (Default=None)) – The name of the outcome.
background_samples (int or None, (Default=100)) – How many samples to use to compute the baseline effect. If None then all samples are used.
 Returns
shap_outs – A nested dictionary by using each output name (e.g. ‘Y0’, ‘Y1’, … when output_names=None) and each treatment name (e.g. ‘T0’, ‘T1’, … when treatment_names=None) as key and the shap_values explanation object as value. If the input data at fit time also contain metadata, (e.g. are pandas DataFrames), then the column metatdata for the treatments, outcomes and features are used instead of the above defaults (unless the user overrides with explicitly passing the corresponding names).
 Return type
nested dictionary of Explanation object

property
dowhy
¶ Get an instance of
DoWhyWrapper
to allow other functionalities from dowhy package. (e.g. causal graph, refutation test, etc.) Returns
DoWhyWrapper – An instance of
DoWhyWrapper
 Return type
instance

property
model_cate
¶ Get the fitted final CATE model.
 Returns
model_cate – An instance of the model_final object that was fitted after calling fit which corresponds to the constant marginal CATE model.
 Return type
object of type(model_final)

property
models_T_X
¶ Get the fitted models for \(\E[T  X]\).
 Returns
models_T_X – A nested list of instances of the model_T_X object. Number of sublist equals to number of monte carlo iterations, each element in the sublist corresponds to a crossfitting fold and is the model instance that was fitted for that training fold.
 Return type
nested list of objects of type(model_T_X)

property
models_T_XZ
¶ Get the fitted models for \(\E[T  X, Z]\).
 Returns
models_T_XZ – A nested list of instances of the model_T_XZ object. Number of sublist equals to number of monte carlo iterations, each element in the sublist corresponds to a crossfitting fold and is the model instance that was fitted for that training fold.
 Return type
nested list of objects of type(model_T_XZ)

property
models_Y_X
¶ Get the fitted models for \(\E[Y  X]\).
 Returns
models_Y_X – A nested list of instances of the model_Y_X object. Number of sublist equals to number of monte carlo iterations, each element in the sublist corresponds to a crossfitting fold and is the model instance that was fitted for that training fold.
 Return type
nested list of objects of type(model_Y_X)

property
nuisance_scores_T_X
¶ Get the scores for T_X model on the outofsample training data

property
nuisance_scores_T_XZ
¶ Get the scores for T_XZ model on the outofsample training data

property
nuisance_scores_Y_X
¶ Get the scores for Y_X model on the outofsample training data