added draw_example and compute_gradient