Estimators
Emukit
Contains the Scikit-Learn wrapper for Emukit
The defined Scikit-Learn wrapper for the Emukit library.
- class calisim.estimators.emukit_estimator.EmukitEstimator(method_kwargs: dict | None = None)[source]
- fit(X: ndarray, y: ndarray | None = None) EmukitEstimator[source]
Fit the estimator.
- Parameters:
X (np.ndarray) – The simulation inputs.
y (np.ndarray | None, optional) – The simulation outputs. Defaults to None.
- Returns:
The estimator.
- Return type:
- predict(X: ndarray, return_std: bool = False) ndarray | tuple[source]
Make a prediction.
- Parameters:
X (np.ndarray) – The simulation inputs.
return_std (bool, optional) – Whether to return the standard deviation. Defaults to False.
- Returns:
The model predictions.
- Return type:
np.ndarray | tuple
- score(X: ndarray, y: ndarray, sample_weight: ndarray | None = None) float[source]
Assess the estimator.
- Parameters:
X (np.ndarray) – The simulation inputs.
y (np.ndarray) – The simulation outputs.
sample_weight (np.ndarray | None, optional) – Weighting factor for the samples. Defaults to None.
- Returns:
The assessment score.
- Return type:
float
- set_predict_request(*, return_std: bool | None | str = '$UNCHANGED$') EmukitEstimator
Request metadata passed to the
predictmethod.Note that this method is only relevant if
enable_metadata_routing=True(seesklearn.set_config()). Please see 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.
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. Otherwise it has no effect.- Parameters:
return_std (str, True, False, or None, default=sklearn.utils.metadata_routing.UNCHANGED) – Metadata routing for
return_stdparameter inpredict.- Returns:
self – The updated object.
- Return type:
object
- set_score_request(*, sample_weight: bool | None | str = '$UNCHANGED$') EmukitEstimator
Request metadata passed to the
scoremethod.Note that this method is only relevant if
enable_metadata_routing=True(seesklearn.set_config()). Please see User Guide on how the routing mechanism works.The options for each parameter are:
True: metadata is requested, and passed toscoreif provided. The request is ignored if metadata is not provided.False: metadata is not requested and the meta-estimator will not pass it toscore.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. Otherwise it has no effect.- Parameters:
sample_weight (str, True, False, or None, default=sklearn.utils.metadata_routing.UNCHANGED) – Metadata routing for
sample_weightparameter inscore.- Returns:
self – The updated object.
- Return type:
object
GPyTorch
Contains the Scikit-Learn wrapper for GPyTorch
The defined Scikit-Learn wrapper for the GPyTorch library.
- class calisim.estimators.gpytorch_estimator.SingleTaskGPRegressionModel(likelihood: Likelihood, noise_init: float | None = None)[source]
The single task exact Gaussian process.
- Parameters:
gpytorch (ExactGP) – The GPyTorch module.
- calisim.estimators.gpytorch_estimator.get_single_task_exact_gp(lr: float, max_epochs: int, device: str = 'cpu') ExactGPRegressor[source]
Get an instance of a single task Gaussian process.
- Parameters:
lr (float) – The learning rate.
max_epochs (int) – The maximum number of epochs.
device (str, optional) – The device to train the model. Defaults to “cpu”.
- Returns:
The Gaussian process.
- Return type:
ExactGPRegressor
OpenTurns
Contains the Scikit-Learn wrappers for OpenTurns
The defined Scikit-Learn wrappers for the OpenTurns library.
- class calisim.estimators.openturns_estimator.FunctionalChaosEstimator(parameters: JointDistribution, total_degree: int = 2)[source]
- fit(X: ndarray, y: ndarray | None = None) FunctionalChaosEstimator[source]
Fit the estimator.
- Parameters:
X (np.ndarray) – The simulation inputs.
y (np.ndarray | None, optional) – The simulation outputs. Defaults to None.
- Returns:
The estimator.
- Return type:
- predict(X: ndarray) ndarray[source]
Make a prediction.
- Parameters:
X (np.ndarray) – The simulation inputs.
- Returns:
The model predictions.
- Return type:
np.ndarray
- score(X: ndarray, y: ndarray, sample_weight: ndarray | None = None) float[source]
Assess the estimator.
- Parameters:
X (np.ndarray) – The simulation inputs.
y (np.ndarray) – The simulation outputs.
sample_weight (np.ndarray | None, optional) – Weighting factor for the samples. Defaults to None.
- Returns:
The assessment score.
- Return type:
float
- set_score_request(*, sample_weight: bool | None | str = '$UNCHANGED$') FunctionalChaosEstimator
Request metadata passed to the
scoremethod.Note that this method is only relevant if
enable_metadata_routing=True(seesklearn.set_config()). Please see User Guide on how the routing mechanism works.The options for each parameter are:
True: metadata is requested, and passed toscoreif provided. The request is ignored if metadata is not provided.False: metadata is not requested and the meta-estimator will not pass it toscore.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. Otherwise it has no effect.- Parameters:
sample_weight (str, True, False, or None, default=sklearn.utils.metadata_routing.UNCHANGED) – Metadata routing for
sample_weightparameter inscore.- Returns:
self – The updated object.
- Return type:
object
- class calisim.estimators.openturns_estimator.KrigingEstimator(parameters: JointDistribution, basis: str = 'constant', covariance: str = 'SquaredExponential', covariance_scale: float = 1.0, covariance_amplitude: float = 1.0, n_out: int = 1)[source]
- fit(X: ndarray, y: ndarray | None = None) KrigingEstimator[source]
Fit the estimator.
- Parameters:
X (np.ndarray) – The simulation inputs.
y (np.ndarray | None, optional) – The simulation outputs. Defaults to None.
- Returns:
The estimator.
- Return type:
- predict(X: ndarray) ndarray | tuple[source]
Make a prediction.
- Parameters:
X (np.ndarray) – The simulation inputs.
- Returns:
The model predictions.
- Return type:
np.ndarray | tuple
- score(X: ndarray, y: ndarray, sample_weight: ndarray | None = None) float[source]
Assess the estimator.
- Parameters:
X (np.ndarray) – The simulation inputs.
y (np.ndarray) – The simulation outputs.
sample_weight (np.ndarray | None, optional) – Weighting factor for the samples. Defaults to None.
- Returns:
The assessment score.
- Return type:
float
- set_score_request(*, sample_weight: bool | None | str = '$UNCHANGED$') KrigingEstimator
Request metadata passed to the
scoremethod.Note that this method is only relevant if
enable_metadata_routing=True(seesklearn.set_config()). Please see User Guide on how the routing mechanism works.The options for each parameter are:
True: metadata is requested, and passed toscoreif provided. The request is ignored if metadata is not provided.False: metadata is not requested and the meta-estimator will not pass it toscore.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. Otherwise it has no effect.- Parameters:
sample_weight (str, True, False, or None, default=sklearn.utils.metadata_routing.UNCHANGED) – Metadata routing for
sample_weightparameter inscore.- Returns:
self – The updated object.
- Return type:
object