hist.train, write_hist