I calculated the eigenvectors and eigenvalues from a covariance matrix given a data matrix of 3 columns and 2 rows.
I am trying to interpret results but I can't understand on how to interpret them.
Create a 2x3 matrix:
# Create a 2x3 matrix
data = np.around(np.random.uniform(size=(2,3)) * 100)
The data looks as follows:
[
[ 4., 65., 77.],
[68., 12., 89.]
]
# Here each row represents one data point
# and columns represent the features in the data set
# So there are 3 features and 2 data points
Calculate the mean for each feature in the data set.
mean = np.mean(data, axis = 0)
Center the data around origin, by subtracting mean from the data set.
difference = np.subtract(data, mean)
Now, calculate the covariance matrix:
cov = np.dot(difference.T, difference)
The cov matrix looks as follows:
[
[ 2048. , -1696. , 384. ],
[-1696. , 1404.5, -318. ],
[ 384. , -318. , 72. ]
]
As I understand about the covariance matrix, it explains the variance between all feature-pairs. Since there are 3 features, it gives out a 3x3 matrix explaining the variance between all possible pairs.
Finally, calculate the eigenvectors and eigenvalues:
val, vec = np.linalg.eigh(cov)
The vec matrix looks as follows:
[
[ 0.60999981, 0.21639063, 0.76228297],
[ 0.77451164, 0.040441 , -0.63126559],
[ 0.16742745, -0.97546892, 0.14292806]
]
How do I interpret the the vector matrix? I understand what are eigenvectors physically. They do not change in position when an object undergoes a transformation but only a scalar change by their eigenvalues.
What are some possible ways, I could use this vec
matrix?