A relevance vector machine is Bayesian linear regression on kernelised features with an ARD prior , one precision per weight, and noise precision . Maximising the marginal likelihood over the drives most of them to infinity, pruning their columns and leaving a sparse set of relevance vectors.
Implement rvm_fit(Phi, y, n_iter, alpha_init, beta_init, prune=1e6). Keep a list of active column indices (initially all). In each of the n_iter iterations, on the active columns :
prune.After the loop recompute and for the final active set and . Return a dict with "active" (sorted list of original column indices), "mu", "alpha" (for the active columns), "beta" and "Sigma".
Also implement rvm_predict(Phi_star, model): using only the active columns of Phi_star, return (mean, var) with mean and predictive variance .