GithubHelp home page GithubHelp logo

romy-vos / random-survival-forest Goto Github PK

View Code? Open in Web Editor NEW

This project forked from julianspaeth/random-survival-forest

0.0 0.0 0.0 67 KB

A Random Survival Forest implementation for python inspired by Ishwaran et al. - Easily understandable, adaptable and extendable.

License: Other

Python 100.00%

random-survival-forest's Introduction

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 import RandomSurvivalForest, 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.

[email protected]

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

random-survival-forest's People

Contributors

julianspaeth avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.