Learning codes