refine the code

good practice for itertools.
Group by chi_learn