pytspl.hogde_gp.hodge_gp_trainer
Module for training the Hodge Gaussian Process model.
Attributes
Classes
Module Contents
- pytspl.hogde_gp.hodge_gp_trainer.DATA_TYPE
- class pytspl.hogde_gp.hodge_gp_trainer.HodgeGPTrainer(sc: pytspl.simplicial_complex.SimplicialComplex, y: numpy.ndarray, output_device: str = 'cpu')[source]
- sc
- y
- output_device
- get_laplacians() list[source]
Return the Laplacian matrices as a list of tensors.
- Returns:
list(torch.tensor): The Laplacian matrices.
- get_incidence_matrices() list[source]
Return the incidence matrices as a list of tensors.
- Returns:
list(torch.tensor): The incidence matrices.
- get_eigenpairs(tolerance: float = 0.001) list[source]
Return the eigenpairs of the Laplacian matrices.
- Args:
tolerance (float, optional): The tolerance for eigenvalues to be considered zero. Defaults to 1e-3.
- Returns:
list(torch.tensor): The eigenpairs of the Laplacian matrices for the harmonic, gradient, and curl components.
- normalize_data(y_train: torch.tensor, y_test: torch.tensor, y: torch.tensor) tuple[source]
Normalize the target values.
- Args:
y_train (torch.tensor): The training target values. y_test (torch.tensor): The testing target values. y (torch.tensor): The target values.
- Returns:
torch.tensor: The normalized training target values. torch.tensor: The normalized testing target values. torch.tensor: The normalized target values.
- train_test_split(train_ratio: float = 0.8, data_normalization: bool = False, seed: int = 4) tuple[source]
Split the data into training and validation sets.
- Args:
train_ratio (float, optional): The ratio of the training data. Defaults to 0.8. data_normalization (bool, optional): Whether to normalize the target data. Defaults to False. seed (int, optional): The random seed. Defaults to 4.
- Returns:
torch.tensor: The training input data. torch.tensor: The training target data. torch.tensor: The testing input data. torch.tensor: The testing target data. torch.tensor: The input data. torch.tensor: The target data.
- train(model: gpytorch.models, likelihood: gpytorch.likelihoods, x_train: torch.tensor, y_train: torch.tensor, training_iters: int = 1000, learning_rate: float = 0.1, optimizer=torch.optim.Adam) None[source]
Train the model using the training data with the given parameters.
- Args:
model (gpytorch.models): The model to train. likelihood (gpytorch.likelihoods): The likelihood function. x_train (torch.tensor): The training data. y_train (torch.tensor): The training labels. training_iters (int, optional): The number of training iterations. Defaults to 1000. learning_rate (float, optional): The learning rate. Defaults to 0.1. optimizer (_type_, optional): The optimizer. Defaults to torch.optim.Adam.
- predict(model: gpytorch.models, likelihood: gpytorch.likelihoods, x_test: torch.tensor, y_test: torch.tensor) gpytorch.distributions[source]
Predict the target values using the model and likelihood functions. Also, calculate the metrics.
- Args:
model (gpytorch.models): The model to use for prediction. likelihood (gpytorch.likelihoods): The likelihood function. x_test (torch.tensor): The testing data. y_test (torch.tensor): The testing labels.
- Returns:
gpytorch.distributions (torch.tensor): The predictions.