When training an agent that discovers latent actions in an unsupervised way, we often need to translate those learned latent actions back into real-world control commands (for example, continuous robot commands or game-pad inputs). Collecting labeled pairs of (latent action, real action) is expensive, so the translation must be learned from only a handful of labeled samples.
Your task is to implement a function that, given a small labeled set of latent/real action pairs, learns an affine map (linear transform plus bias) from the latent space to the real-action space, and then uses that map to predict real actions for a batch of unlabeled latent queries.
Inputs:
latent_labeled: shape (N, d_latent) -- the small labeled set of latent actions.real_labeled: shape (N, d_real) -- the corresponding real actions.latent_query: shape (M, d_latent) -- latent actions we want to translate.Return:
You should fit the affine map in a least-squares sense (minimum-norm fit when the system is underdetermined is fine). Do not round inside your solution -- the test harness handles rounding.