piglot.optimisers.botorch.dataset.PCA

class PCA(variance: float)[source]

Bases: object

Principal Component Analysis transformation.

Methods

fit

Fit the PCA transformation to the given data.

to

Move the PCA to a given device.

transform

Transform data to the latent space.

untransform

Transform data back to the original space.

fit(data: Tensor, covariances: Tensor) None[source]

Fit the PCA transformation to the given data.

Parameters

datatorch.Tensor

Data to fit the PCA transformation to.

covariancestorch.Tensor

Covariances of the data to fit the PCA transformation to.

to(device: str) PCA[source]

Move the PCA to a given device.

Parameters

devicestr

Device to move the PCA to.

Returns

PCA

The PCA in the new device.

transform(values: torch.Tensor, covariances: torch.Tensor | None = None) torch.Tensor | Tuple[torch.Tensor, torch.Tensor][source]

Transform data to the latent space.

Parameters

valuestorch.Tensor

Values to transform.

covariancestorch.Tensor | None

Variances to transform, if any.

Returns

torch.Tensor | Tuple[torch.Tensor, torch.Tensor]

Transformed values and covariances (if any).

untransform(data: Tensor) Tensor[source]

Transform data back to the original space.

Parameters

datatorch.Tensor

Data to untransform.

Returns

torch.Tensor

Untransformed data.