added function to train data with on two data sets