added train and test function for cupboard
enable to set error value for generating model
brael from loop when no-save and update-flag is all nil