got the plots and put the logistic training code into a function