def check_data(self, _, y): if y is None and self.iterator_train is DataLoader: raise ValueError("No y-values are given (y=None). You must " "implement your own DataLoader for training " "(and your validation) and supply it using the " "``iterator_train`` and ``iterator_valid`` " "parameters respectively.") elif y is None: # The user implements its own mechanism for generating y. return # The problem with 1-dim float y is that the pytorch DataLoader will # somehow upcast it to DoubleTensor if get_dim(y) == 1: raise ValueError("The target data shouldn't be 1-dimensional; " "please reshape (e.g. y.reshape(-1, 1).")
def check_data(self, X, y): if ((y is None) and (not is_dataset(X)) and (self.iterator_train is DataLoader)): raise ValueError("No y-values are given (y=None). You must " "implement your own DataLoader for training " "(and your validation) and supply it using the " "``iterator_train`` and ``iterator_valid`` " "parameters respectively.") elif y is None: # The user implements its own mechanism for generating y. return if get_dim(y) == 1: msg = ( "The target data shouldn't be 1-dimensional but instead have " "2 dimensions, with the second dimension having the same size " "as the number of regression targets (usually 1). Please " "reshape your target data to be 2-dimensional " "(e.g. y = y.reshape(-1, 1).") raise ValueError(msg)
def check_data(self, X, y): super().check_data(X, y) if get_dim(y) != 1: raise ValueError("The target data should be 1-dimensional.")
def check_data(self, X, y): super().check_data(X, y) if (not is_dataset(X)) and (get_dim(y) != 1): raise ValueError("The target data should be 1-dimensional.")