A group-theoretic framework for machine learning in hyperbolic spaces