Machine Learning#

hsi.ml.pca_helper(model) Callable[[HSImage], HSImage]#

Wraps a PCA-like model in a function that can be applied to an HSImage.

The wrapper uses the SDK’s built-in matrix-multiplication routines for improved performance.

The model must be a projection of the spatial pixels onto a subspace, i.e., the model must contain a components_ attribute of size BxS, where B is the number of bands in the input image and S is the dimensionality of the latent space. The model must also contain a mean_ attribute of size B.

The wrapped function calculates O = (I - mu) * W^T, where I is the input image, mu is the mean of the model, and W is the transpose of the components_ of the model.

Parameters:

model – A PCA-like model.

Returns:

A function that lazily applies the model to an HSImage.

Return type:

Callable[[HSImage], HSImage]