Algorithm implementations for learning.