add train_model function

cross validation can be trigged by the type of nl and ls input