I need to classify some behavioral data that comes from a CSV file. I’m using pandas to clean the data and Conv1d for classifying. The pandas dataframe has shape of (14029, 123).
The issue appears when I’m trying to feed the data into the model. As far as I understand, I need the shape of the data to be (batch_size, 1, 123). However, when feeding the data to the model, I can see it actually is torch.Size([batch_size, 123]). How is it that I’m missing the 1?
My custom Dataset is written as follows:
class CSVDataset(Dataset):
def __init__(self, filepath):
self.df = pd.read_csv(filepath)
self.target = self.df['R']
self.x = self.df.drop('R', axis=1)
self.x = torch.from_numpy(self.x.to_numpy())
def __len__(self):
return len(self.x)
def __getitem__(self, idx):
return self.x[idx], self.target.loc[idx]
The dataset and dataloader are created as follows:
dataset = CSVDataset("../clean_data/clean_data.csv")
dataloader = DataLoader(dataset, batch_size=32, shuffle=True, drop_last=True)