cleverly.learners.ParametricOutcome#
- class cleverly.learners.ParametricOutcome(features: Literal['main_terms', 'arm_interactions', 'arm_interactions_no_intercept'] = 'arm_interactions', arm_columns: int = 1)[source]#
An unpenalized logistic GLM of the outcome on a declared feature map.
The target is binary, or an outcome already scaled to
[0, 1](a quasi-binomial fit).predictreturns the fitted mean, andpredict_probareturns it as the class 1 column.- Parameters:
- features{“main_terms”, “arm_interactions”, “arm_interactions_no_intercept”}
The feature map of
OutcomeFeatures.- arm_columns
int The number of treatment columns that lead the outcome design: 1 for a binary treatment,
K - 1forKarms. A fit refuses a value that differs from the width of the treatment block of its data, withMethodConfigurationError, wherever the learner sits: bare, in a library, or inside a wrapper.
- Attributes:
- coef_
ndarray The fitted coefficients, in the column order of
design_matrix().- diagnostics_
ParametricFitDiagnostics The fit’s coefficients, convergence and conditioning.
- coef_
Methods#
- ParametricOutcome.design_matrix(x: Any) ndarray[tuple[Any, ...], dtype[float64]][source]#
The outcome feature matrix of the design
x, intercept first.- Parameters:
- xarray_like
(n, d), the outcome design[I, W]witharm_columnsleading treatment columns.
- Returns:
ndarrayThe feature matrix of
OutcomeFeatures.
- Raises:
ValueErrorIf the feature map is not in the vocabulary, or the design has no covariate column.
- ParametricOutcome.set_fit_request(*, sample_weight: bool | None | str = '$UNCHANGED$', x: bool | None | str = '$UNCHANGED$') ParametricOutcome#
Configure whether metadata should be requested to be passed to the
fitmethod.Note that this method is only relevant when this estimator is used as a sub-estimator within a meta-estimator and metadata routing is enabled with
enable_metadata_routing=True(seesklearn.set_config()). Please check the User Guide on how the routing mechanism works.The options for each parameter are:
True: metadata is requested, and passed tofitif provided. The request is ignored if metadata is not provided.False: metadata is not requested and the meta-estimator will not pass it tofit.None: metadata is not requested, and the meta-estimator will raise an error if the user provides it.str: metadata should be passed to the meta-estimator with this given alias instead of the original name.
The default (
sklearn.utils.metadata_routing.UNCHANGED) retains the existing request. This allows you to change the request for some parameters and not others.Added in version 1.3.
- Parameters:
- Returns:
- self
object The updated object.
- self
- ParametricOutcome.set_predict_proba_request(*, x: bool | None | str = '$UNCHANGED$') ParametricOutcome#
Configure whether metadata should be requested to be passed to the
predict_probamethod.Note that this method is only relevant when this estimator is used as a sub-estimator within a meta-estimator and metadata routing is enabled with
enable_metadata_routing=True(seesklearn.set_config()). Please check the User Guide on how the routing mechanism works.The options for each parameter are:
True: metadata is requested, and passed topredict_probaif provided. The request is ignored if metadata is not provided.False: metadata is not requested and the meta-estimator will not pass it topredict_proba.None: metadata is not requested, and the meta-estimator will raise an error if the user provides it.str: metadata should be passed to the meta-estimator with this given alias instead of the original name.
The default (
sklearn.utils.metadata_routing.UNCHANGED) retains the existing request. This allows you to change the request for some parameters and not others.Added in version 1.3.
- ParametricOutcome.set_predict_request(*, x: bool | None | str = '$UNCHANGED$') ParametricOutcome#
Configure whether metadata should be requested to be passed to the
predictmethod.Note that this method is only relevant when this estimator is used as a sub-estimator within a meta-estimator and metadata routing is enabled with
enable_metadata_routing=True(seesklearn.set_config()). Please check the User Guide on how the routing mechanism works.The options for each parameter are:
True: metadata is requested, and passed topredictif provided. The request is ignored if metadata is not provided.False: metadata is not requested and the meta-estimator will not pass it topredict.None: metadata is not requested, and the meta-estimator will raise an error if the user provides it.str: metadata should be passed to the meta-estimator with this given alias instead of the original name.
The default (
sklearn.utils.metadata_routing.UNCHANGED) retains the existing request. This allows you to change the request for some parameters and not others.Added in version 1.3.
Attributes#
- ParametricOutcome.diagnostics_: ParametricFitDiagnostics#