Overview of the proposed SurvRNC loss function for learning ordinal representations. In a randomly weighted sampled batch of M patients, the loss function ranks them with respect to their time-to-event differences with the anchor. Contrasting the anchor patient with a positive pair patient enforces the similarity in the embedding space to be higher than the negative pair(s) of patients with a larger time-to-event difference than the positive pair. The uncertain patient pair(s), whose real-time difference with the anchor patient is unknown, are given less weight. (a) shows an example of an uncensored anchor and positive-pair patient. (b) shows an example of a censored anchor with an uncensored, positive pair. (c) provides all different combinations that can occur between a batch of patients.
SurvRNC: Learning Ordered Representations for Survival Prediction using Rank-N-Contrast
Numan Saeed* , Muhammad Ridzuan* , Fadillah Adamsyah Maani, Hussain Alasmawi, Karthik Nandakumar, Mohammad Yaqub
* Equally contributing first authors
Mohamed bin Zayed University of Artificial Intelligence
Official GitHub repository for the SurvRNC
SurvRNC is a project focused on survival analysis using Rank-N-Contrast loss to order the latent representation for prognosis. It restricts the latent representation of both uni/multi-modal data to be ordered based on the time-to-event.
- Installation
- Usage
- Configuration Management
- Data Preprocessing
- Training
- Evaluation
- Contributing
- License
Please refer to the Installation Guide for detailed setup instructions.
For detailed usage instructions, please see the Usage Guide.
The SurvRNC project utilizes configuration files to manage various parameters for different scripts. This approach enhances organization, scalability, and reproducibility.
Configuration files are stored in the configs/
directory and use the YAML format. The default.yaml
file contains default settings, which can be overridden by specific configuration files like train.yaml
or preprocess.yaml
.
python ctpt_preprocess.py --config configs/preprocess.yaml
To override specific parameters from the command line:
python ctpt_preprocess.py --config configs/preprocess.yaml --override space_x=3 batch_size=64
python main.py --config configs/train.yaml
To override specific parameters:
python main.py --config configs/train.yaml --override lr=0.001 epochs=100
You can create new configuration files by copying default.yaml
and modifying the required parameters. Ensure that these files are stored in the configs/
directory for consistency.
The --override
argument allows you to specify individual parameter changes without editing the configuration file. Parameters should be provided in the key=value
format. Nested parameters can be accessed using dot notation if necessary.
Example:
python main.py --config configs/train.yaml --override optimizer=SGD lr=0.005
The ctpt_preprocess.py
script is used to preprocess CT and PT scans. It now uses configuration files for parameter management.
python ctpt_preprocess.py --config configs/preprocess.yaml
Run the main training script with the appropriate configuration file:
python main.py --config configs/train.yaml
Evaluate the trained models using survival analysis metrics such as Concordance Index (CI) and Brier Score. The evaluation process is integrated into the training script and uses the same configuration file system.
Contributions are welcome! Please read CONTRIBUTING.md for details on our code of conduct and the process for submitting pull requests.
This project is licensed under the MIT License. See the LICENSE file for details.
If you find our work and this repository useful, please consider giving our repo a star and citing our paper as follows:
@article{saeed2024survrnc,
title={SurvRNC: Learning Ordered Representations for Survival Prediction using Rank-N-Contrast},
author={Saeed, Numan and Ridzuan, Muhammad and Maani, Fadillah Adamsyah and Alasmawi, Hussain and Nandakumar, Karthik and Yaqub, Mohammad},
journal={arXiv preprint arXiv:2403.10603},
year={2024}
}
If you have any questions, please create an issue on this repository or contact at [email protected].