Context Estimation and Learning Control through Latent Variable Extraction: From discrete to continuous contexts