tweaked pca function to be more flexible and finished building autoencoder