use value with error for generating cart
added train and test function for cart
fixed typo