Example #1
0
def main():
    # get config
    config = load_cfg(None)
    # get vars from config
    dataset_name = config["experiment"]["dataset"]
    dataset_subject_count = config["data"][dataset_name]["n_subjects"]
    experiment_type = config["experiment"]["type"]
    experiment_n_folds = config["experiment"]["n_folds"]
    model_name = config["model"]["name"]
    # path to save csv
    now = (
        str(datetime.datetime.now())
        .replace("-", "_")
        .replace(" ", "_")
        .replace(".", "_")
        .replace(":", "_")
    )
    results_path = f"/home/no316758/results/{now}_{experiment_type}_{model_name}_{dataset_name}_{experiment_n_folds}/"
    if not os.path.exists(results_path):
        os.makedirs(results_path)

    # copy config
    exp_cfg_path = f"{results_path}config.yaml"
    with open(exp_cfg_path, "w") as outfile:
        yaml.dump(config, outfile, default_flow_style=False)

    script_name = "_single_slurm_run.sh"
    script_path = os.path.abspath(os.path.join(os.path.dirname(__file__), script_name))
    p = subprocess.Popen(
        f"sbatch -o {results_path}sbatch_stdout_%j.txt {script_path} {results_path}",
        shell=True,
    )
    p.wait()
Example #2
0
def main(args):
    # Load config file
    config = load_cfg(args)

    # Set subject id and valid fold
    subject_id = config["experiment"]["subject_id"]
    i_valid_fold = config["experiment"]["i_valid_fold"]

    if config["server"]["full_cv"]:
        full_cv_all_subjects(config)
    else:
        # Run single subject single fold:
        single_subject_single_fold(subject_id, i_valid_fold, config)
Example #3
0
    if len(sys.argv) > 1:
        results_dir_path = sys.argv[1]

    logging.basicConfig(
        format="%(asctime)s %(levelname)s : %(message)s",
        level=logging.DEBUG,
        stream=sys.stdout,
    )
    # Should contain both .gdf files and .mat-labelfiles from competition
    # data_folder = "/home/no316758/data/BCICIV_2a_gdf/"
    # data_folder = '/Users/sebas/code/_eeg_data/BCICIV_2a_gdf/'
    # low_cut_hz = 4  # 0 or 4
    cuda = True

    # get config
    config = load_cfg(None, cfg_path=f"{results_dir_path}config.yaml")
    experiment_type = config["experiment"]["type"]

    # get vars from config
    dataset_name = config["experiment"]["dataset"]
    dataset_subject_count = config["data"][dataset_name]["n_subjects"]
    dataset_path = config["data"][dataset_name]["proc_path"]
    dataset_n_classes = config["data"][dataset_name]["n_classes"]
    experiment_type = config["experiment"]["type"]
    experiment_n_folds = config["experiment"]["n_folds"]
    experiment_i_valid_fold = config["experiment"]["i_valid_fold"]
    model_name = config["model"]["name"]  # 'eegnet' or 'shallow' or 'deep'
    experiment_max_epochs = config["train"]["max_epochs"]
    experiment_max_increase_epochs = config["train"]["early_stop_patience"]
    experiment_batch_size = config["train"]["batch_size"]