Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed a bug when removing excluded datasets #656

Closed
wants to merge 4 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 10 additions & 5 deletions moabb/benchmark.py
Original file line number Diff line number Diff line change
Expand Up @@ -323,16 +323,21 @@ def _inc_exc_datasets(datasets, include_datasets, exclude_datasets):
)

elif exclude_datasets is not None:
d = list(datasets)
d = []
# Assert if the inputs are not key_codes i.e. expected to be dataset class objects
if not isinstance(exclude_datasets[0], str):
# Convert the input to key_codes
exclude_datasets = [e.code for e in exclude_datasets]

# Map from key_codes to class instances
datasets_codes = [d.code for d in datasets]
for excdat in exclude_datasets:
del d[datasets_codes.index(excdat)]
for ds in datasets:
class_inst = type(ds).__name__
if class_inst not in exclude_datasets:
d.append(ds)

if len(d) != len(datasets) - len(exclude_datasets):
raise Exception(
"Could not exclude datasets correctly. Make sure you provide the correct class names."
)
else:
d = list(datasets)
return d
Loading