braindecode icon indicating copy to clipboard operation
braindecode copied to clipboard

Problem with Input format

Open PortiefCreator opened this issue 2 years ago • 2 comments

Hello to the entire community, I am running some networks with this library on my EEG data. I hope you can help me:

With this configuration for my data I have an error:

File ~\AppData\Roaming\Python\Python310\site-packages\braindecode\experiments\experiment.py:303 in run_until_stop self.monitor_epoch(datasets)

File ~\AppData\Roaming\Python\Python310\site-packages\braindecode\experiments\experiment.py:518 in monitor_epoch self.epochs_df = self.epochs_df.append(row_dict, ignore_index=True)

File ~\anaconda3\lib\site-packages\pandas\core\generic.py:6204 in getattr return object.getattribute(self, name)

AttributeError: 'DataFrame' object has no attribute 'append' #############################################

this is my setup:

num_epochs = 300 net = Deep4Net(in_chans=8, n_classes=2, input_time_length=1000, final_conv_length='auto').cuda()

optimizer = AdamW(net.parameters(), lr=1*0.01, weight_decay=0.5*0.001)
net.compile(loss=F.nll_loss, optimizer=optimizer, iterator_seed=1, )

# Assuming train_data and labels_Train are PyTorch tensors
train_data_reshaped = train_data.reshape(-1,8, 1000).numpy()
labels_Train_np = labels_Train.numpy()


# Assuming train_data_reshaped is your reshaped EEG data
test_data_reshaped = test_data.reshape(-1, 8, 1000).numpy()
labels_Test_np=labels_Test.numpy()

# Now you can use the fit method
exp = net.fit(train_data_reshaped, labels_Train_np, epochs=100, batch_size=400, validation_data=(test_data_reshaped, labels_Test_np), remember_best_column='valid_loss')

What could be my mistake, the data format I think is correct, the panda library is update

PortiefCreator avatar Dec 08 '23 17:12 PortiefCreator

Hey @PortiefCreator,

You need to create an EEGClassifier object and an EEG dataset from X and y. If you go deep into the tutorials, you can find this information.

bruAristimunha avatar Feb 15 '24 00:02 bruAristimunha

I'm closing this. @PortiefCreator feel free to reopen if you need clarification on the tutorials

PierreGtch avatar Mar 10 '25 08:03 PierreGtch