algorithm.train also uses extensively the dataset and do it differently than algorithm.setup. Some bugs might show up in train() only. Maybe not in this PR, but in future modifications.