Skip to content

[DRAFT] Protocol redesign #57

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

Draft
wants to merge 16 commits into
base: develop-eeg
Choose a base branch
from

Conversation

vmcru
Copy link
Contributor

@vmcru vmcru commented Apr 7, 2025

This pull request contains the integration of the new dataio files and paradigms. It looks to replace the bash files that run the experiment and the hyper-parameter optimization with new python files. The main changes pertain to the train.py file that loads the data using dataio files, new run_experiments.py file, and later a new run_hparam_optimization.py file that integrates with WANDB.

Copy link
Collaborator

@Drew-Wagner Drew-Wagner left a comment

Choose a reason for hiding this comment

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

My initial thoughts after a 30 second skim... I did not check the experiment runner or train files yet.

Copy link

@pplantinga pplantinga left a comment

Choose a reason for hiding this comment

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

Here are some initial comments from a cursory review. Things look generally good, but I wonder if the definition of the hyperparameter sweep configuration might be worth some further thought.

As noted in the meeting this could also support weights and biases.

@@ -165,3 +215,29 @@ model: !new:models.EEGNet.EEGNet
dense_max_norm: !ref <dense_max_norm>
dropout: !ref <dropout>
dense_n_neurons: !ref <n_classes>

# Search Space

Choose a reason for hiding this comment

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

I like the search space concept!

I wonder if there's a way to reference the search space in the rest of the yaml file -- like:

dropout: !ref <search_space.dropout>

Choose a reason for hiding this comment

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

This might make it slightly clearer with how it works rather than having to use overrides. You might still have to reload the file each time, depending on how the reference worked exactly.

class ExperimentRunner:
"""Manages multiple MOABB experiment runs."""

def __init__(self, args: list):

Choose a reason for hiding this comment

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

maybe the __init__ can take the relevant arguments directly and you can add a function like from_commandline to parse the command line and construct an object. e.g.

def __init__(self, hparams, data_folder, output_folder, nsubj, nsess):
  """do input validation or whatever"""

@classmethod
def from_commandline_args(cls, args):
  """Load arguments from command line"""
  kwargs = self.parse_args(args)
  return cls(**kwargs)

def parse_args(self, args):
  parser = argparse.ArgumentParser()
  parser.add_argument(...)
  ...
  args = parser.parse_args(args)
  return args.__dict__


"""
class MOABBBrain(sb.Brain):
"""Modified Brain class for MOABB experiments with new data format."""

def init_model(self, model):

Choose a reason for hiding this comment

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

Maybe model initialization should be done in the model files themselves?

@@ -253,174 +387,109 @@ def check_if_best(


def run_experiment(hparams, run_opts, datasets):
"""This function performs a single training (e.g., single cross-validation fold)"""
idx_examples = np.arange(datasets["train"].dataset.tensors[0].shape[0])
"""Run a single experiment with the new data format."""

Choose a reason for hiding this comment

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

"New" data format may not mean anything to someone reading this file. Perhaps you can either explicitly write out the data format, or just state more clearly what the function does.

return base_config, search_space


def load_search_space_only(yaml_path):

Choose a reason for hiding this comment

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

I wonder if there's a better way to do this somehow. If the search space can't be integrated with the other parameters as suggested above, maybe this is just better as a separate file?

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