Skip to main content

Random Survival Forest

DOI

The Random Survival Forest package provides a python implementation of the survival prediction method originally published by Ishwaran et al. (2008).

Reference: Ishwaran, H., Kogalur, U. B., Blackstone, E. H., & Lauer, M. S. (2008). Random survival forests. The annals of applied statistics, 2(3), 841-860.

Installation

$ pip install random-survival-forest

Contribute

Getting Started

from random_survival_forest.models import RandomSurvivalForest
from random_survival_forest.scoring import concordance_index
from lifelines import datasets
from sklearn.model_selection import train_test_split


rossi = datasets.load_rossi()
# Attention: duration column must be index 0, event column index 1 in y
y = rossi.loc[:, ["week", "arrest"]]
X = rossi.drop(["arrest", "week"], axis=1)
X, X_test, y, y_test = train_test_split(X, y, test_size=0.25)


rsf = RandomSurvivalForest(n_estimators=20, n_jobs=-1)
rsf = rsf.fit(X, y)
y_pred = rsf.predict(X_test)
c_val = concordance_index(y_time=y_test["week"], y_pred=y_pred, y_event=y_test["arrest"])
print("C-index", round(c_val, 3))

Feedback

If you are having issues or feedback, please let me know. I am happy to fix some bug or implement feature requests.

julian.alexander.spaeth@uni-hamburg..de

This package is completely open-source. If it helped you or you even use it comercially, I would be happy about a little support:

"Buy Me A Coffee"

License

MIT

Download files

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

Source Distribution

random_survival_forest-0.8.1.tar.gz (8.2 kB view details)

Uploaded Source

Built Distribution

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

random_survival_forest-0.8.1-py3-none-any.whl (8.3 kB view details)

Uploaded Python 3

File details

Details for the file random_survival_forest-0.8.1.tar.gz.

File metadata

  • Download URL: random_survival_forest-0.8.1.tar.gz
  • Upload date:
  • Size: 8.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.10.6

File hashes

Hashes for random_survival_forest-0.8.1.tar.gz
Algorithm Hash digest
SHA256 cc7ab9139396f1e3bdc24abe74dc67e90d4cf7f62cdf7bd4921e3d5708cf3046
MD5 99967f6292bd76fa96ea769917601c97
BLAKE2b-256 a3e3f1a1f494317d16d54b36dfcb086988b1c2ce3bd8dbff51e0821d6ae69f0c

See more details on using hashes here.

File details

Details for the file random_survival_forest-0.8.1-py3-none-any.whl.

File metadata

File hashes

Hashes for random_survival_forest-0.8.1-py3-none-any.whl
Algorithm Hash digest
SHA256 08603a7fb746b23f3c2a3b127726f953ad9d1ae1c715cd76110197a80d40a6fa
MD5 de01f9ace7822be4b7f975458f5cb74b
BLAKE2b-256 38e008aa7622e547dbe0c9195873a9dfa977c8d8c9c2daad7a90cc95014515ad

See more details on using hashes here.

Release history Release notifications | RSS feed

1.0.0

2 files

0.8.2

2 files

This release

0.8.1 This release

2 files

0.8.0

2 files

0.7.2

2 files

0.7.1

2 files

0.7

2 files

0.6.2

2 files

0.6.1

2 files

0.6.0

2 files

0.5.1

1 file

0.5

2 files

0.4.2

1 file

0.4.1

1 file

0.4

1 file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page