Metadata-Version: 2.4
Name: mvo-core
Version: 0.1.4
Summary: Mortality Vector Optimization (MVO) algorithm for patient outcome prediction and evaluation
Author-email: Jinling Liu <2511063@zju.edu.cn>
Maintainer-email: Jinling Liu <2511063@zju.edu.cn>
License: MIT
Project-URL: Homepage, https://github.com/real853/mvo-core
Project-URL: Documentation, https://mvo-core.readthedocs.io/
Project-URL: Repository, https://github.com/real853/mvo-core
Project-URL: Issues, https://github.com/real853/mvo-core/issues
Project-URL: Changelog, https://github.com/real853/mvo-core/releases
Keywords: mortality-prediction,medical-outcomes,vector-optimization,clinical-prediction,bioinformatics,healthcare-ai
Classifier: Development Status :: 4 - Beta
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Intended Audience :: Science/Research
Classifier: Intended Audience :: Healthcare Industry
Classifier: Topic :: Scientific/Engineering :: Medical Science Apps.
Classifier: Topic :: Scientific/Engineering :: Bio-Informatics
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
Requires-Python: >=3.8
Description-Content-Type: text/markdown
License-File: LICENSE
License-File: AUTHORS.txt
Requires-Dist: numpy>=1.21.0
Requires-Dist: pandas>=1.3.0
Requires-Dist: scipy>=1.7.0
Requires-Dist: scikit-learn>=1.0.0
Requires-Dist: lifelines>=0.27.0
Provides-Extra: dev
Requires-Dist: pytest>=6.0; extra == "dev"
Requires-Dist: pytest-cov>=2.0; extra == "dev"
Requires-Dist: black>=21.0; extra == "dev"
Requires-Dist: flake8>=3.9; extra == "dev"
Requires-Dist: mypy>=0.900; extra == "dev"
Requires-Dist: pre-commit>=2.15; extra == "dev"
Provides-Extra: docs
Requires-Dist: sphinx>=4.0; extra == "docs"
Requires-Dist: sphinx-rtd-theme>=1.0; extra == "docs"
Requires-Dist: sphinx-autodoc-typehints>=1.12; extra == "docs"
Provides-Extra: examples
Requires-Dist: matplotlib>=3.5.0; extra == "examples"
Requires-Dist: seaborn>=0.11.0; extra == "examples"
Requires-Dist: jupyter>=1.0.0; extra == "examples"
Requires-Dist: notebook>=6.0.0; extra == "examples"
Requires-Dist: ipykernel>=6.0.0; extra == "examples"
Dynamic: license-file

markdown
# mvo-core

**Mortality Vector Optimization (MVO)** — A novel machine learning algorithm for dynamic disease progression monitoring and outcome prediction.

[![PyPI version](https://badge.fury.io/py/mvo-core.svg)](https://badge.fury.io/py/mvo-core)
[![Python 3.8+](https://img.shields.io/badge/python-3.8+-blue.svg)](https://www.python.org/downloads/)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)

---

## 📖 Background

Traditional clinical severity scores (e.g., CURB-65, PSI, SOFA) are commonly used at treatment initiation for risk stratification, but they have limited predictive accuracy and fail to capture dynamic changes in patient condition during treatment.

The **MVO** algorithm addresses these limitations by constructing high-dimensional patient vectors and optimizing a "mortality vector," enabling continuous quantitative assessment of disease progression with improved prognostic accuracy and real-time treatment monitoring.

---

## 🧮 Core Methodology

### Algorithm Workflow

1. **Vector Representation**  
   Each patient's risk factors (e.g., blood pressure, respiratory rate, BUN) are encoded as a vector **v = [v₁, v₂, ..., vₙ]** in high-dimensional space.

2. **Mortality Vector Definition**  
   A reference vector **M** representing the "critical state" is constructed:
   - Risk factors positively correlated with mortality → take the **maximum** value
   - Risk factors negatively correlated with mortality → take the **minimum** value

3. **Similarity Calculation**  
   Each patient vector is projected onto the mortality vector. A longer projection length indicates closer proximity to the critical state and higher mortality risk.

4. **Vector Optimization**  
   The mortality vector weights are iteratively adjusted via **gradient descent** to maximize AUC, yielding the **optimal mortality vector**.

### Trend Score

The Trend Score quantifies changes in patient condition by comparing similarity to the mortality vector at two time points:
Trend Score = Similarity(post-treatment) - Similarity(admission)

text

| Trend Score | Clinical Interpretation |
|:---:|:---|
| **Positive** | Deterioration → ineffective treatment → poor prognosis |
| **Negative** | Improvement → effective treatment → favorable prognosis |

Patients with a positive Trend Score have significantly higher mortality risk (HR: 2.63 for CURB-65, 2.50 for PSI).

### Advantages

- **Low overfitting risk**: Outperforms XGBoost, Random Forest, and other ensemble methods
- **High interpretability**: Risk factor weights can be directly read from the optimal mortality vector
- **Minimal hyperparameter tuning**: Only the gradient descent step size needs adjustment

---

## 📊 Validation Performance

The MVO algorithm has been validated across multiple independent cohorts:

| Cohort | Sample Size | Severity Score | C-index | AUC |
|:---|:---:|:---|:---:|:---:|
| Derivation (China) | 2,052 | PSI | 0.734 | 0.825 |
| GOSSIS-eICU | 131,052 | — | 0.850 | 0.870 |

MVO achieved top-tier performance compared to XGBoost, Random Forest, LightGBM, and other mainstream algorithms across multiple evaluation metrics.

---

## 📦 Installation

```bash
pip install mvo-core
```

## For development installation:

git clone https://github.com/real853/mvo-core.git
cd mvo-core
pip install -e ".[dev]"

## 🚀 Quick Start
```bash
import numpy as np
from mvo_core import MVO

# Sample data: 100 patients, 5 risk factors (e.g., CURB-65)
X = np.random.randn(100, 5)   # patient vectors
y = np.random.randint(0, 2, 100)  # mortality labels (0/1)

# Initialize and train MVO model
mvo = MVO()
mvo.fit(X, y)

# Predict mortality risk
risk_scores = mvo.predict_proba(X)

# Calculate Trend Score (pre-treatment vs. post-treatment)
trend_scores = mvo.trend_score(X_pre, X_post)
# Positive values indicate deterioration
```

## 📝 Citation and References
Application Reference
For detailed clinical application scenarios, complete validation workflows, and case studies of the MVO algorithm, please refer to the original research paper:

Title: Dynamically monitoring pneumonia severity scores to predict the prognosis in patients with community-acquired pneumonia: an international, multicenter cohort study
Authors: Liu J, Xu Z, Qian G, et al.
Journal: Respiratory Medicine, 2025
DOI: 10.1016/j.rmed.2025.108308

How to access:

Direct link: https://doi.org/10.1016/j.rmed.2025.108308

Search the paper title on PubMed or Google Scholar

Academic Citation
If you use this package in your research, please cite the above paper:

bibtex
@article{liu2025dynamically,
  title={Dynamically monitoring pneumonia severity scores to predict the prognosis in patients with community-acquired pneumonia: an international, multicenter cohort study},
  author={Liu, Jinliang and Xu, Zhiyang and Qian, Guoqing and Ishida, Tadashi and Hirai, Toyohiro and Ito, Isao and Liu, Chao and Wu, Xuejie and Zhang, Hong and Zheng, Xuting and others},
  journal={Respiratory Medicine},
  year={2025},
  doi={10.1016/j.rmed.2025.108308},
  publisher={Elsevier}
}
## 📄 License
MIT License — see the LICENSE file for details.

## 👥 Authors
Jinliang Liu — Department of Infectious Diseases, The Second Affiliated Hospital, Zhejiang University School of Medicine

Zhiyang Xu — Department of Infectious Diseases, The Second Affiliated Hospital, Zhejiang University School of Medicine

Feng Xu (Corresponding Author) — Department of Infectious Diseases, The Second Affiliated Hospital, Zhejiang University School of Medicine

## 📞 Contact
For questions or collaboration opportunities, please open a GitHub Issue or contact the corresponding author at: 2511063@zju.edu.cn
