reorganize learn.py nested dicts, output files