Riemannian Optimization on Tree Tensor Networks with Application in Machine Learning