Joint optimization of an autoencoder for clustering and embedding