Train function + Validation introduced

Logistic train is a function now. Validation being used for choosing
hyperparameters instead of test.