Search code examples
machine-learningdata-sciencedimensionality-reduction

How to reverse GP-LVM Gaussian process latent variable and reconstruct original variables using python?


GP-LVM an be used for dimensionality reduction. After such dimensionality reduction is performed, how can one approximately reconstruct the original variables/features?


Solution

  • Using GPy, you can use the predict function, which returns the predictive mean and variance:

    import numpy as np
    from   GPy.models import GPLVM
    
    m = GPLVM(Y, input_dim=2)
    m.optimize()
    mean, var = m.predict(m.X)
    print(np.linalg.norm(Y - mean, 2))