Loading...

verticapy.machine_learning.memmodel.decomposition.PCA.transform#

PCA.transform(X: list | ndarray) ndarray#

Transforms and applies the PCA model to the input matrix.

Parameters#

X: ArrayLike

The data on which to make the transformation.

Returns#

numpy.array

Transformed values.

Examples#

Import the required module.

from verticapy.machine_learning.memmodel.decomposition import PCA

We will use the following attributes:

principal_components = [
    [0.4, 0.5],
    [0.3, 0.2],
]


mean = [0.1, 0.3]

Let’s create a model.

model_pca = PCA(principal_components, mean)

Create a dataset.

data = [[4, 5]]

Transform the data.

model_pca.transform(data)
Out[6]: array([[2.97, 2.89]])

Note

Refer to PCA for more information about the different methods and usages.