refactor train and predict inputs injection into a helper