updated the cross validation error calculation