model train function returns scalar cost