learn codebook