Skip to main content

An Offline Constrained Reinforcement Learning Toolkit for Medical Decision Making

Project description

ConMED-RL: An OCRL-Based Toolkit for Medical Decision Support

License: MIT Python 3.8+ PyPI version

ConMED-RL is an Offline Constrained Reinforcement Learning (OCRL) toolkit designed for critical care decision support. The toolkit provides state-of-the-art algorithms for medical decision-making tasks, with a focus on ICU discharge and extubation decisions.

This toolkit is based on research published in IISE Transactions on Healthcare Systems Engineering and is actively developed by researchers at TUM School of Computation, Information and Technology.

🚀 Quick Start

Installation

Install ConMED-RL using pip:

pip install conmedrl

Basic Usage

from ConMedRL import FQE, FQI, TrainDataLoader, ValTestDataLoader

# Load your clinical data
train_loader = TrainDataLoader(
    state_df=state_data,
    outcome_df=outcome_data,
    train_ids=train_patient_ids
)

# Initialize and train FQI agent
from ConMedRL import RLTraining

trainer = RLTraining(
    state_dim=state_dim,
    action_dim=action_dim,
    train_loader=train_loader
)

# Train the model
trainer.fqi_agent_train(epochs=100)

# Evaluate using FQE
fqe_results = trainer.fqe_agent_evaluate(test_loader)

📦 Core Components

Offline Reinforcement Learning Algorithms

  • Fitted Q-Evaluation (FQE): Policy evaluation for offline data
  • Fitted Q-Iteration (FQI): Policy optimization with constraint handling
  • Replay Buffer: Efficient data management for training
  • Custom RL Configurator: Flexible configuration for different clinical scenarios

Data Processing

  • TrainDataLoader: Handles training data preparation and batch generation
  • ValTestDataLoader: Manages validation and testing data processing
  • Support for custom done conditions and constraint cost functions

🏥 Key Features

  • Offline Learning: Train models on historical clinical data without online interaction
  • Constraint Handling: Built-in support for clinical safety constraints
  • Flexible Architecture: Easy integration with existing clinical datasets
  • Medical Focus: Specifically designed for ICU decision-making scenarios
  • Research-Backed: Based on peer-reviewed methodologies

📊 Use Cases

ConMED-RL has been successfully applied to:

  • ICU Discharge Decision-Making: Optimizing timing and safety of patient discharge
  • Mechanical Ventilation Weaning: Supporting extubation decisions with constraint satisfaction
  • Multi-Constraint Clinical Decisions: Balancing multiple clinical objectives and safety requirements

🔧 Advanced Configuration

Custom Reward and Constraint Functions

from ConMedRL import RLConfig_custom

config = RLConfig_custom(
    state_dim=50,
    action_dim=2,
    hidden_layers=[128, 128],
    learning_rate=0.001,
    gamma=0.99
)

# Use custom configuration in training
trainer = RLTraining(config=config, train_loader=train_loader)

Data Preprocessing

ConMED-RL expects data in MDP format:

  • State Table: Physiological measurements and clinical variables
  • Outcome Table: Actions, rewards, and terminal indicators

See the full documentation for data preprocessing examples.

📖 Documentation and Examples

For comprehensive guides, tutorials, and examples:

  • GitHub Repository: https://github.com/smt970913/ConMED-RL
  • Library Usage Guide: See LIBRARY_USAGE.md in the repository
  • Example Notebooks: Interactive Jupyter notebooks for MIMIC-IV datasets
  • Web Application Demo: Clinical decision support interface

🔬 Research and Citation

This toolkit is based on research published in academic journals. If you use ConMED-RL in your research, please cite:

@article{sun2025conmedrl,
  title={ConMED-RL: An Offline Constrained Reinforcement Learning Framework for ICU Discharge Decision-Making},
  author={Sun, Maotong and Xie, Jingui},
  journal={IISE Transactions on Healthcare Systems Engineering},
  year={2025}
}

🛠️ Requirements

  • Python 3.8 or higher
  • PyTorch
  • NumPy
  • Pandas
  • scikit-learn

All dependencies are automatically installed with the package.

📝 License

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

👥 Authors and Contact

Technical University of Munich (TUM)
School of Computation, Information and Technology

🤝 Contributing

We welcome contributions! For major changes, please open an issue first to discuss what you would like to change.

For development setup and contributing guidelines, visit the GitHub repository.

🔗 Links

⚠️ Disclaimer

This toolkit is intended for research purposes. Clinical deployment requires appropriate validation, regulatory approval, and should only be used by qualified healthcare professionals in accordance with institutional guidelines and applicable regulations.


Keywords: reinforcement learning, constrained reinforcement learning, offline reinforcement learning, clinical decision support, healthcare, ICU, critical care, machine learning, artificial intelligence

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

conmedrl-1.0.3.tar.gz (106.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

conmedrl-1.0.3-py3-none-any.whl (98.3 kB view details)

Uploaded Python 3

File details

Details for the file conmedrl-1.0.3.tar.gz.

File metadata

  • Download URL: conmedrl-1.0.3.tar.gz
  • Upload date:
  • Size: 106.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.3

File hashes

Hashes for conmedrl-1.0.3.tar.gz
Algorithm Hash digest
SHA256 626b30f48798a1678755edb45be663a311c947043ae2bfc78376fc660b8f193d
MD5 a72eda46b5db86978ece7275e87f10c0
BLAKE2b-256 fb41b28069ddf6a2246a62c62e4dbf9f77b760ccfd9b73eff34ec1d19091faf9

See more details on using hashes here.

File details

Details for the file conmedrl-1.0.3-py3-none-any.whl.

File metadata

  • Download URL: conmedrl-1.0.3-py3-none-any.whl
  • Upload date:
  • Size: 98.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.3

File hashes

Hashes for conmedrl-1.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 304b62d050fdad45ca0590a91b067cd7fe6f98974779bc83ae21546ac5058656
MD5 3df54888c9d5b43029518fdd7ee388cf
BLAKE2b-256 5a978e3c656adc7440749203374792efc72e00cead231540f8697cd1f505edbf

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page