implemented supervised pca algorithm