Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
Chirag Nagpal authored Apr 17, 2022
1 parent f4404ce commit bda3e39
Showing 1 changed file with 48 additions and 25 deletions.
73 changes: 48 additions & 25 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,25 @@ regression problems, Survival Analysis differs in two major ways:
Survival Regression
-------------------

Currently supported Survival Models are:
Training a Deep Cox Proportional Hazards Model with `auton-survival`

```python
from auton_survival import datasets, preprocessing, models

# Load the SUPPORT Dataset
outcomes, features = datasets.load_dataset("SUPPORT")

# Preprocess (Impute and Scale) the features
features = preprocessing.Preprocessor().fit_transform(features)

# Train a Deep Cox Proportional Hazards (DCPH) model
model = models.cph.DeepCoxPH(layers=[100])
model.fit(features, outcomes.time, outcomes.event)

# Predict risk at specific time horizons.
predictions = model.predict_risk(features, t=[8, 12, 16])
```

### `auton_survival.models.dsm.DeepSurvivalMachines`
### `auton_survival.models.dcm.DeepCoxMixtures`
### `auton_survival.models.cph.DeepCoxPH`


### `auton_survival.estimators`
Expand All @@ -68,32 +82,20 @@ survival regression estimators
Modules to perform standard survival analysis experiments. This module
provides a top-level interface to run `auton-survival` style experiments
of survival analysis, involving cross-validation style experiments with
multiple different survival analysis models at different horizons of
event times.

The module further eases evaluation by automatically computing the
*censoring adjusted* estimates of the Metrics of interest, like
**Time Dependent Concordance Index** and **Brier Score** with **IPCW**
adjustment.
multiple different survival analysis models

```python
# auton_survival Style Cross Validation Experiment.
from auton_survival import datasets
features, outcomes = datasets.load_topcat()

from auton_survival.experiments import SurvivalCVRegressionExperiment

# instantiate an auton_survival Experiment by
# specifying the features and outcomes to use.
experiment = SurvivalCVRegressionExperiment(features, outcomes)
# auton-survival Style Cross Validation Experiment.
from auton_survival.experiments import SurvivalRegressionCV

# Fit the `experiment` object with a Cox Model
experiment.fit(model='cph')
# Define the Hyperparameter grid to perform Cross Validation
hyperparam_grid = {'n_estimators' : [50, 100], 'max_depth' : [3, 5],
'max_features' : ['sqrt', 'log2']}

# Evaluate the performance at time=1 year horizon.
scores = experiment.evaluate(time=1.)
# Train a RSF model with cross-validation using the SurvivalRegressionCV class
model = SurvivalRegressionCV(model='rsf', cv_folds=5, hyperparam_grid=hyperparam_grid)
model.fit(features, outcomes)

print(scores)
```


Expand All @@ -110,6 +112,27 @@ we refer to this task as **phenotyping**. `auton_survival.phenotyping` allows:
reduction on the inpute covariates \( x \) followed by the use of a clustering
algorithm on this representation.

```python
from auton_survival.phenotyping import ClusteringPhenotyper

# Dimensionality reduction using Principal Component Analysis (PCA) to 8 dimensions.
dim_red_method, = 'pca', 8

# We use a Gaussian Mixture Model (GMM) with 3 components and diagonal covariance.
clustering_method, n_clusters = 'gmm', 3

# Initialize the phenotyper with the above hyperparameters.
phenotyper = ClusteringPhenotyper(clustering_method=clustering_method,
dim_red_method=dim_red_method,
n_components=n_components,
n_clusters=n_clusters)
# Fit and infer the phenogroups.
phenotypes = phenotyper.fit_phenotype(features)

# Plot the phenogroup specific Kaplan-Meier survival estimate.
auton_survival.reporting.plot_kaplanmeier(outcomes, phenotypes)
```

- **Factual Phenotyping**: Involves the use of structured latent variable
models, `auton_survival.models.dcm.DeepCoxMixtures` or
`auton_survival.models.dsm.DeepSurvivalMachines` to recover phenogroups that
Expand Down

0 comments on commit bda3e39

Please sign in to comment.