uqmodels.modelization package

Subpackages

Submodules

uqmodels.modelization.UQEstimator module

class uqmodels.modelization.UQEstimator.MeanVarUQEstimator(estimator=None, estimator_var=None, type_UQ='var', name='MeanVarUQEstimator', rescale=False, var_min=1e-05, random_state=None)[source]

Bases: UQEstimator

Mean var UQ Estimator that estimate a mean values and estimate irreductible

fit(X, y, skip_format=False, **kwargs)[source]

Fit UQestimator using training data. :param X: train features :param y: train targets/observations

predict(X, skip_format=False, **kwargs)[source]

Compute prediction (or provide None) and UQ-measure :param X: features

Returns:

pred, UQ_measure

set_fit_request(*, skip_format: bool | None | str = '$UNCHANGED$') MeanVarUQEstimator

Request metadata passed to the fit method.

Note that this method is only relevant if enable_metadata_routing=True (see sklearn.set_config()). Please see User Guide on how the routing mechanism works.

The options for each parameter are:

  • True: metadata is requested, and passed to fit if provided. The request is ignored if metadata is not provided.

  • False: metadata is not requested and the meta-estimator will not pass it to fit.

  • 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.

Note

This method is only relevant if this estimator is used as a sub-estimator of a meta-estimator, e.g. used inside a pipeline.Pipeline. Otherwise it has no effect.

Parameters:

skip_format (str, True, False, or None, default=sklearn.utils.metadata_routing.UNCHANGED) – Metadata routing for skip_format parameter in fit.

Returns:

self – The updated object.

Return type:

object

set_predict_request(*, skip_format: bool | None | str = '$UNCHANGED$') MeanVarUQEstimator

Request metadata passed to the predict method.

Note that this method is only relevant if enable_metadata_routing=True (see sklearn.set_config()). Please see User Guide on how the routing mechanism works.

The options for each parameter are:

  • True: metadata is requested, and passed to predict if provided. The request is ignored if metadata is not provided.

  • False: metadata is not requested and the meta-estimator will not pass it to predict.

  • 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.

Note

This method is only relevant if this estimator is used as a sub-estimator of a meta-estimator, e.g. used inside a pipeline.Pipeline. Otherwise it has no effect.

Parameters:

skip_format (str, True, False, or None, default=sklearn.utils.metadata_routing.UNCHANGED) – Metadata routing for skip_format parameter in predict.

Returns:

self – The updated object.

Return type:

object

class uqmodels.modelization.UQEstimator.QuantileUQEstimator(list_estimators, list_alpha: list = [0.025, 0.5, 0.975], type_UQ: str = 'quantile', name: str = 'QuantileUQEstimator', rescale=False, var_min=1e-05, random_state=None, **kwargs)[source]

Bases: UQEstimator

fit(X, y, skip_format=False, **kwargs)[source]

Fit UQestimator using training data. :param X: train features :param y: train targets/observations

predict(X, skip_format=False, **kwargs)[source]

Compute prediction (or provide None) and UQ-measure :param X: features

Returns:

pred, UQ_measure

set_fit_request(*, skip_format: bool | None | str = '$UNCHANGED$') QuantileUQEstimator

Request metadata passed to the fit method.

Note that this method is only relevant if enable_metadata_routing=True (see sklearn.set_config()). Please see User Guide on how the routing mechanism works.

The options for each parameter are:

  • True: metadata is requested, and passed to fit if provided. The request is ignored if metadata is not provided.

  • False: metadata is not requested and the meta-estimator will not pass it to fit.

  • 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.

Note

This method is only relevant if this estimator is used as a sub-estimator of a meta-estimator, e.g. used inside a pipeline.Pipeline. Otherwise it has no effect.

Parameters:

skip_format (str, True, False, or None, default=sklearn.utils.metadata_routing.UNCHANGED) – Metadata routing for skip_format parameter in fit.

Returns:

self – The updated object.

Return type:

object

set_predict_request(*, skip_format: bool | None | str = '$UNCHANGED$') QuantileUQEstimator

Request metadata passed to the predict method.

Note that this method is only relevant if enable_metadata_routing=True (see sklearn.set_config()). Please see User Guide on how the routing mechanism works.

The options for each parameter are:

  • True: metadata is requested, and passed to predict if provided. The request is ignored if metadata is not provided.

  • False: metadata is not requested and the meta-estimator will not pass it to predict.

  • 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.

Note

This method is only relevant if this estimator is used as a sub-estimator of a meta-estimator, e.g. used inside a pipeline.Pipeline. Otherwise it has no effect.

Parameters:

skip_format (str, True, False, or None, default=sklearn.utils.metadata_routing.UNCHANGED) – Metadata routing for skip_format parameter in predict.

Returns:

self – The updated object.

Return type:

object

class uqmodels.modelization.UQEstimator.UQEstimator(name='UQEstimator', type_UQ='None', rescale=False, type_UQ_params=None, var_min=1e-06, random_state=None)[source]

Bases: BaseEstimator

Abstract structure of a UQEstimator : Estimator (fit/predict) that perform prediction(optionaly) and UQmeasure estimation

factory(X, y, type_transform='transform', only_fit_scaler=False, **kwargs)[source]
abstract fit(X: array, y: array, skip_format=False, **kwargs) None[source]

Fit UQestimator using training data. :param X: train features :param y: train targets/observations

get_params(deep=False)[source]

Get parameters for this estimator.

Parameters:

deep (bool, default=True) – If True, will return the parameters for this estimator and contained subobjects that are estimators.

Returns:

params – Parameter names mapped to their values.

Return type:

dict

abstract predict(X: array, skip_format=False, **kwargs)[source]

Compute prediction (or provide None) and UQ-measure :param X: features

Returns:

pred, UQ_measure

set_fit_request(*, skip_format: bool | None | str = '$UNCHANGED$') UQEstimator

Request metadata passed to the fit method.

Note that this method is only relevant if enable_metadata_routing=True (see sklearn.set_config()). Please see User Guide on how the routing mechanism works.

The options for each parameter are:

  • True: metadata is requested, and passed to fit if provided. The request is ignored if metadata is not provided.

  • False: metadata is not requested and the meta-estimator will not pass it to fit.

  • 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.

Note

This method is only relevant if this estimator is used as a sub-estimator of a meta-estimator, e.g. used inside a pipeline.Pipeline. Otherwise it has no effect.

Parameters:

skip_format (str, True, False, or None, default=sklearn.utils.metadata_routing.UNCHANGED) – Metadata routing for skip_format parameter in fit.

Returns:

self – The updated object.

Return type:

object

set_predict_request(*, skip_format: bool | None | str = '$UNCHANGED$') UQEstimator

Request metadata passed to the predict method.

Note that this method is only relevant if enable_metadata_routing=True (see sklearn.set_config()). Please see User Guide on how the routing mechanism works.

The options for each parameter are:

  • True: metadata is requested, and passed to predict if provided. The request is ignored if metadata is not provided.

  • False: metadata is not requested and the meta-estimator will not pass it to predict.

  • 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.

Note

This method is only relevant if this estimator is used as a sub-estimator of a meta-estimator, e.g. used inside a pipeline.Pipeline. Otherwise it has no effect.

Parameters:

skip_format (str, True, False, or None, default=sklearn.utils.metadata_routing.UNCHANGED) – Metadata routing for skip_format parameter in predict.

Returns:

self – The updated object.

Return type:

object

uqmodels.modelization.UQEstimator.check_type_UQ(type_UQ)[source]
uqmodels.modelization.UQEstimator.get_UQEstimator_parameters(model_parameters={}, factory_parameters={}, training_parameters=None, type_output=None, rescale=False, random_state=None, **kwargs)[source]

Generate dict object containing UQEstimators parameters to provide to init().

Parameters:
  • model_parameters (dict, optional) – UQestimators parameters. Defaults to {}.

  • factory_parameters (dict, optional) – Factory parameters, to data preprocessing. Defaults to {}.

  • training_parameters (_type_, optional) – Model training parameters for DEEP estimators. Defaults to None.

  • type_output (_type_, optional) – Specification of deep learning output. Defaults to None.

  • rescale (bool, optional) – Use or not internal rescale function Defaults to False.

  • random_state (bool) – handle experimental random using seed.

Returns:

UQEstimators parameters

Return type:

dict

Module contents