Modified preduct function to handle single array and muli-dimensional array. Reset dataset object when training with new datasets