temari
import numpy as np
import sklearn.decomposition
A = np.array([[1, 1], [1.5, 2], [2, 2], [3, 3], [3.5, 3], [4, 4], [5, 5]])
V = np.array([[np.sqrt(2) / 2, np.sqrt(2) / 2],
[np.sqrt(2) / 2, -np.sqrt(2) / 2]])
a_mean = np.mean(A, axis=0)
A_new = A - a_mean
transformed = A_new @ V.T
reconstructed = transformed @ V.T + a_mean
print(reconstructed)
pca = sklearn.decomposition.PCA()
pca.fit(A)
transformed = pca.transform(A)
reconstructed = np.dot(pca.transform(A), pca.components_) + a_mean
print(reconstructed)
Ručno, ali i preko libraryja se dobije jednak odgovor tako da je ovaj odgovor, koji je navodno točan, u pdfu na materijalima kriv.