Prospective evaluation of the SPMS conformal prediction model, trained on 2022 data, on the new visits registered up to 2025. The model is compared with the Lorscheider criteria.
├── analysis.ipynb # the full analysis, run top to bottom
├── environment.yml # conda environment
├── scripts/ # helper functions imported by the notebook
├── models/ # icp.joblib (trained model); shap_values.joblib is created on first run (need data to run)
└── images/ # figures written by the notebook
The data are not included in this repository. The notebook expects two folders next to the repository folder (the paths are set in the third code cell, DATA_2022_DIR and DATA_2025_DIR):
parent_folder/
├── MSP-tracker_prospective_analysis/ # this repository
├── 2022_data/
│ ├── train.csv
│ ├── valid.csv
│ ├── calib.csv
│ └── test.csv
└── 2025_data/
├── 3_cleaned_data.csv
└── english_translated/
├── skov.csv
└── edss.csv
If your data are somewhere else, change DATA_2022_DIR and DATA_2025_DIR in that cell.
You need conda (Miniforge or Miniconda). From the repository folder:
conda env create -f environment.yml
conda activate smsreg_prosTo update an existing environment after environment.yml changes:
conda env update -f environment.yml --prune- Clone the repository and place the data as described above:
git clone git@github.com:caramba-uu/MSP-tracker_prospective_analysis.git cd MSP-tracker_prospective_analysis - Activate the environment and start Jupyter:
In VS Code, open
conda activate smsreg_pros jupyter lab analysis.ipynb
analysis.ipynband select thesmsreg_prosinterpreter as the kernel instead. - Run all cells from the top (Run → Run All Cells).
The first code cell clones pharmbio/plot_utils into the repository folder. This provides the conformal prediction metrics and plots. If the folder plot_utils/ already exists, the clone prints an error that can be ignored.
- Retraining the model: the saved model in
models/icp.joblibis used by default. SetTRAIN_MODEL = Truein its cell to train a new one from the 2022 data. - SHAP values: computing them takes several minutes. They are saved to
models/shap_values.joblibon the first run and loaded from there afterwards. Delete that file to recompute them.
All figures are written to images/ as PDF, including the manuscript figures (Figure_1.pdf to Figure_5.pdf), the misclassification rate per year since the most recent visit with Bonferroni corrected pairwise tests (misclassification_rate_model.pdf), and the SHAP panel (shap_panel.pdf).