I want to train a simple neural network with PyTorch on a pandas dataframe df.
One of the columns is named "Target", and it is the target variable of the network. How can I use this dataframe as input to the PyTorch network?
I tried this, but it doesn't work:
import pandas as pd
import torch.utils.data as data_utils
target = pd.DataFrame(df['Target'])
train = data_utils.TensorDataset(df, target)
train_loader = data_utils.DataLoader(train, batch_size=10, shuffle=True)
df) also contains the target variable (df['Target']) (i.e. your network is 'cheating', since it can see the results as input) - iacob