ise.models._experimental

Experimental and legacy model components that are not part of the primary ISEFlow API. These modules are kept for reproducibility of earlier work but may be removed or changed without notice.

Submodules

ise.models._experimental.gp

Gaussian process emulators for ice sheet projections.

This module provides PowerExponentialKernel, NuggetKernel, GP, and EmulandiceGP for GP-based regression and uncertainty quantification.

class ise.models._experimental.gp.EmulandiceGP(verbose=True)[source]

Bases: GaussianProcessRegressor

Gaussian Process (GP) regression model that first fits a linear trend and then models the residuals, similar to the emulandice methodology.

load(path)[source]

Loads a Gaussian Process model from a saved file.

Parameters:

path (str) – Path to the saved model file. Must end with .joblib.

Returns:

The loaded Gaussian Process model.

Return type:

GP

Raises:

ValueError – If the file path does not end with .joblib.

predict(X, return_std=False)[source]

Makes predictions by combining the linear model and the GP.

Parameters:
  • X (np.ndarray) – Features to predict on.

  • return_std (bool) – Whether to return the standard deviation.

Returns:

Predictions, and optionally standard deviation.

Return type:

np.ndarray or tuple

save(path)[source]

Saves the trained Gaussian Process model to a file.

Parameters:

path (str) – Path where the model should be saved. Must end with .joblib.

Raises:

ValueError – If the file path does not end with .joblib.

set_predict_request(*, return_std: bool | None | str = '$UNCHANGED$') EmulandiceGP

Configure whether metadata should be requested to be passed to the predict method.

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 (see sklearn.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 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.

Parameters:

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

Returns:

self – The updated object.

Return type:

object

set_score_request(*, sample_weight: bool | None | str = '$UNCHANGED$') EmulandiceGP

Configure whether metadata should be requested to be passed to the score method.

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 (see sklearn.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 to score 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 score.

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

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

Returns:

self – The updated object.

Return type:

object

test(test_features, test_labels)[source]
train(train_features, train_labels)[source]

Trains the combined Linear Regression and Gaussian Process model.

Parameters:
  • train_features (np.ndarray) – Feature matrix.

  • train_labels (np.ndarray) – Target values.

Returns:

The trained model.

Return type:

GP

class ise.models._experimental.gp.GP(kernel, verbose=True)[source]

Bases: GaussianProcessRegressor

Gaussian Process (GP) regression model with a specified kernel.

This class extends GaussianProcessRegressor from sklearn and allows training and testing with additional functionality.

kernel

The kernel function used for regression.

Type:

sklearn.gaussian_process.kernels.Kernel

verbose

If True, prints progress and evaluation metrics.

Type:

bool

load(path)[source]

Loads a Gaussian Process model from a saved file.

Parameters:

path (str) – Path to the saved model file. Must end with .joblib.

Returns:

The loaded Gaussian Process model.

Return type:

GP

Raises:

ValueError – If the file path does not end with .joblib.

save(path)[source]

Saves the trained Gaussian Process model to a file.

Parameters:

path (str) – Path where the model should be saved. Must end with .joblib.

Raises:

ValueError – If the file path does not end with .joblib.

set_predict_request(*, return_cov: bool | None | str = '$UNCHANGED$', return_std: bool | None | str = '$UNCHANGED$') GP

Configure whether metadata should be requested to be passed to the predict method.

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 (see sklearn.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 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.

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

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

Returns:

self – The updated object.

Return type:

object

set_score_request(*, sample_weight: bool | None | str = '$UNCHANGED$') GP

Configure whether metadata should be requested to be passed to the score method.

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 (see sklearn.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 to score 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 score.

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

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

Returns:

self – The updated object.

Return type:

object

test(test_features, test_labels)[source]

Evaluates the Gaussian Process regression model on test data.

Parameters:
  • test_features (np.ndarray) – Feature matrix of shape (n_samples, n_features).

  • test_labels (np.ndarray) – Ground truth target values of shape (n_samples,).

Returns:

  • np.ndarray: Predicted values.

  • np.ndarray: Standard deviation of predictions.

  • dict: Evaluation metrics including MSE, MAE, RMSE, and R².

Return type:

tuple

Raises:

ValueError – If test_features or test_labels have incorrect dimensions.

train(train_features, train_labels)[source]

Trains the Gaussian Process regression model.

Parameters:
  • train_features (np.ndarray) – Feature matrix of shape (n_samples, n_features).

  • train_labels (np.ndarray) – Target values of shape (n_samples,).

Returns:

The trained Gaussian Process model.

Return type:

GP

class ise.models._experimental.gp.NuggetKernel(noise_level=1.0, noise_level_bounds=(1e-05, 100000.0))[source]

Bases: WhiteKernel

A noise kernel (White Kernel) that models independent noise in Gaussian Processes.

This kernel adds noise to the diagonal of the covariance matrix to account for observation noise.

noise_level

The variance of the noise.

Type:

float

noise_level_bounds

The bounds for the noise variance.

Type:

tuple

class ise.models._experimental.gp.PowerExponentialKernel(exponential=0.1, length_scale=1.0, length_scale_bounds=(1e-05, 100000.0))[source]

Bases: RBF

A modified Radial Basis Function (RBF) kernel with a power exponential component.

This kernel generalizes the standard RBF kernel by allowing a custom exponential factor in the distance computation.

exponential

The power to which distances are raised in the kernel function.

Type:

float

length_scale

Characteristic length scale for the kernel.

Type:

float

length_scale_bounds

Lower and upper bounds for the length scale.

Type:

tuple

ise.models._experimental.pca

Dimensionality reduction for ice sheet emulator inputs.

This module provides PCA and DimensionProcessor for reducing input feature dimensions and aligning data with fitted transforms (e.g. after scaling).

class ise.models._experimental.pca.DimensionProcessor(pca_model, scaler_model, scaler_method='standard')[source]

Bases: Module

A pipeline for dimensionality reduction using PCA and data scaling.

This class integrates a PCA model for dimensionality reduction and a scaling method for normalization. It facilitates transformation between the original data space and the reduced PCA space.

Parameters:
  • pca_model (str or PCA) – A pre-trained PCA model or a file path to a saved PCA model.

  • scaler_model (str or StandardScaler, RobustScaler, LogScaler) – A scaler model instance or a file path to a saved scaler model.

  • scaler_method (str, optional) – Scaling method to use. Must be one of ‘standard’, ‘robust’, or ‘log’. Defaults to ‘standard’.

device

Computation device (‘cuda’ if available, otherwise ‘cpu’).

Type:

str

pca

PCA model used for dimensionality reduction.

Type:

PCA

scaler

Scaling model for data normalization.

Type:

StandardScaler, RobustScaler, or LogScaler

Raises:
  • ValueError – If the pca_model or scaler_model are invalid.

  • RuntimeError – If the PCA model has not been fitted.

to_grid(pcs, unscale=True)[source]

Converts PCA-transformed data back to the original feature space.

Parameters:
  • pcs (torch.Tensor or pd.DataFrame) – Principal components to transform.

  • unscale (bool, optional) – Whether to apply inverse scaling. Defaults to True.

Returns:

Reconstructed data in the original feature space.

Return type:

torch.Tensor or pd.DataFrame

to_pca(data)[source]

Applies PCA transformation to the input data.

Parameters:

data (torch.Tensor or pd.DataFrame) – Input data for transformation.

Returns:

Data transformed into the PCA space.

Return type:

torch.Tensor

class ise.models._experimental.pca.PCA(n_components)[source]

Bases: Module

Principal Component Analysis (PCA) using PyTorch.

This class performs Principal Component Analysis (PCA) for dimensionality reduction, leveraging PyTorch’s built-in operations. The model can be trained on input data to extract principal components and later transform new data into the reduced-dimensional space.

n_components

Number of principal components to keep. If an integer, it represents the exact number of components. If a float between 0 and 1, it represents the proportion of variance to retain.

Type:

int or float

mean

Mean of the input data, computed during fitting.

Type:

torch.Tensor

components

Principal components (eigenvectors) of the fitted data.

Type:

torch.Tensor

singular_values

Singular values from singular value decomposition.

Type:

torch.Tensor

explained_variance

Variance explained by each principal component.

Type:

torch.Tensor

explained_variance_ratio

Proportion of total variance explained by each component.

Type:

torch.Tensor

device

The computation device (‘cuda’ if available, otherwise ‘cpu’).

Type:

str

fit(X)[source]

Fits the PCA model to the input data.

Computes the principal components, singular values, explained variance, and variance ratios using singular value decomposition.

Parameters:

X (np.ndarray or pd.DataFrame) – Input data of shape (n_samples, n_features).

Returns:

The fitted PCA model instance.

Return type:

PCA

Raises:

ValueError – If n_components is neither a valid float (0,1) nor an integer.

inverse_transform(X)[source]

Reconstructs the original data from the principal component space.

Parameters:

X (np.ndarray or pd.DataFrame) – Transformed data in the reduced space, with shape (n_samples, n_components).

Returns:

Reconstructed data in the original feature space.

Return type:

torch.Tensor

Raises:

RuntimeError – If the PCA model has not been fitted.

static load(path)[source]

Loads a previously saved PCA model.

Parameters:

path (str) – Path to the saved PCA model.

Returns:

Loaded PCA model instance.

Return type:

PCA

Raises:
  • FileNotFoundError – If the specified file does not exist.

  • RuntimeError – If the loaded model is not a valid PCA instance.

save(path)[source]

Saves the fitted PCA model to a specified file.

Parameters:

path (str) – File path where the model should be saved.

Raises:

RuntimeError – If the PCA model has not been fitted before saving.

transform(X)[source]

Transforms input data into the principal component space.

Parameters:

X (np.ndarray or pd.DataFrame) – Input data of shape (n_samples, n_features).

Returns:

Transformed data in the principal component space, with shape (n_samples, n_components).

Return type:

torch.Tensor

Raises:

RuntimeError – If the PCA model has not been fitted.

ise.models._experimental.scenario

Scenario-level predictor for ice sheet emulation.

This module provides ScenarioPredictor, a feedforward network for predicting scenario-level outcomes (e.g. binary or regression targets) from input features.

class ise.models._experimental.scenario.ScenarioPredictor(input_size, hidden_layers=[128, 64], output_size=1, dropout_rate=0.1)[source]

Bases: Module

evaluate(data_loader)[source]

Evaluates the model on a dataset.

Parameters:

data_loader (torch.utils.data.DataLoader) – DataLoader for the dataset to evaluate.

Returns:

A tuple containing:
  • avg_loss (float): Average loss over the dataset.

  • accuracy (float): Accuracy of predictions (0 to 1).

Return type:

tuple

fit(train_loader, val_loader=None, epochs=10, lr=0.001, print_every=1, save_checkpoint=True)[source]

Trains the model on the given dataset.

Parameters:
  • train_loader (torch.utils.data.DataLoader) – DataLoader for the training dataset.

  • val_loader (torch.utils.data.DataLoader, optional) – DataLoader for the validation dataset. Defaults to None.

  • epochs (int, optional) – Number of epochs for training. Defaults to 10.

  • lr (float, optional) – Learning rate for the optimizer. Defaults to 1e-3.

  • print_every (int, optional) – Interval for printing training progress. Defaults to 1.

  • save_checkpoint (bool, optional) – Whether to save model checkpoints based on validation loss. Defaults to True.

Returns:

None

forward(x)[source]

Forward pass through the model.

Parameters:

x (torch.Tensor) – Input tensor with shape (batch_size, input_size).

Returns:

Output tensor with probabilities in the range [0,1].

Return type:

torch.Tensor

load(path)[source]

Loads the model state from a file.

Parameters:

path (str) – Path to the file containing the model state.

Returns:

None

predict(x)[source]

Predicts the output for a given input.

Parameters:

x (torch.Tensor) – Input tensor.

Returns:

Predicted output tensor with probabilities in the range [0,1].

Return type:

torch.Tensor

ise.models._experimental.variational_lstm_emulator

This module contains the VariationalLSTMEmulator, which is a class that contains the model architecture for the variational LSTM emulator presented in https://doi.org/10.1029/2023MS003899.

class ise.models._experimental.variational_lstm_emulator.VariationalLSTMEmulator(architecture, mc_dropout=False, dropout_prob=None)[source]

Bases: Module

Variational LSTM Emulator model for time series data.

enable_dropout()[source]

Enable dropout during model evaluation.

This method turns on dropout for each layer that starts with “Dropout”.

forward(x)[source]

Forward pass of the VariationalLSTMEmulator model.

Parameters:

x (torch.Tensor) – Input tensor.

Returns:

Output tensor.

Return type:

torch.Tensor

predict(x, approx_dist=None, mc_iterations=None, quantile_range=[0.025, 0.975], confidence='95')[source]

Make predictions using the VariationalLSTMEmulator model.

Parameters:
  • x (np.ndarray or torch.Tensor or pd.DataFrame) – Input data.

  • approx_dist (bool, optional) – Flag indicating whether to approximate the distribution using MC Dropout. Defaults to None.

  • mc_iterations (int, optional) – Number of MC iterations. Required if approx_dist is True.

  • quantile_range (list, optional) – Quantile range for prediction intervals. Defaults to [0.025, 0.975].

  • confidence (str, optional) – Confidence level for prediction intervals. Defaults to “95”.

Returns:

Tuple containing the predictions, mean predictions, and standard deviations.

Return type:

tuple

Module contents

Experimental and legacy models from prior ISE manuscripts.

These models (GP, PCA, ScenarioPredictor, VariationalLSTMEmulator) were used in earlier versions of the package and prior publications. They are no longer actively maintained. Use ise.models.iseflow.ISEFlow (or the pretrained convenience classes ISEFlow_AIS / ISEFlow_GrIS) for current ice sheet emulation.

All classes in this subpackage emit a DeprecationWarning on import.

class ise.models._experimental.DimensionProcessor(pca_model, scaler_model, scaler_method='standard')[source]

Bases: Module

A pipeline for dimensionality reduction using PCA and data scaling.

This class integrates a PCA model for dimensionality reduction and a scaling method for normalization. It facilitates transformation between the original data space and the reduced PCA space.

Parameters:
  • pca_model (str or PCA) – A pre-trained PCA model or a file path to a saved PCA model.

  • scaler_model (str or StandardScaler, RobustScaler, LogScaler) – A scaler model instance or a file path to a saved scaler model.

  • scaler_method (str, optional) – Scaling method to use. Must be one of ‘standard’, ‘robust’, or ‘log’. Defaults to ‘standard’.

device

Computation device (‘cuda’ if available, otherwise ‘cpu’).

Type:

str

pca

PCA model used for dimensionality reduction.

Type:

PCA

scaler

Scaling model for data normalization.

Type:

StandardScaler, RobustScaler, or LogScaler

Raises:
  • ValueError – If the pca_model or scaler_model are invalid.

  • RuntimeError – If the PCA model has not been fitted.

to_grid(pcs, unscale=True)[source]

Converts PCA-transformed data back to the original feature space.

Parameters:
  • pcs (torch.Tensor or pd.DataFrame) – Principal components to transform.

  • unscale (bool, optional) – Whether to apply inverse scaling. Defaults to True.

Returns:

Reconstructed data in the original feature space.

Return type:

torch.Tensor or pd.DataFrame

to_pca(data)[source]

Applies PCA transformation to the input data.

Parameters:

data (torch.Tensor or pd.DataFrame) – Input data for transformation.

Returns:

Data transformed into the PCA space.

Return type:

torch.Tensor

class ise.models._experimental.EmulandiceGP(verbose=True)[source]

Bases: GaussianProcessRegressor

Gaussian Process (GP) regression model that first fits a linear trend and then models the residuals, similar to the emulandice methodology.

load(path)[source]

Loads a Gaussian Process model from a saved file.

Parameters:

path (str) – Path to the saved model file. Must end with .joblib.

Returns:

The loaded Gaussian Process model.

Return type:

GP

Raises:

ValueError – If the file path does not end with .joblib.

predict(X, return_std=False)[source]

Makes predictions by combining the linear model and the GP.

Parameters:
  • X (np.ndarray) – Features to predict on.

  • return_std (bool) – Whether to return the standard deviation.

Returns:

Predictions, and optionally standard deviation.

Return type:

np.ndarray or tuple

save(path)[source]

Saves the trained Gaussian Process model to a file.

Parameters:

path (str) – Path where the model should be saved. Must end with .joblib.

Raises:

ValueError – If the file path does not end with .joblib.

set_predict_request(*, return_std: bool | None | str = '$UNCHANGED$') EmulandiceGP

Configure whether metadata should be requested to be passed to the predict method.

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 (see sklearn.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 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.

Parameters:

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

Returns:

self – The updated object.

Return type:

object

set_score_request(*, sample_weight: bool | None | str = '$UNCHANGED$') EmulandiceGP

Configure whether metadata should be requested to be passed to the score method.

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 (see sklearn.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 to score 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 score.

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

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

Returns:

self – The updated object.

Return type:

object

test(test_features, test_labels)[source]
train(train_features, train_labels)[source]

Trains the combined Linear Regression and Gaussian Process model.

Parameters:
  • train_features (np.ndarray) – Feature matrix.

  • train_labels (np.ndarray) – Target values.

Returns:

The trained model.

Return type:

GP

class ise.models._experimental.GP(kernel, verbose=True)[source]

Bases: GaussianProcessRegressor

Gaussian Process (GP) regression model with a specified kernel.

This class extends GaussianProcessRegressor from sklearn and allows training and testing with additional functionality.

kernel

The kernel function used for regression.

Type:

sklearn.gaussian_process.kernels.Kernel

verbose

If True, prints progress and evaluation metrics.

Type:

bool

load(path)[source]

Loads a Gaussian Process model from a saved file.

Parameters:

path (str) – Path to the saved model file. Must end with .joblib.

Returns:

The loaded Gaussian Process model.

Return type:

GP

Raises:

ValueError – If the file path does not end with .joblib.

save(path)[source]

Saves the trained Gaussian Process model to a file.

Parameters:

path (str) – Path where the model should be saved. Must end with .joblib.

Raises:

ValueError – If the file path does not end with .joblib.

set_predict_request(*, return_cov: bool | None | str = '$UNCHANGED$', return_std: bool | None | str = '$UNCHANGED$') GP

Configure whether metadata should be requested to be passed to the predict method.

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 (see sklearn.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 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.

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

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

Returns:

self – The updated object.

Return type:

object

set_score_request(*, sample_weight: bool | None | str = '$UNCHANGED$') GP

Configure whether metadata should be requested to be passed to the score method.

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 (see sklearn.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 to score 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 score.

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

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

Returns:

self – The updated object.

Return type:

object

test(test_features, test_labels)[source]

Evaluates the Gaussian Process regression model on test data.

Parameters:
  • test_features (np.ndarray) – Feature matrix of shape (n_samples, n_features).

  • test_labels (np.ndarray) – Ground truth target values of shape (n_samples,).

Returns:

  • np.ndarray: Predicted values.

  • np.ndarray: Standard deviation of predictions.

  • dict: Evaluation metrics including MSE, MAE, RMSE, and R².

Return type:

tuple

Raises:

ValueError – If test_features or test_labels have incorrect dimensions.

train(train_features, train_labels)[source]

Trains the Gaussian Process regression model.

Parameters:
  • train_features (np.ndarray) – Feature matrix of shape (n_samples, n_features).

  • train_labels (np.ndarray) – Target values of shape (n_samples,).

Returns:

The trained Gaussian Process model.

Return type:

GP

class ise.models._experimental.NuggetKernel(noise_level=1.0, noise_level_bounds=(1e-05, 100000.0))[source]

Bases: WhiteKernel

A noise kernel (White Kernel) that models independent noise in Gaussian Processes.

This kernel adds noise to the diagonal of the covariance matrix to account for observation noise.

noise_level

The variance of the noise.

Type:

float

noise_level_bounds

The bounds for the noise variance.

Type:

tuple

class ise.models._experimental.PCA(n_components)[source]

Bases: Module

Principal Component Analysis (PCA) using PyTorch.

This class performs Principal Component Analysis (PCA) for dimensionality reduction, leveraging PyTorch’s built-in operations. The model can be trained on input data to extract principal components and later transform new data into the reduced-dimensional space.

n_components

Number of principal components to keep. If an integer, it represents the exact number of components. If a float between 0 and 1, it represents the proportion of variance to retain.

Type:

int or float

mean

Mean of the input data, computed during fitting.

Type:

torch.Tensor

components

Principal components (eigenvectors) of the fitted data.

Type:

torch.Tensor

singular_values

Singular values from singular value decomposition.

Type:

torch.Tensor

explained_variance

Variance explained by each principal component.

Type:

torch.Tensor

explained_variance_ratio

Proportion of total variance explained by each component.

Type:

torch.Tensor

device

The computation device (‘cuda’ if available, otherwise ‘cpu’).

Type:

str

fit(X)[source]

Fits the PCA model to the input data.

Computes the principal components, singular values, explained variance, and variance ratios using singular value decomposition.

Parameters:

X (np.ndarray or pd.DataFrame) – Input data of shape (n_samples, n_features).

Returns:

The fitted PCA model instance.

Return type:

PCA

Raises:

ValueError – If n_components is neither a valid float (0,1) nor an integer.

inverse_transform(X)[source]

Reconstructs the original data from the principal component space.

Parameters:

X (np.ndarray or pd.DataFrame) – Transformed data in the reduced space, with shape (n_samples, n_components).

Returns:

Reconstructed data in the original feature space.

Return type:

torch.Tensor

Raises:

RuntimeError – If the PCA model has not been fitted.

static load(path)[source]

Loads a previously saved PCA model.

Parameters:

path (str) – Path to the saved PCA model.

Returns:

Loaded PCA model instance.

Return type:

PCA

Raises:
  • FileNotFoundError – If the specified file does not exist.

  • RuntimeError – If the loaded model is not a valid PCA instance.

save(path)[source]

Saves the fitted PCA model to a specified file.

Parameters:

path (str) – File path where the model should be saved.

Raises:

RuntimeError – If the PCA model has not been fitted before saving.

transform(X)[source]

Transforms input data into the principal component space.

Parameters:

X (np.ndarray or pd.DataFrame) – Input data of shape (n_samples, n_features).

Returns:

Transformed data in the principal component space, with shape (n_samples, n_components).

Return type:

torch.Tensor

Raises:

RuntimeError – If the PCA model has not been fitted.

class ise.models._experimental.PowerExponentialKernel(exponential=0.1, length_scale=1.0, length_scale_bounds=(1e-05, 100000.0))[source]

Bases: RBF

A modified Radial Basis Function (RBF) kernel with a power exponential component.

This kernel generalizes the standard RBF kernel by allowing a custom exponential factor in the distance computation.

exponential

The power to which distances are raised in the kernel function.

Type:

float

length_scale

Characteristic length scale for the kernel.

Type:

float

length_scale_bounds

Lower and upper bounds for the length scale.

Type:

tuple

class ise.models._experimental.ScenarioPredictor(input_size, hidden_layers=[128, 64], output_size=1, dropout_rate=0.1)[source]

Bases: Module

evaluate(data_loader)[source]

Evaluates the model on a dataset.

Parameters:

data_loader (torch.utils.data.DataLoader) – DataLoader for the dataset to evaluate.

Returns:

A tuple containing:
  • avg_loss (float): Average loss over the dataset.

  • accuracy (float): Accuracy of predictions (0 to 1).

Return type:

tuple

fit(train_loader, val_loader=None, epochs=10, lr=0.001, print_every=1, save_checkpoint=True)[source]

Trains the model on the given dataset.

Parameters:
  • train_loader (torch.utils.data.DataLoader) – DataLoader for the training dataset.

  • val_loader (torch.utils.data.DataLoader, optional) – DataLoader for the validation dataset. Defaults to None.

  • epochs (int, optional) – Number of epochs for training. Defaults to 10.

  • lr (float, optional) – Learning rate for the optimizer. Defaults to 1e-3.

  • print_every (int, optional) – Interval for printing training progress. Defaults to 1.

  • save_checkpoint (bool, optional) – Whether to save model checkpoints based on validation loss. Defaults to True.

Returns:

None

forward(x)[source]

Forward pass through the model.

Parameters:

x (torch.Tensor) – Input tensor with shape (batch_size, input_size).

Returns:

Output tensor with probabilities in the range [0,1].

Return type:

torch.Tensor

load(path)[source]

Loads the model state from a file.

Parameters:

path (str) – Path to the file containing the model state.

Returns:

None

predict(x)[source]

Predicts the output for a given input.

Parameters:

x (torch.Tensor) – Input tensor.

Returns:

Predicted output tensor with probabilities in the range [0,1].

Return type:

torch.Tensor

class ise.models._experimental.VariationalLSTMEmulator(architecture, mc_dropout=False, dropout_prob=None)[source]

Bases: Module

Variational LSTM Emulator model for time series data.

enable_dropout()[source]

Enable dropout during model evaluation.

This method turns on dropout for each layer that starts with “Dropout”.

forward(x)[source]

Forward pass of the VariationalLSTMEmulator model.

Parameters:

x (torch.Tensor) – Input tensor.

Returns:

Output tensor.

Return type:

torch.Tensor

predict(x, approx_dist=None, mc_iterations=None, quantile_range=[0.025, 0.975], confidence='95')[source]

Make predictions using the VariationalLSTMEmulator model.

Parameters:
  • x (np.ndarray or torch.Tensor or pd.DataFrame) – Input data.

  • approx_dist (bool, optional) – Flag indicating whether to approximate the distribution using MC Dropout. Defaults to None.

  • mc_iterations (int, optional) – Number of MC iterations. Required if approx_dist is True.

  • quantile_range (list, optional) – Quantile range for prediction intervals. Defaults to [0.025, 0.975].

  • confidence (str, optional) – Confidence level for prediction intervals. Defaults to “95”.

Returns:

Tuple containing the predictions, mean predictions, and standard deviations.

Return type:

tuple