{"id":13686822,"url":"https://github.com/square/pysurvival","last_synced_at":"2025-10-10T11:39:52.001Z","repository":{"id":41092642,"uuid":"178483050","full_name":"square/pysurvival","owner":"square","description":"Open source package for Survival Analysis modeling","archived":false,"fork":false,"pushed_at":"2024-03-11T19:40:26.000Z","size":8047,"stargazers_count":351,"open_issues_count":62,"forks_count":106,"subscribers_count":19,"default_branch":"master","last_synced_at":"2024-10-04T21:02:08.420Z","etag":null,"topics":["deep-learning","machine-learning","numpy","python","pytorch","survival-analysis"],"latest_commit_sha":null,"homepage":"https://www.pysurvival.io/","language":"HTML","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/square.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.txt","contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2019-03-29T22:27:46.000Z","updated_at":"2024-09-27T02:24:19.000Z","dependencies_parsed_at":"2022-09-18T00:10:59.899Z","dependency_job_id":"50cfefd5-2d59-492a-83b5-b13ebeb5fed9","html_url":"https://github.com/square/pysurvival","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/square%2Fpysurvival","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/square%2Fpysurvival/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/square%2Fpysurvival/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/square%2Fpysurvival/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/square","download_url":"https://codeload.github.com/square/pysurvival/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":224257240,"owners_count":17281674,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["deep-learning","machine-learning","numpy","python","pytorch","survival-analysis"],"created_at":"2024-08-02T15:00:41.137Z","updated_at":"2025-10-10T11:39:46.980Z","avatar_url":"https://github.com/square.png","language":"HTML","readme":"# PySurvival\n\n\u003ccenter\u003e\u003cimg src=\"docs/pages/images/pysurvival_logo_black_blue.png\" alt=\"pysurvival_logo\" title=\"pysurvival_logo\" width=\"50%\", height=\"50%\" /\u003e\u003c/center\u003e\n\n## What is Pysurvival ?\nPySurvival is an open source python package for Survival Analysis modeling - *the modeling concept used to analyze or predict when an event is likely to happen*. It is built upon the most commonly used machine learning packages such [NumPy](http://www.numpy.org/), [SciPy](https://www.scipy.org/) and [PyTorch](https://pytorch.org/).\n\nPySurvival is compatible with Python 2.7-3.7.\n\nCheck out the documentation [here](https://www.pysurvival.io)\n\n---\n\n## Content\nPySurvival provides a very easy way to navigate between theoretical knowledge on Survival Analysis and detailed tutorials on how to conduct a full analysis, build and use a model. Indeed, the package contains:\n\n* 10+ models ranging from the [Cox Proportional Hazard model](https://www.pysurvival.io/models/coxph.html), the [Neural Multi-Task Logistic Regression](https://www.pysurvival.io/models/neural_mtlr.html) to [Random Survival Forest](https://www.pysurvival.io/models/random_survival_forest.html)\n* Summaries of the theory behind each model as well as API descriptions and examples.\n* Tutorials displaying in great details how to perform exploratory data analysis, survival modeling, cross-validation and prediction, for [churn modeling](https://www.pysurvival.io/tutorials/churn.html) and [credit risk](https://www.pysurvival.io/tutorials/credit_risk.html) to name a few.\n* Performance metrics to assess the models' abilities like [c-index](https://www.pysurvival.io/metrics/c_index.html) or [brier score](https://www.pysurvival.io/metrics/brier_score.html)\n* Simple ways to [load and save models](https://www.pysurvival.io/miscellaneous/save_load.html)\n* ... and more !\n\n---\n\n## Installation\n\nIf you have already installed a working version of gcc, the easiest way to install Pysurvival is using pip\n```\npip install pysurvival\n```\nThe full description of the installation steps can be found [here](https://www.pysurvival.io/installation.html).\n\n---\n\n## Get Started\n\nBecause of its simple API, Pysurvival has been built to provide to best user experience when it comes to modeling.\nHere's a quick modeling example to get you started:\n\n```python\n# Loading the modules\nfrom pysurvival.models.semi_parametric import CoxPHModel\nfrom pysurvival.models.multi_task import LinearMultiTaskModel\nfrom pysurvival.datasets import Dataset\nfrom pysurvival.utils.metrics import concordance_index\n\n# Loading and splitting a simple example into train/test sets\nX_train, T_train, E_train, X_test, T_test, E_test = \\\n\tDataset('simple_example').load_train_test()\n\n# Building a CoxPH model\ncoxph_model = CoxPHModel()\ncoxph_model.fit(X=X_train, T=T_train, E=E_train, init_method='he_uniform', \n                l2_reg = 1e-4, lr = .4, tol = 1e-4)\n\n# Building a MTLR model\nmtlr = LinearMultiTaskModel()\nmtlr.fit(X=X_train, T=T_train, E=E_train, init_method = 'glorot_uniform', \n           optimizer ='adam', lr = 8e-4)\n\n# Checking the model performance\nc_index1 = concordance_index(model=coxph_model, X=X_test, T=T_test, E=E_test )\nprint(\"CoxPH model c-index = {:.2f}\".format(c_index1))\n\nc_index2 = concordance_index(model=mtlr, X=X_test, T=T_test, E=E_test )\nprint(\"MTLR model c-index = {:.2f}\".format(c_index2))\n```\n\n---\n\n## Citation and License\n\n### Citation\nIf you use Pysurvival in your research and we would greatly appreciate if you could use the following:\n\n```\n@Misc{ pysurvival_cite,\n  author =    {Stephane Fotso and others},\n  title =     {PySurvival: Open source package for Survival Analysis modeling},\n  year =      {2019--},\n  url = \"https://www.pysurvival.io/\"\n}\n```\n\n### License\n\nCopyright 2019 Square Inc.\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n[http://www.apache.org/licenses/LICENSE-2.0](http://www.apache.org/licenses/LICENSE-2.0)\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n","funding_links":[],"categories":["HTML","Survival Analysis"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsquare%2Fpysurvival","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsquare%2Fpysurvival","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsquare%2Fpysurvival/lists"}