Sample code for learning algorithms