finish 3 functions: train, analysis, measure