Skip to content

numanai/SurvRNC

Repository files navigation

SurvRNC: Learning Ordered Representations for Survival Prediction using Rank-N-Contrast

SurvRNC Overview

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

paper Dataset

Official GitHub repository for the SurvRNC


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.

Table of Contents

Installation

Please refer to the Installation Guide for detailed setup instructions.

Usage

For detailed usage instructions, please see the Usage Guide.

Configuration Management

The SurvRNC project utilizes configuration files to manage various parameters for different scripts. This approach enhances organization, scalability, and reproducibility.

Configuration Files

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.

Using Configuration Files

Preprocessing Data

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

Training the Model

python main.py --config configs/train.yaml

To override specific parameters:

python main.py --config configs/train.yaml --override lr=0.001 epochs=100

Creating New Configuration Files

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.

Parameter Overrides

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

Data Preprocessing

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

Training

Run the main training script with the appropriate configuration file:

python main.py --config configs/train.yaml

Evaluation

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.

Contributing

Contributions are welcome! Please read CONTRIBUTING.md for details on our code of conduct and the process for submitting pull requests.

License

This project is licensed under the MIT License. See the LICENSE file for details.

Citation

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}
}

Contact

If you have any questions, please create an issue on this repository or contact at [email protected].

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published