separate train

create a function for learning, not with init anymore