RELEAF: An Algorithm for Learning and Exploiting Relevance