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

[Example] P300-VR dataset #393

Merged
merged 34 commits into from
Jun 7, 2023
Merged

Conversation

gcattan
Copy link
Contributor

@gcattan gcattan commented May 31, 2023

This PR is a follow-up for #358. It:

  • corrects a few mistakes on the P300 virtual reality dataset
  • adds an example using this dataset (the example is from Pedro's repository here). I used it to test the dataset in MOABB.

image

@plcrodrigues FYI

@sylvchev
Copy link
Member

Thanks @gcattan
We just finished a meeting where we had trouble to use this dataset, there was a problem with the session.

@gcattan
Copy link
Contributor Author

gcattan commented May 31, 2023

Yes, sorry, I forgot to replace all occurrences of the dataset code on the first PR.
There was also a problem with the download URL for "PC" data.

@sylvchev
Copy link
Member

When using this code:

   ...: from moabb.paradigms import P300
   ...:
   ...: d = VirtualReality()
   ...: p = P300()
   ...: X, label, meta = p.get_data(d, subjects=[1])

I have the following error:

----> 6 X, label, meta = p.get_data(d, subjects=[1])

File ~/src/github/moabb-sylvchev/moabb/paradigms/base.py:303, in BaseParadigm.get_data(self, dataset, subjects, return_epochs, return_raws)
    300                 X = np.append(X, x, axis=0) if len(X) else x
    301             labels = np.append(labels, lbs, axis=0)
--> 303 metadata = pd.concat(metadata, ignore_index=True)
    304 if return_epochs:
    305     X = mne.concatenate_epochs(X)

File ~/opt/mambaforge/envs/moabb/lib/python3.9/site-packages/pandas/util/_decorators.py:331, in deprecate_nonkeyword_arguments.<locals>.decorate.<locals>.wrapper(*args, **kwargs)
    325 if len(args) > num_allow_args:
    326     warnings.warn(
    327         msg.format(arguments=_format_argument_list(allow_args)),
    328         FutureWarning,
    329         stacklevel=find_stack_level(),
    330     )
--> 331 return func(*args, **kwargs)

File ~/opt/mambaforge/envs/moabb/lib/python3.9/site-packages/pandas/core/reshape/concat.py:368, in concat(objs, axis, join, ignore_index, keys, levels, names, verify_integrity, sort, copy)
    146 @deprecate_nonkeyword_arguments(version=None, allowed_args=["objs"])
    147 def concat(
    148     objs: Iterable[NDFrame] | Mapping[HashableT, NDFrame],
   (...)
    157     copy: bool = True,
    158 ) -> DataFrame | Series:
    159     """
    160     Concatenate pandas objects along a particular axis.
    161
   (...)
    366     1   3   4
    367     """
--> 368     op = _Concatenator(
    369         objs,
    370         axis=axis,
    371         ignore_index=ignore_index,
    372         join=join,
    373         keys=keys,
    374         levels=levels,
    375         names=names,
    376         verify_integrity=verify_integrity,
    377         copy=copy,
    378         sort=sort,
    379     )
    381     return op.get_result()

File ~/opt/mambaforge/envs/moabb/lib/python3.9/site-packages/pandas/core/reshape/concat.py:425, in _Concatenator.__init__(self, objs, axis, join, keys, levels, names, ignore_index, verify_integrity, copy, sort)
    422     objs = list(objs)
    424 if len(objs) == 0:
--> 425     raise ValueError("No objects to concatenate")
    427 if keys is None:
    428     objs = list(com.not_none(*objs))
    
ValueError: No objects to concatenate```

@gcattan
Copy link
Contributor Author

gcattan commented May 31, 2023

In this branch? gcattan:develop?

@sylvchev
Copy link
Member

In this branch? gcattan:develop?

In the moabb develop branch.

@sylvchev
Copy link
Member

In this branch? gcattan:develop?

Seems to be solved now.

dataset.virtual_reality = condition == "VR"
dataset.personal_computer = condition == "PC"

# cross validate with 3-folds validation.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not use a WithinSessionEvaluation?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wanted to demonstrate the use of the get_block_repetition method.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, in that case, you should add a small text it in the example to explain get_block_repetition method and to indicate that this example use it.

gcattan and others added 2 commits June 1, 2023 11:23
Co-authored-by: Sylvain Chevallier <sylvain.chevallier@universite-paris-saclay.fr>
@gcattan
Copy link
Contributor Author

gcattan commented Jun 7, 2023

I made the modification. Do you want me to conduct other validation?

@bruAristimunha
Copy link
Collaborator

Hi @gcattan,

Many thank you for your contribution! I appreciate your effort in creating this tutorial. However, I noticed that the tutorial lacks proper structuring and detailed comments, which makes it difficult for readers to follow along seamlessly.

To improve the tutorial, I suggest implementing the following changes:

  1. Split the code into logical blocks: It would be beneficial to divide the code into meaningful blocks, each addressing a specific aspect of the tutorial. For example, you can have a block for importing the virtual reality dataset, another for preprocessing steps, and so on. This will enhance readability and make it easier for users to navigate through the tutorial.

  2. Add comments and descriptive texts: Alongside the code, include comments that explain what each section or line of code does. This will provide additional context and help readers understand the purpose and functionality of the code. Feel free to use markdown markup to render comment blocks correctly, like in this example: link to example. By following this example, you can ensure that the rendered page on GitHub provides a clear understanding of the code.

To check the doc render in the pull request, when the doc generation finished, you will need to click on the Docs / build_docs (ubuntu-latest, 3.9) (pull_request) Details, Summary (top left), scroll down the page and click in Artifacts (DocumentationHTML).

Please let me know if you have any questions or need further clarification. I'm here to assist you with the review process.

@bruAristimunha
Copy link
Collaborator

Thank you @gcattan! All good for me!

@bruAristimunha bruAristimunha merged commit 7559bca into NeuroTechX:develop Jun 7, 2023
@gcattan
Copy link
Contributor Author

gcattan commented Jun 7, 2023

Thanks :)

@sylvchev
Copy link
Member

sylvchev commented Jun 8, 2023

Thanks @gcattan for nice addition and example, and kudo @bruAristimunha for the review 🙏

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants