Proposed Json Schema for Bci Model Cards V0001

Abstract

I wrote a first pass JSON schema for the BCI model cards, building off of Brian’s spike in Nov 2023. I’m putting this up here for others to review. I will be using this schema as part of the Agentic workflow to populate the JSON, starting with the “Pipeline Steps” section.

What you’ll find below are:

  1. Proposed JSON schema template
  2. Example of JSON schema that I manually filled in for MindTV.

Proposed JSON schema

Below is the proposed JSON schema, in the code box below and also in the attached JSON file.

I’ve also attached a visualization of the JSON schema via JSON Crack – you can reproduce this visualization by copying the below JSON code into the editor in the link.

{
  "BCI Model card version": "0.0.0.1",
  "Pipeline Name": null,
  "Pipeline Steps": [
    {
      "Step": "Generic",
      "Used": false,
      "From": null,
      "Function": null,
      "Description": null,
      "Details": null,
      "parameters": {
        "param_1": {
          "type": null,
          "description": null,
          "value": null
        },
        "param_2": {
          "type": null,
          "description": null,
          "value": null
        },
        "param_N": {
          "type": null,
          "description": null,
          "value": null
        }
      }
    },
    {
      "Step": "Resampling",
      "Used": false,
      "From": null,
      "Function": null,
      "Description": null,
      "Details": null,
      "parameters": {
        "param_1": {
          "type": null,
          "description": null,
          "value": null
        },
        "param_2": {
          "type": null,
          "description": null,
          "value": null
        },
        "param_N": {
          "type": null,
          "description": null,
          "value": null
        }
      }
    },
    {
      "Step": "Preprocessing",
      "Used": true,
      "From": null,
      "Function": null,
      "Description": null,
      "Details": null,
      "parameters": {
        "param_1": {
          "type": null,
          "description": null,
          "value": null
        },
        "param_2": {
          "type": null,
          "description": null,
          "value": null
        },
        "param_N": {
          "type": null,
          "description": null,
          "value": null
        }
      }
    },
    {
      "Step": "Feature selection",
      "Used": false,
      "From": null,
      "Function": null,
      "Description": null,
      "Details": null,
      "parameters": {
        "param_1": {
          "type": null,
          "description": null,
          "value": null
        },
        "param_2": {
          "type": null,
          "description": null,
          "value": null
        },
        "param_N": {
          "type": null,
          "description": null,
          "value": null
        }
      }
    },
    {
      "Step": "Channel selection",
      "Used": false,
      "From": null,
      "Function": null,
      "Description": null,
      "Details": null,
      "parameters": {
        "param_1": {
          "type": null,
          "description": null,
          "value": null
        },
        "param_2": {
          "type": null,
          "description": null,
          "value": null
        },
        "param_N": {
          "type": null,
          "description": null,
          "value": null
        }
      }
    },
    {
      "Step": "Spatial filtering",
      "Used": false,
      "From": null,
      "Function": null,
      "Description": null,
      "Details": null,
      "parameters": {
        "param_1": {
          "type": null,
          "description": null,
          "value": null
        },
        "param_2": {
          "type": null,
          "description": null,
          "value": null
        },
        "param_N": {
          "type": null,
          "description": null,
          "value": null
        }
      }
    },
    {
      "Step": "Classification",
      "Used": true,
      "From": null,
      "Function": null,
      "Description": null,
      "Details": null,
      "parameters": {
        "Model architecture": {
          "param_1": {
            "type": null,
            "description": null,
            "value": null
          },
          "param_2": {
            "type": null,
            "description": null,
            "value": null
          },
          "param_N": {
            "type": null,
            "description": null,
            "value": null
          }
        },
        "Hyperparameters": {
          "param_1": {
            "type": null,
            "description": null,
            "value": null
          },
          "param_2": {
            "type": null,
            "description": null,
            "value": null
          },
          "param_N": {
            "type": null,
            "description": null,
            "value": null
          }
        },
        "Training parameters": {
          "param_1": {
            "type": null,
            "description": null,
            "value": null
          },
          "param_2": {
            "type": null,
            "description": null,
            "value": null
          },
          "param_N": {
            "type": null,
            "description": null,
            "value": null
          }
        }
      }
    }
  ],
  "Individual Fields": {
    "name": "Participant Name",
    "channels selection": {
      "channels rejected": null,
      "channels selected": null
    },
    "classifier performance": {
      "accuracy": null,
      "AUC": null,
      "precision": null,
      "recall": null
    }
  },
  "Population Fields": {
    "name": "Participant Name",
    "Population database": null,
    "Population metrics": {
      "accuracy": null,
      "AUC": null,
      "precision": null,
      "recall": null
    }
  }
}

BCI_ModelCard_Template_v0001.json

Example of JSON schema from MindTV

This is a what the JSON schema looks like after I manually filled it in for MindTV as of 2024-04-30. As before, you’ll find the JSON code in the code box and attached file, and a visualization of what it looks like if put into JSONCrack

{
    "BCI Model card version": "0.0.0.1",
    "Pipeline Name": "MindTV",
    "Pipeline Steps": [
      {
        "Step": "Generic",
        "Used": false,
        "From": null,
        "Function": null,
        "Description": null,
        "Details": null,
        "parameters": {
          "param_1": {
            "type": null,
            "description": null,
            "value": null
          },
          "param_2": {
            "type": null,
            "description": null,
            "value": null
          },
          "param_N": {
            "type": null,
            "description": null,
            "value": null
          }
        }
      },
      {
        "Step": "Resampling",
        "Used": false,
        "From": null,
        "Function": null,
        "Description": null,
        "Details": null,
        "parameters": {
          "param_1": {
            "type": null,
            "description": null,
            "value": null
          },
          "param_2": {
            "type": null,
            "description": null,
            "value": null
          },
          "param_N": {
            "type": null,
            "description": null,
            "value": null
          }
        }
      },
      {
        "Step": "Preprocessing",
        "Used": true,
        "From": "bci_essentials.signal_processing",
        "Function": "bandpass",
        "Description": null,
        "Details": null,
        "parameters": {
          "f_low": {
            "type": "float",
            "description": "Lower corner frequency",
            "value": 1
          },
          "f_high": {
            "type": "float",
            "description": "Upper corner frequency",
            "value": 40
          },
          "order": {
            "type": "float",
            "description": "Order of the filter",
            "value": 5
          },
          "f_sample": {
            "type": "float",
            "description": "Sampling rate of signal",
            "value": 256
          }
        }
      },
      {
        "Step": "Feature selection",
        "Used": false,
        "From": null,
        "Function": null,
        "Description": null,
        "Details": null,
        "parameters": {
          "param_1": {
            "type": null,
            "description": null,
            "value": null
          },
          "param_2": {
            "type": null,
            "description": null,
            "value": null
          },
          "param_N": {
            "type": null,
            "description": null,
            "value": null
          }
        }
      },
      {
        "Step": "Channel selection",
        "Used": false,
        "From": null,
        "Function": null,
        "Description": null,
        "Details": null,
        "parameters": {
          "param_1": {
            "type": null,
            "description": null,
            "value": null
          },
          "param_2": {
            "type": null,
            "description": null,
            "value": null
          },
          "param_N": {
            "type": null,
            "description": null,
            "value": null
          }
        }
      },
      {
        "Step": "Spatial filtering",
        "Used": false,
        "From": null,
        "Function": null,
        "Description": null,
        "Details": null,
        "parameters": {
          "param_1": {
            "type": null,
            "description": null,
            "value": null
          },
          "param_2": {
            "type": null,
            "description": null,
            "value": null
          },
          "param_N": {
            "type": null,
            "description": null,
            "value": null
          }
        }
      },
      {
        "Step": "Classification",
        "Used": true,
        "From": "bci_essentials.classification.mi_classifier",
        "Function": "MiClassifier",
        "Description": "This classifier is used to classify MI data",
        "Details": "The type of classifier used is a Tangent space logistic regression classifier",
        "parameters": {
          "Model architecture": {
            "type": {
              "type": "string",
              "description": "Type of MI classifier used",
              "value": "TS",
              "details": "Tangent space logistic regression from pyriemann.classification.TSclassifier"
            }
          },
  
          "Hyperparameters": {
            "n_splits": {
              "type": "int",
              "description": "Number of folds for cross-validation",
              "value": 3
            },
            "covariance_estimator": {
              "type": "string",
              "description": "Covariance estimator. See pyriemann Covariances.",
              "value": "oas"
            }
          },
  
          "Training parameters": {
            "rebuild": {
              "type": "boolean",
              "description": "Rebuild from scratch with each training",
              "value": true
            },
            "pred_threshold": {
              "type": "float",
              "description": "Probability threshold for true predictions",
              "value": null
            },
            "remove_flats": {
              "type": "boolean",
              "description": "Description of parameter `remove_flats`",
              "value": false
            },
            "whitening": {
              "type": "boolean",
              "description": "Description of parameter `whitening`",
              "value": false
            },
            "artifact_rejection": {
              "type": "string",
              "description": "Description of parameter `artifact_rejection`",
              "value": "none"
            },
            "channel_selection": {
              "type": "string",
              "description": "Description of parameter `channel_selection`",
              "value": "none"
            },
            "random_seed": {
              "type": "int",
              "description": "Random seed",
              "value": 35
            },
            "n_jobs": {
              "type": "int",
              "description": "The number of threads to dedicate to this calculation",
              "value": 1
            }
          }
        }
      }
    ],
    "Individual Fields": {
      "name": "Participant Name",
      "channels selection": {
        "channels rejected": null,
        "channels selected": null
      },
      "classifier performance": {
        "accuracy": null,
        "AUC": null,
        "precision": null,
        "recall": null
      }
    },
    "Population Fields": {
      "name": "Participant Name",
      "Population database": null,
      "Population metrics": {
        "accuracy": null,
        "AUC": null,
        "precision": null,
        "recall": null
      }
    }
  }

BCI_ModelCard_Template_v0001-MindTV_manual_example.json

Visualization of JSON schema filled in for MindTV