fix bug, add code generate training data frame