Generalized Principal Component Analysis