Skip to main content

GuanRank algorithm in Python

Project description

guanrank

Python implementation of the GuanRank hazard ranking algorithm. Assigns a continuous hazard rank to each subject in a survival dataset — higher rank means higher risk of earlier event. Ranks can be used as regression targets for machine learning models in place of raw survival times.

Citation

Huang et al. (2017). Complete hazard ranking to analyze right-censored data: An ALS survival study. PLOS Comp Bio, 15(1), 41–51. https://journals.plos.org/ploscompbiol/article?id=10.1371/journal.pcbi.1005887

Installation

pip install guanrank
# or with uv
uv add guanrank

Usage

Functional API

from guanrank import guanrank

T = [5.0, 3.0, 8.0, 3.0]  # time-to-event or censoring times
E = [1,   1,   0,   0  ]  # 1 = event, 0 = censored

ranks = guanrank(T, E)

Sklearn-style API (train/test split)

from guanrank import GuanRank

gr = GuanRank()
train_ranks = gr.fit_transform(T_train, E_train)
test_ranks = gr.transform(T_test, E_test)

fit stores the training cohort's Kaplan-Meier curve; transform scores new subjects by comparing them against the training cohort.

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

guanrank-0.1.1.tar.gz (3.3 kB view details)

Uploaded Source

Built Distribution

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

guanrank-0.1.1-py3-none-any.whl (4.2 kB view details)

Uploaded Python 3

File details

Details for the file guanrank-0.1.1.tar.gz.

File metadata

  • Download URL: guanrank-0.1.1.tar.gz
  • Upload date:
  • Size: 3.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for guanrank-0.1.1.tar.gz
Algorithm Hash digest
SHA256 9a7f86438f3baec1eeb62d02cf5be7e55b9c74dd39db0bddf1a3d1258f4e6410
MD5 fb11469f67e5a46f93f23b35b1acc198
BLAKE2b-256 6e8f789b81dd97e36511dc345167d647821994b3e87f237f1b161482ac506cea

See more details on using hashes here.

Provenance

The following attestation bundles were made for guanrank-0.1.1.tar.gz:

Publisher: release.yml on d-laub/guanrank

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file guanrank-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: guanrank-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 4.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for guanrank-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 61c91f0d7f4697498f892ed8c64c8f4c3d026cc7d9317d9f81803cf9877cb86b
MD5 9a4f836ba73eb164bdf37a8473dd3fc2
BLAKE2b-256 8adfdc916a4c22834b2d224c6e461ad1797bfa8df361196bc24673493e835dac

See more details on using hashes here.

Provenance

The following attestation bundles were made for guanrank-0.1.1-py3-none-any.whl:

Publisher: release.yml on d-laub/guanrank

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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