I have movielens dataset which I want to apply dimensionality reduction using PCA algorithm, first I compute convenience matrix of dataset, then compute eigenvalue of my dataset but; here is the problem when I print the result I don't understand which eigenvalue belong to which movie I use numpy for computing eigenvalues.
Here is my code
#Load movie names and movie ratings
movies = pd.read_csv('movies.csv')
ratings = pd.read_csv('ratings.csv')
ratings.drop(['timestamp'], axis=1, inplace=True)
def replace_name(x):
return movies[movies['movieId']==x].title.values[0]
ratings.movieId = ratings.movieId.map(replace_name)
M = ratings.pivot_table(index=['userId'], columns=['movieId'], values='rating')
m = M.shape
df1 = M.replace(np.nan, 0, regex=True)
#Perform eigendecomposition on covariance matrix
cov_mat = np.cov(X_std.T)
eig_vals, eig_vecs = np.linalg.eig(cov_mat)
print('\nEigenvalues \n%s' %eig_vals)
Number of eigenvalue which my code produce is equal to number of movies but I don't which eigenvalue belong to which movie?