diff --git a/html/auton_survival/datasets.html b/html/auton_survival/datasets.html deleted file mode 100644 index 3f7aac5..0000000 --- a/html/auton_survival/datasets.html +++ /dev/null @@ -1,151 +0,0 @@ - - - - - - -auton_survival.datasets API documentation - - - - - - - - - - - - - -
-
-
-

Module auton_survival.datasets

-
-
-

Utility functions to load standard datasets to train and evaluate the -Deep Survival Machines models.

- -
-
-
-
-
-
-

Functions

-
-
-def increase_censoring(e, t, p, random_seed=0) -
-
-
- -
-
-def load_support() -
-
-

Helper function to load and preprocess the SUPPORT dataset. -The SUPPORT Dataset comes from the Vanderbilt University study -to estimate survival for seriously ill hospitalized adults [1]. -Please refer to http://biostat.mc.vanderbilt.edu/wiki/Main/SupportDesc. -for the original datasource.

-

References

-

[1]: Knaus WA, Harrell FE, Lynn J et al. (1995): The SUPPORT prognostic -model: Objective estimates of survival for seriously ill hospitalized -adults. Annals of Internal Medicine 122:191-203.

- -
-
-def load_synthetic_cf_phenotyping() -
-
-
- -
-
-def load_dataset(dataset='SUPPORT', **kwargs) -
-
-

Helper function to load datasets to test Survival Analysis models. -Currently implemented datasets include:

-

SUPPORT: This dataset comes from the Vanderbilt University study -to estimate survival for seriously ill hospitalized adults [1]. -(Refer to http://biostat.mc.vanderbilt.edu/wiki/Main/SupportDesc. -for the original datasource.)

-

PBC: The Primary biliary cirrhosis dataset [2] is well known -dataset for evaluating survival analysis models with time -dependent covariates.

-

FRAMINGHAM: This dataset is a subset of 4,434 participants of the well -known, ongoing Framingham Heart study [3] for studying epidemiology for -hypertensive and arteriosclerotic cardiovascular disease. It is a popular -dataset for longitudinal survival analysis with time dependent covariates.

-

SYNTHETIC: This is a non-linear censored dataset for counterfactual -time-to-event phenotyping. Introduced in [4], the dataset is generated -such that the treatment effect is heterogenous conditioned on the covariates.

-

References

-

[1]: Knaus WA, Harrell FE, Lynn J et al. (1995): The SUPPORT prognostic -model: Objective estimates of survival for seriously ill hospitalized -adults. Annals of Internal Medicine 122:191-203.

-

[2] Fleming, Thomas R., and David P. Harrington. Counting processes and -survival analysis. Vol. 169. John Wiley & Sons, 2011.

-

[3] Dawber, Thomas R., Gilcin F. Meadors, and Felix E. Moore Jr. -"Epidemiological approaches to heart disease: the Framingham Study." -American Journal of Public Health and the Nations Health 41.3 (1951).

-

[4] Nagpal, C., Goswami M., Dufendach K., and Artur Dubrawski. -"Counterfactual phenotyping for censored Time-to-Events" (2022).

-

Parameters

-
-
dataset : str
-
The choice of dataset to load. Currently implemented is 'SUPPORT', -'PBC' and 'FRAMINGHAM'.
-
**kwargs : dict
-
Dataset specific keyword arguments.
-
-

Returns

-
-
tuple : (np.ndarray, np.ndarray, np.ndarray)
-
A tuple of the form of (x, t, e) where x -are the input covariates, t the event times and - e the censoring indicators.
-
- -
-
-
-
-
-
- -
- - - \ No newline at end of file diff --git a/html/auton_survival/estimators.html b/html/auton_survival/estimators.html deleted file mode 100644 index 921e4c5..0000000 --- a/html/auton_survival/estimators.html +++ /dev/null @@ -1,226 +0,0 @@ - - - - - - -auton_survival.estimators API documentation - - - - - - - - - - - - - -
-
-
-

Module auton_survival.estimators

-
-
-

Utilities to train survival regression models and estimate survival.

- -
-
-
-
-
-
-
-
-

Classes

-
-
-class SurvivalModel -(model, random_seed=0, **hyperparams) -
-
-

Universal interface to train multiple different survival models.

-

Parameters

-
-
model : str
-
-

A string that determines the choice of the surival analysis model. -Survival model choices include:

-
    -
  • dsm : Deep Survival Machines [3] model
  • -
  • dcph : Deep Cox Proportional Hazards [2] model
  • -
  • dcm : Deep Cox Mixtures [4] model
  • -
  • rsf : Random Survival Forests [1] model
  • -
  • cph : Cox Proportional Hazards [2] model
  • -
-
-
random_seed : int
-
Controls the reproducibility of called functions.
-
-

References

-

[1] Hemant Ishwaran et al. Random survival forests. -The annals of applied statistics, 2(3):841–860, 2008.

-

[2] Cox, D. R. (1972). Regression models and life-tables. -Journal of the Royal Statistical Society: Series B (Methodological).

-

[3] Chirag Nagpal, Xinyu Li, and Artur Dubrawski. -Deep survival machines: Fully parametric survival regression and -representation learning for censored data with competing risks. 2020.

-

[4] Nagpal, C., Yadlowsky, S., Rostamzadeh, N., and Heller, K. (2021c). -Deep cox mixtures for survival regression. -In Machine Learning for Healthcare Conference, pages 674–708. PMLR

- -

Methods

-
-
-def fit(self, features, outcomes, vsize=0.15, val_data=None, weights=None, weights_val=None, resample_size=1.0) -
-
-

This method is used to train an instance of the survival model.

-

Parameters

-
-
features : pd.DataFrame
-
a pandas dataframe with rows corresponding to individual samples and -columns as covariates.
-
outcomes : pd.DataFrame
-
a pandas dataframe with columns 'time' and 'event'.
-
vsize : float, default=0.15
-
Amount of data to set aside as the validation set. -Not applicable to 'rsf' and 'cph' models.
-
val_data : tuple
-
A tuple of the validation dataset features and outcomes of 'time' -and 'event'. -If passed, vsize is ignored. -Not applicable to 'rsf' and 'cph' models.
-
weights_train : list or np.array
-
a list or numpy array of importance weights for each sample.
-
weights_val :  list or np.array
-
a list or numpy array of importance weights for each validation -set sample. -Ignored if val_data is None.
-
resample_size : float
-
a float between 0 and 1 that controls the size of the resampled dataset.
-
-

Returns

-
-
self
-
Trained instance of a survival model.
-
- -
-
-def predict_survival(self, features, times) -
-
-

Predict survival probabilities at specified time(s).

-

Parameters

-
-
features : pd.DataFrame
-
a pandas dataframe with rows corresponding to individual samples -and columns as covariates.
-
times : float or list
-
a float or list of the times at which to compute the survival -probability.
-
-

Returns

-
-
np.array : An array of the survival probabilites at each
-
 
-
-

time point in times.

- -
-
-def predict_risk(self, features, times) -
-
-

Predict risk of an outcome occurring within the specified time(s).

-

Parameters

-
-
features : pd.DataFrame
-
a pandas dataframe with rows corresponding to individual samples and -columns as covariates.
-
times : float or list
-
a float or list of the times at which to compute the risk.
-
-

Returns

-
-
np.array
-
numpy array of the outcome risks at each time point in times.
-
- -
-
-
-
-class CounterfactualSurvivalModel -(treated_model, control_model) -
-
-

Universal interface to train multiple different counterfactual -survival models.

- -

Methods

-
-
-def predict_counterfactual_survival(self, features, times) -
-
-
- -
-
-def predict_counterfactual_risk(self, features, times) -
-
-
- -
-
-
-
-
-
- -
- - - \ No newline at end of file diff --git a/html/auton_survival/experiments.html b/html/auton_survival/experiments.html deleted file mode 100644 index aa20eb5..0000000 --- a/html/auton_survival/experiments.html +++ /dev/null @@ -1,242 +0,0 @@ - - - - - - -auton_survival.experiments API documentation - - - - - - - - - - - - - -
-
-
-

Module auton_survival.experiments

-
-
-

Utilities to perform cross-validation.

- -
-
-
-
-
-
-
-
-

Classes

-
-
-class SurvivalRegressionCV -(model='dcph', folds=None, num_folds=5, random_seed=0, hyperparam_grid={}) -
-
-

Universal interface to train Survival Analysis models in a cross- -validation fashion.

-

The model is trained in a CV fashion over the user-specified -hyperparameter grid. Model hyperparameters are selected based on the -user-specified metric.

-

Parameters

-
-
model : str
-
A string that determines the choice of the surival regression model. -Survival model choices include: -- 'dsm' : Deep Survival Machines [3] model -- 'dcph' : Deep Cox Proportional Hazards [2] model -- 'dcm' : Deep Cox Mixtures [4] model -- 'rsf' : Random Survival Forests [1] model -- 'cph' : Cox Proportional Hazards [2] model
-
model : str, default='dcph'
-
Survival regression model name.
-
folds : list, default=None
-
A list of fold assignment values for each sample. -For regular (unnested) cross-validation, folds correspond to train -and validation set. -For nested cross-validation, folds correspond to train and test set.
-
num_folds : int, default=5
-
The number of folds. -Ignored if folds is specified.
-
random_seed : int, default=0
-
Controls reproducibility of results.
-
hyperparam_grid : dict
-
A dictionary that contains the hyperparameters for grid search. -The keys of the dictionary are the hyperparameter names and the -values are lists of hyperparameter values.
-
-

References

-

[1] Hemant Ishwaran et al. Random survival forests. -The annals of applied statistics, 2(3):841–860, 2008. -[2] Cox, D. R. (1972). Regression models and life-tables. -Journal of the Royal Statistical Society: Series B (Methodological). -[3] Chirag Nagpal, Xinyu Li, and Artur Dubrawski. -Deep survival machines: Fully parametric survival regression and -representation learning for censored data with competing risks. 2020. -[4] Nagpal, C., Yadlowsky, S., Rostamzadeh, N., and Heller, K. (2021c). -Deep cox mixtures for survival regression. -In Machine Learning for Healthcare Conference, pages 674–708. PMLR

- -

Methods

-
-
-def fit(self, features, outcomes, horizons, metric='ibs') -
-
-

Fits the survival regression model to the data in a cross- -validation or nested cross-validation fashion.

-

Parameters

-
-
features : pd.DataFrame
-
A pandas dataframe with rows corresponding to individual samples -and columns as covariates.
-
outcomes : pd.DataFrame
-
A pandas dataframe with columns 'time' and 'event' that contain the -survival time and censoring status \delta_i = 1 , respectively.
-
horizons : int or float or list
-
Event-horizons at which to evaluate model performance.
-
metric : str, default='ibs'
-
Metric used to evaluate model performance and tune hyperparameters. -Options include: -- 'auc': Dynamic area under the ROC curve -- 'brs' : Brier Score -- 'ibs' : Integrated Brier Score -- 'ctd' : Concordance Index
-
-

Returns

-

Trained survival regression model(s).

- -
-
-
-
-class CounterfactualSurvivalRegressionCV -(model, cv_folds=5, random_seed=0, hyperparam_grid={}) -
-
-

Universal interface to train Counterfactual Survival Analysis models in a -Cross Validation fashion.

-

Each of the model is trained in a CV fashion over the user specified -hyperparameter grid. The best model (in terms of integrated brier score) -is then selected.

-

Parameters

-
-
model : str
-
A string that determines the choice of the surival analysis model. -Survival model choices include: -- 'dsm' : Deep Survival Machines [3] model -- 'dcph' : Deep Cox Proportional Hazards [2] model -- 'dcm' : Deep Cox Mixtures [4] model -- 'rsf' : Random Survival Forests [1] model -- 'cph' : Cox Proportional Hazards [2] model
-
cv_folds : int
-
Number of folds in the cross validation.
-
random_seed : int
-
Random seed for reproducibility.
-
hyperparam_grid : dict
-
A dictionary that contains the hyperparameters for grid search. -The keys of the dictionary are the hyperparameter names and the -values are lists of hyperparameter values.
-
-

References

-

[1] Hemant Ishwaran et al. Random survival forests. -The annals of applied statistics, 2(3):841–860, 2008.

-

[2] Cox, D. R. (1972). Regression models and life-tables. -Journal of the Royal Statistical Society: Series B (Methodological).

-

[3] Chirag Nagpal, Xinyu Li, and Artur Dubrawski. -Deep survival machines: Fully parametric survival regression and -representation learning for censored data with competing risks. 2020.

-

[4] Nagpal, C., Yadlowsky, S., Rostamzadeh, N., and Heller, K. (2021c). -Deep cox mixtures for survival regression. -In Machine Learning for Healthcare Conference, pages 674–708. PMLR

- -

Methods

-
-
-def fit(self, features, outcomes, interventions, horizons, metric) -
-
-

Fits the Survival Regression Model to the data in a cross- -validation fashion.

-

Parameters

-
-
features : pandas.DataFrame
-
a pandas dataframe containing the features to use as covariates.
-
outcomes : pandas.DataFrame
-
a pandas dataframe containing the survival outcomes. The index of the -dataframe should be the same as the index of the features dataframe. -Should contain a column named 'time' that contains the survival time and -a column named 'event' that contains the censoring status. - \delta_i = 1 if the event is observed.
-
interventions : pandas.Series
-
A pandas series containing the treatment status of each subject. - a_i = 1 if the subject is treated, else is considered control.
-
horizons : int or float or list
-
Event-horizons at which to evaluate model performance.
-
metric : str, default='ibs'
-
Metric used to evaluate model performance and tune hyperparameters. -Options include: -- 'auc': Dynamic area under the ROC curve -- 'brs' : Brier Score -- 'ibs' : Integrated Brier Score -- 'ctd' : Concordance Index
-
-

Returns

-
-
auton_survival.estimators.CounterfactualSurvivalModel:
-
The trained counterfactual survival model.
-
- -
-
-
-
-
-
- -
- - - \ No newline at end of file diff --git a/html/auton_survival/index.html b/html/auton_survival/index.html deleted file mode 100644 index 571655a..0000000 --- a/html/auton_survival/index.html +++ /dev/null @@ -1,521 +0,0 @@ - - - - - - -auton_survival API documentation - - - - - - - - - - - - - -
-
-
-

Package auton_survival

-
-
-

Build Status -    -codecov -    -License: MIT -    -GitHub Repo stars

-


-

The auton-survival Package

-

The python package auton-survival is repository of reusable utilities for projects -involving censored Time-to-Event Data. auton-survival provides a flexible APIs -allowing rapid experimentation including dataset preprocessing, regression, -counterfactual estimation, clustering and phenotyping and propensity adjusted evaluation.

-

For complete details on auton-survival see:

-

White Paper    • Documentation    • Demo Notebooks

-

What is Survival Analysis?

-

Survival Analysis involves estimating when an event of interest, T -would take places given some features or covariates X . In statistics -and ML these scenarious are modelled as regression to estimate the conditional -survival distribution, P(T>t|X) . As compared to typical -regression problems, Survival Analysis differs in two major ways:

-
    -
  • The Event distribution, T has positive support, - T in [0, \infty) .
  • -
  • There is presence of censoring (ie. a large number of instances of data are -lost to follow up.)
  • -
-

-

Figure 1. Illustration of Censoring

-

-

The Auton Survival Package

-

The package auton_survival is repository of reusable utilities for projects -involving censored Time-to-Event Data. auton_survival allows rapid -experimentation including dataset preprocessing, regression, counterfactual -estimation, clustering and phenotyping and propensity-adjusted evaluation.

-

-

Survival Regression

-

auton_survival.models

-

Currently supported Survival Models include:

- -

Training a Deep Cox Proportional Hazards Model with auton-survival:

-
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])
-
-

-

Figure 2. Violation of the Proportional Hazards Assumption

-

auton_survival.estimators [Demo Notebook]

-

This module provides a wrapper SurvivalModel to model -survival datasets with standard survival (time-to-event) analysis methods. -The use of the wrapper allows a simple standard interface for multiple different -survival regression methods.

-

auton_survival.estimators also provides convenient wrappers around other popular -python survival analysis packages to experiment with Random Survival Forests and -Weibull Accelerated Failure Time regression models.

-
from auton_survival import estimators
-
-# Train a Deep Survival Machines model using the SurvivalModel class.
-model = estimators.SurvivalModel(model='dsm')
-model.fit(features, outcomes)
-
-# Predict risk at time horizons.
-predictions = model.predict_risk(features, times=[8, 12, 16])
-
-

auton_survival.experiments [Demo Notebook]

-

Modules to perform standard survival analysis experiments. This module -provides a top-level interface to run auton_survival style experiments -of survival analysis, involving options for cross-validation and -nested cross-validation style experiments with multiple different survival -analysis models.

-

The module supports multiple model peroformance evaluation metrics and further -eases evaluation by automatically computing the censoring adjusted estimates, -such as Time Dependent Concordance Index and Brier Score with IPCW -adjustment.

-
# auton_survival cross-validation experiment.
-from auton_survival.datasets import load_dataset
-
-outcomes, features = load_dataset(dataset='SUPPORT')
-cat_feats = ['sex', 'income', 'race']
-num_feats = ['age', 'resp', 'glucose']
-
-from auton_survival.experiments import SurvivalRegressionCV
-# Instantiate an auton_survival Experiment 
-experiment = SurvivalRegressionCV(model='cph', num_folds=5, 
-                                    hyperparam_grid=hyperparam_grid)
-
-# Fit the `experiment` object with the specified Cox model.
-model = experiment.fit(features, outcomes, metric='ibs',
-                       cat_feats=cat_feats, num_feats=num_feats)
-
-
-

-

Phenotyping And Knowledge Discovery

-

auton_survival.phenotyping [Demo Notebook]

-

auton_survival.phenotyping allows extraction of latent clusters or subgroups -of patients that demonstrate similar outcomes. In the context of this package, -we refer to this task as phenotyping. auton_survival.phenotyping provides -the following phenotyping utilities:

-
    -
  • Intersectional Phenotyping: Recovers groups, or phenotypes, of individuals -over exhaustive combinations of user-specified categorical and numerical features.
  • -
-
from auton_survival.phenotyping import IntersectionalPhenotyper
-
-# ’ca’ is cancer status. ’age’ is binned into two quantiles.
-phenotyper = IntersectionalPhenotyper(num_vars_quantiles=(0, .5, 1.0),
-cat_vars=['ca'], num_vars=['age'])
-phenotypes = phenotyper.fit_predict(features)
-
-
    -
  • Unsupervised Phenotyping: Identifies groups of individuals based on structured -similarity in the fature space by first performing dimensionality reduction of the -input covariates, followed by clustering. The estimated probability of an individual -to belong to a latent group is computed as the distance to the cluster normalized by -the sum of distance to other clusters.
  • -
-
from auton_survival.phenotyping import ClusteringPhenotyper
-
-# Dimensionality reduction using Principal Component Analysis (PCA) to 8 dimensions.
-dim_red_method, = 'pca', 
-# We use a Gaussian Mixture Model (GMM) with 3 components and diagonal covariance.
-clustering_method, n_clusters = 'gmm', 
-
-# 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_predict(features)
-
-
    -
  • Supervised Phenotyping: Identifies latent groups of individuals with similar -survival outcomes. This approach can be performed as a direct consequence of training -the Deep Survival Machines and Deep Cox Mixtures latent variable survival -regression estimators using the predict latent z method.
  • -
-
from auton_survival.models.dcm import DeepCoxMixtures
-
-# Instantiate a DCM Model with 3 phenogroups and a single hidden layer with size 100.
-model = DeepCoxMixtures(k = 3, layers = [100])
-model.fit(features, outcomes.time, outcomes.event, iters = 100, learning_rate = 1e-4)
-
-# Infer the latent Phenotpyes
-latent_z_prob = model.predict_latent_z(features)
-phenotypings = latent_z_prob.argmax(axis=1)
-
-
    -
  • Counterfactual Phenotyping: Identifies groups of individuals that demonstrate -heterogenous treatment effects. That is, the learnt phenogroups have differential -response to a specific intervention. Relies on the specially designed -DeepCoxMixturesHeterogenousEffects latent variable model.
  • -
-
from auton_survival.models.cmhe DeepCoxMixturesHeterogenousEffects
-
-# Instantiate the CMHE model
-model = DeepCoxMixturesHeterogenousEffects(random_seed=random_seed, k=k, g=g, layers=layers)
-
-model = model.fit(features, outcomes.time, outcomes.event, intervention)
-zeta_probs = model.predict_latent_phi(x_tr)
-zeta = np.argmax(zeta_probs, axis=1)
-
-
    -
  • Virtual Twins Phenotyping: Phenotyper that estimates the potential outcomes under treatment and -control using a counterfactual Deep Cox Proportional Hazards model, -followed by regressing the difference of the estimated counterfactual -Restricted Mean Survival Times using a Random Forest regressor.
  • -
-
from auton_survival.phenotyping import SurvivalVirtualTwins
-
-# Instantiate the Survival Virtual Twins
-model = SurvivalVirtualTwins(horizon=365)
-# Infer the estimated counterfactual phenotype probability.
-phenotypes = model.fit_predict(features, outcomes.time, outcomes.event, interventions)
-
-

DAG representations of the unsupervised, supervised, and counterfactual probabilitic -phenotypers in auton-survival are shown in the below figure. X represents the -covariates, T the time-to-event and Z is the phenotype to be inferred.

-

A. Unsupervised Phenotyping    B. Supervised Phenotyping    C. Counterfactual Phenotyping

-

-

Figure 3. DAG Representations of the Phenotypers in auton-survival

-

-

Evaluation And Reporting

-

auton_survival.metrics

-

Helper functions to generate standard reports for common Survival Analysis tasks with support for bootstrapped confidence intervals.

-
    -
  • Regression Metric: Metrics for survival model performance evaluation:
      -
    • Brier Score
    • -
    • Integrated Brier Score
    • -
    • Area under the Receiver Operating Characteristic (ROC) Curve
    • -
    • Concordance Index
    • -
    -
  • -
-
from auton_survival.metrics import survival_regression_metric
-
-# Infer event-free survival probability from model
-predictions = model.predict_survival(features, times)
-# Compute Brier Score, Integrated Brier Score
-# Area Under ROC Curve and Time Dependent Concordance Index
-metrics = ['brs', 'ibs', 'auc', 'ctd']
-score = survival_regression_metric(metric='brs', outcomes_train, 
-                                   outcomes_test, predictions_test,
-                                   times=times)
-
-
    -
  • Treatment Effect: Used to compare treatment arms by computing the difference in the following metrics for treatment and control groups:
      -
    • Time at Risk (TaR) (left)
    • -
    • Risk at Time (center)
    • -
    • Restricted Mean Survival Time (RMST) (right)
    • -
    -
  • -
-

A. Time at Risk                                                  B. Risk at Time                                                  C. RMST

-

- - -

-

Figure 4. Graphical representation of the Treatment Effect Metrics

-
from auton_survival.metrics import survival_diff_metric
-
-# Compute the difference in RMST, Risk at Time, and TaR between treatment and control groups
-metrics = ['restricted_mean', 'survival_at', 'tar']
-effect = survival_diff_metric(metric='restricted_mean', outcomes=outcomes
-                              treatment_indicator=treatment_indicator, 
-                              weights=None, horizon=120, n_bootstrap=500)
-
-
    -
  • Phenotype Purity: Used to measure a phenotyper’s ability to extract subgroups, or phenogroups, with differential survival rates by fitting a Kaplan-Meier estimator within each phenogroup followed by estimating the Brier Score or Integrated Brier Score within each phenogroup.
  • -
-
from auton_survival.metrics import phenotype_purity
-
-# Measure phenotype purity using the Brier Score at event horizons of 1, 2 and 5 years.
-phenotype_purity(phenotypes, outcomes, strategy='instantaneous', 
-                 time=[365,730,1825])
-# Measure phenotype purity using the Integrated Brier score at an event horizon of 5 years.
-phenotype_purity(phenotypes, outcomes, strategy='integrated', time=1825)
-
-

auton_survival.reporting

-

Helper functions to generate plots for Survival Analysis tasks.

-
# Plot separate Kaplan Meier survival estimates for phenogroups.
-auton_survival.reporting.plot_kaplanmeier(outcomes, groups=phenotypes)
-
-# Plot separate Nelson-Aalen estimates for phenogroups.
-auton_survival.reporting.plot_nelsonaalen(outcomes, groups=phenotypes)
-
-

-

Dataset Loading And Preprocessing

-

Helper functions to load and preprocess various time-to-event data like the -popular SUPPORT, FRAMINGHAM and PBC dataset for survival analysis.

-

auton_survival.datasets

-
# Load the SUPPORT Dataset
-from auton_survival.datasets import load_dataset
-datasets = ['SUPPORT', 'PBC', 'FRAMINGHAM', 'MNIST', 'SYNTHETIC']
-features, outcomes = datasets.load_dataset('SUPPORT')
-
-

auton_survival.preprocessing

-

This module provides a flexible API to perform imputation and data -normalization for downstream machine learning models. The module has -3 distinct classes, Scaler, Imputer and Preprocessor. The Preprocessor -class is a composite transform that does both Imputing and Scaling with -a single function call.

-
# Preprocessing loaded Datasets
-from auton_survival import datasets
-features, outcomes = datasets.load_topcat()
-
-from auton_survival.preprocessing import Preprocessing
-features = Preprocessor().fit_transform(features,
-                    cat_feats=['GENDER', 'ETHNICITY', 'SMOKE'],
-                    num_feats=['height', 'weight'])
-
-# The `cat_feats` and `num_feats` lists would contain all the categorical and numerical features in the dataset.
-
-
-

-

Citing And References

-

Please cite the following paper if you use the auton-survival package:

-

[1] auton-survival: -an Open-Source Package for Regression, Counterfactual Estimation, Evaluation and Phenotyping with Censored Time-to-Event Data. arXiv (2022)

-
  @article{auton-survival,
-  title={auton-survival: an Open-Source Package for Regression, Counterfactual Estimation, Evaluation and Phenotyping with Censored Time-to-Event Data},
-  author={Nagpal, Chirag and Potosnak, Willa and Dubrawski, Artur},
-  year={2022},
-  publisher={arXiv}
-  }
-
-

Additionally, auton-survival implements the following methodologies:

-

[2] Counterfactual Phenotyping with Censored Time-to-Events (2022)

-
  @article{nagpal2022counterfactual,
-  title={Counterfactual Phenotyping with Censored Time-to-Events},
-  author={Nagpal, Chirag and Goswami, Mononito and Dufendach, Keith and Dubrawski, Artur},
-  journal={arXiv preprint arXiv:2202.11089},
-  year={2022}
-  }
-
-

[3] Deep Cox Mixtures for Survival Regression. Conference on Machine Learning for -Healthcare (2021)

-
  @inproceedings{nagpal2021dcm,
-  title={Deep Cox mixtures for survival regression},
-  author={Nagpal, Chirag and Yadlowsky, Steve and Rostamzadeh, Negar and Heller, Katherine},
-  booktitle={Machine Learning for Healthcare Conference},
-  pages={674--708},
-  year={2021},
-  organization={PMLR}
-  }
-
-

[4] Deep Parametric Time-to-Event Regression with Time-Varying Covariates. AAAI -Spring Symposium (2021)

-
  @InProceedings{pmlr-v146-nagpal21a,
-  title={Deep Parametric Time-to-Event Regression with Time-Varying Covariates},
-  author={Nagpal, Chirag and Jeanselme, Vincent and Dubrawski, Artur},
-  booktitle={Proceedings of AAAI Spring Symposium on Survival Prediction - Algorithms, Challenges, and Applications 2021},
-  series={Proceedings of Machine Learning Research},
-  publisher={PMLR},
-  }
-
-

[5] Deep Survival Machines: -Fully Parametric Survival Regression and -Representation Learning for Censored Data with Competing Risks. -IEEE Journal of Biomedical and Health Informatics (2021)

-
  @article{nagpal2021dsm,
-  title={Deep survival machines: Fully parametric survival regression and representation learning for censored data with competing risks},
-  author={Nagpal, Chirag and Li, Xinyu and Dubrawski, Artur},
-  journal={IEEE Journal of Biomedical and Health Informatics},
-  volume={25},
-  number={8},
-  pages={3163--3175},
-  year={2021},
-  publisher={IEEE}
-  }
-
-

-

Compatibility And Installation

-

auton_survival requires python 3.5+ and pytorch 1.1+.

-

To evaluate performance using standard metrics -auton_survival requires scikit-survival.

-

To install auton_survival, clone the following git repository:

-
foo@bar:~$ git clone https://github.com/autonlab/auton-survival.git
-foo@bar:~$ pip install -r requirements.txt
-
-

-

Contributing

-

auton_survival is on GitHub. Bug reports and pull requests are welcome.

-

-

License

-

MIT License

-

Copyright (c) 2022 Carnegie Mellon University, Auton Lab

-

Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions:

-

The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software.

-

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE.

-

-

-






-




- -
-
-

Sub-modules

-
-
auton_survival.datasets
-
-

Utility functions to load standard datasets to train and evaluate the -Deep Survival Machines models.

-
-
auton_survival.estimators
-
-

Utilities to train survival regression models and estimate survival.

-
-
auton_survival.experiments
-
-

Utilities to perform cross-validation.

-
-
auton_survival.metrics
-
-

Tools to compute metrics used to assess survival outcomes and survival -model performance.

-
-
auton_survival.models
-
-
-
-
auton_survival.phenotyping
-
-

Utilities to phenotype individuals based on similar survival -characteristics.

-
-
auton_survival.preprocessing
-
-
-
-
auton_survival.reporting
-
-
-
-
auton_survival.utils
-
-
-
-
-
-
-
-
-
-
-
-
- -
- - - \ No newline at end of file diff --git a/html/auton_survival/metrics.html b/html/auton_survival/metrics.html deleted file mode 100644 index 8c8bb96..0000000 --- a/html/auton_survival/metrics.html +++ /dev/null @@ -1,192 +0,0 @@ - - - - - - -auton_survival.metrics API documentation - - - - - - - - - - - - - -
-
-
-

Module auton_survival.metrics

-
-
-

Tools to compute metrics used to assess survival outcomes and survival -model performance.

- -
-
-
-
-
-
-

Functions

-
-
-def treatment_effect(metric, outcomes, treatment_indicator, weights=None, horizons=None, risk_levels=None, interpolate=True, weights_clip=0.01, n_bootstrap=None, size_bootstrap=1.0, random_seed=0) -
-
-

Compute metrics for comparing population level survival outcomes -across treatment arms.

-

Parameters

-
-
metric : str
-
 
-
The metric to evalute for comparing survival outcomes.
-
Options include:
-
- median
-
- tar
-
- hazard_ratio
-
- restricted_mean
-
- survival_at
-
outcomes : pd.DataFrame
-
A pandas dataframe with rows corresponding to individual samples -and columns 'time' and 'event'.
-
treatment_indicator : np.array
-
Boolean numpy array of treatment indicators. True means individual -was assigned a specific treatment.
-
weights : pd.Series, default=None
-
Treatment assignment propensity scores, \widehat{\mathbb{P}}(A|X=x) . -If None, all weights are set to 0.5 . Default is None.
-
horizons : float or int or array of floats or ints, default=None
-
Time horizon(s) at which to compute the metric. -Must be specified for metric 'restricted_mean' and 'survival_at'. -For 'hazard_ratio' this is ignored.
-
risk_levels : float or array of floats
-
The risk level (0-1) at which to compare times between treatment arms. -Must be specified for metric 'tar'. -Ignored for other metrics.
-
interpolate : bool, default=True
-
Whether to interpolate the survival curves.
-
weights_clip : float
-
Weights below this value are clipped. This is to ensure IPTW -estimation is numerically stable. -Large weights can result in estimator with high variance.
-
n_bootstrap : int, default=None
-
The number of bootstrap samples to use. -If None, bootrapping is not performed.
-
size_bootstrap : float, default=1.0
-
The fraction of the population to sample for each bootstrap sample.
-
random_seed : int, default=0
-
Controls the reproducibility random sampling for bootstrapping.
-
-

Returns

-

float or list: The metric value(s) for the specified metric.

- -
-
-def survival_regression_metric(metric, outcomes, predictions, times, outcomes_train=None) -
-
-

Compute metrics to assess survival model performance.

-

Parameters

-
-
metric : string
-
Measure used to assess the survival regression model performance. -Options include: -- brs : brier score -- ibs : integrated brier score -- auc: cumulative dynamic area under the curve -- ctd : concordance index inverse probability of censoring -weights (ipcw)
-
outcomes : pd.DataFrame
-
A pandas dataframe with rows corresponding to individual samples and -columns 'time' and 'event' for evaluation data.
-
predictions : np.array
-
A numpy array of survival time predictions for the samples.
-
times : np.array
-
The time points at which to compute metric value(s).
-
outcomes_train : pd.DataFrame
-
A pandas dataframe with rows corresponding to individual samples and -columns 'time' and 'event' for training data.
-
-

Returns

-

float: The metric value for the specified metric.

- -
-
-def phenotype_purity(phenotypes_train, outcomes_train, phenotypes_test=None, outcomes_test=None, strategy='instantaneous', horizons=None, bootstrap=None) -
-
-

Compute the brier score to assess survival model performance -for phenotypes.

-

Parameters

-
-
phenotypes_train : np.array
-
A numpy array containing an array of integers that define subgroups -for the train set.
-
outcomes_train : pd.DataFrame
-
A pandas dataframe with rows corresponding to individual samples and -columns 'time' and 'event' for the train set.
-
phenotypes_test : np.array
-
A numpy array containing an array of integers that define subgroups -for the test set.
-
outcomes_test : pd.DataFrame
-
A pandas dataframe with rows corresponding to individual samples and -columns 'time' and 'event' for the test set.
-
strategy : string, default='instantaneous'
-
Options include: -- instantaneous : Compute the brier score. -- integrated : Compute the integrated brier score.
-
horizons : float or int or an array of floats or ints, default=None
-
Event horizon(s) at which to compute the metric
-
bootstrap : integer, default=None
-
The number of bootstrap iterations.
-
-

Returns

-
-
list:
-
Columns are metric values computed for each event horizon. -If bootstrapping, rows are bootstrap results.
-
- -
-
-
-
-
-
- -
- - - \ No newline at end of file diff --git a/html/auton_survival/models/cmhe/cmhe_torch.html b/html/auton_survival/models/cmhe/cmhe_torch.html deleted file mode 100644 index e3a545f..0000000 --- a/html/auton_survival/models/cmhe/cmhe_torch.html +++ /dev/null @@ -1,162 +0,0 @@ - - - - - - -auton_survival.models.cmhe.cmhe_torch API documentation - - - - - - - - - - - - - -
-
-
-

Module auton_survival.models.cmhe.cmhe_torch

-
-
- -
-
-
-
-
-
-
-
-

Classes

-
-
-class DeepCMHETorch -(k, g, inputdim, layers=None, gamma=100, smoothing_factor=0.0001, gate_l2_penalty=0.0001, optimizer='Adam') -
-
-

PyTorch model definition of the Cox Mixture with Hereogenous Effects Model.

-

Cox Mixtures with Heterogenous Effects involves the assuming that the -base survival rates are independent of the treatment effect. -of the individual to be a mixture of K Cox Models. Conditioned on each -subgroup Z=k; the PH assumptions are assumed to hold and the baseline -hazard rates is determined non-parametrically using an spline-interpolated -Breslow's estimator.

-

Initializes internal Module state, shared by both nn.Module and ScriptModule.

- -

Class variables

-
-
var dump_patches : bool
-
-
-
-
var training : bool
-
-
-
-
-

Methods

-
-
-def forward(self, x, a) ‑> Callable[..., Any] -
-
-
- -
-
-
-
-class IdentifiableLinear -(in_features, out_features, bias=True) -
-
-

Softmax and LogSoftmax with K classes in pytorch are over specfied and lead to -issues of mis-identifiability. This class is a wrapper for linear layers that -are correctly specified with K-1 columns. The output of this layer for the Kth -class is all zeros. This allows direct application of pytorch.nn.LogSoftmax -and pytorch.nn.Softmax.

-

Initializes internal Module state, shared by both nn.Module and ScriptModule.

- -

Class variables

-
-
var dump_patches : bool
-
-
-
-
var training : bool
-
-
-
-
-

Instance variables

-
-
var weight
-
-
- -
-
-

Methods

-
-
-def forward(self, x) ‑> Callable[..., Any] -
-
-
- -
-
-
-
-
-
- -
- - - \ No newline at end of file diff --git a/html/auton_survival/models/cmhe/cmhe_utilities.html b/html/auton_survival/models/cmhe/cmhe_utilities.html deleted file mode 100644 index f211f51..0000000 --- a/html/auton_survival/models/cmhe/cmhe_utilities.html +++ /dev/null @@ -1,251 +0,0 @@ - - - - - - -auton_survival.models.cmhe.cmhe_utilities API documentation - - - - - - - - - - - - - -
-
-
-

Module auton_survival.models.cmhe.cmhe_utilities

-
-
- -
-
-
-
-
-
-

Functions

-
-
-def randargmax(b, **kw) -
-
-

a random tie-breaking argmax

- -
-
-def partial_ll_loss(lrisks, tb, eb, eps=0.01) -
-
-
- -
-
-def fit_spline(t, surv, smoothing_factor=0.0001) -
-
-
- -
-
-def smooth_bl_survival(breslow, smoothing_factor) -
-
-
- -
-
-def get_probability_(lrisks, ts, spl) -
-
-
- -
-
-def get_survival_(lrisks, ts, spl) -
-
-
- -
-
-def get_probability(lrisks, breslow_splines, t) -
-
-
- -
-
-def get_survival(lrisks, breslow_splines, t) -
-
-
- -
-
-def get_posteriors(probs) -
-
-
- -
-
-def get_hard_z(gates_prob) -
-
-
- -
-
-def sample_hard_z(gates_prob) -
-
-
- -
-
-def repair_probs(probs) -
-
-
- -
-
-def get_likelihood(model, breslow_splines, x, t, e, a) -
-
-
- -
-
-def q_function(model, x, t, e, a, log_likelihoods, typ='soft') -
-
-
- -
-
-def e_step(model, breslow_splines, x, t, e, a) -
-
-
- -
-
-def m_step(model, optimizer, x, t, e, a, log_likelihoods, typ='soft') -
-
-
- -
-
-def fit_breslow(model, x, t, e, a, log_likelihoods=None, smoothing_factor=0.0001, typ='soft') -
-
-
- -
-
-def train_step(model, x, t, e, a, breslow_splines, optimizer, bs=256, seed=100, typ='soft', use_posteriors=False, update_splines_after=10, smoothing_factor=0.0001) -
-
-
- -
-
-def test_step(model, x, t, e, a, breslow_splines, loss='q', typ='soft') -
-
-
- -
-
-def train_cmhe(model, train_data, val_data, epochs=50, patience=2, vloss='q', bs=256, typ='soft', lr=0.001, use_posteriors=False, debug=False, return_losses=False, update_splines_after=1, smoothing_factor=0.0001, random_seed=0) -
-
-
- -
-
-def predict_survival(model, x, a, t) -
-
-
- -
-
-def predict_latent_z(model, x) -
-
-
- -
-
-def predict_latent_phi(model, x) -
-
-
- -
-
-
-
-
-
- -
- - - \ No newline at end of file diff --git a/html/auton_survival/models/cmhe/index.html b/html/auton_survival/models/cmhe/index.html deleted file mode 100644 index eee701b..0000000 --- a/html/auton_survival/models/cmhe/index.html +++ /dev/null @@ -1,254 +0,0 @@ - - - - - - -auton_survival.models.cmhe API documentation - - - - - - - - - - - - - -
-
-
-

Module auton_survival.models.cmhe

-
-
-

Cox Mixtures With Heterogenous Effects

-

Build Status -    -codecov -    -License: MIT -    -GitHub Repo stars

-

-

-

Cox Mixture with Heterogenous Effects (CMHE) is a flexible approach to -recover counterfactual phenotypes of individuals that demonstrate heterogneous -effects to an intervention in terms of censored Time-to-Event outcomes. -CMHE is not restricted by the strong Cox Proportional Hazards assumption -or any parametric assumption on the time to event distributions. CMHE achieves -this by describing each individual as belonging to two different latent groups, - \mathcal{Z} that mediate the base survival rate and \phi the effect -of the treatment. CMHE can also be employed to model individual level -counterfactuals or for standard factual survival regression.

-

For full details on Cox Mixtures with Heterogenous Effects, please refer to -our preprint:

-

Counterfactual Phenotyping with Censored Time-to-Events, arXiv preprint, -C. Nagpal, M. Goswami, K. Dufendach, A. Dubrawski

-


-

Example Usage

-
>>> from auton_survival import DeepCoxMixturesHeterogenousEffects
->>> from auton_survival import datasets
->>> # load the SYNTHETIC dataset.
->>> x, t, e, a = datasets.load_dataset('SYNTHETIC')
->>> # instantiate a Cox Mixtures with Heterogenous Effects model.
->>> model = DeepCoxMixturesHeterogenousEffects()
->>> # fit the model to the dataset.
->>> model.fit(x, t, e, a)
->>> # estimate the predicted risks at the time
->>> model.predict_risk(x, 10)
->>> # estimate the treatment effect phenogroups
->>> model.predict_latent_phi(x)
-
- -
-
-

Sub-modules

-
-
auton_survival.models.cmhe.cmhe_torch
-
-
-
-
auton_survival.models.cmhe.cmhe_utilities
-
-
-
-
-
-
-
-
-
-
-

Classes

-
-
-class DeepCoxMixturesHeterogenousEffects -(k, g, layers=None, gamma=100, smoothing_factor=0.0001, gate_l2_penalty=0.0001, random_seed=0) -
-
-

A Deep Cox Mixtures with Heterogenous Effects model.

-

This is the main interface to a Deep Cox Mixture with Heterogenous Effects. -A model is instantiated with approporiate set of hyperparameters and -fit on numpy arrays consisting of the features, event/censoring times -and the event/censoring indicators.

-

For full details on Deep Cox Mixture, refer to the paper [1].

-

References

-

[1] Nagpal, C., Goswami M., Dufendach K., and Artur Dubrawski. -"Counterfactual phenotyping for censored Time-to-Events" (2022).

-

Parameters

-
-
k : int
-
The number of underlying base survival phenotypes.
-
g : int
-
The number of underlying treatment effect phenotypes.
-
layers : list
-
A list of integers consisting of the number of neurons in each -hidden layer.
-
gate_l2_penalty : float
-
Strength of the l2 penalty term for the gate layers. -Higher means stronger regularization.
-
random_seed : int
-
Controls the reproducibility of called functions.
-
-

Example

-
>>> from auton_survival import DeepCoxMixturesHeterogenousEffects
->>> model = DeepCoxMixturesHeterogenousEffects(k=2, g=3)
->>> model.fit(x, t, e, a)
-
- -

Methods

-
-
-def fit(self, x, t, e, a, vsize=0.15, val_data=None, iters=1, learning_rate=0.001, batch_size=100, patience=2, optimizer='Adam') -
-
-

This method is used to train an instance of the DSM model.

-

Parameters

-
-
x : np.ndarray
-
A numpy array of the input features, x .
-
t : np.ndarray
-
A numpy array of the event/censoring times, t .
-
e : np.ndarray
-
A numpy array of the event/censoring indicators, \delta . - \delta = 1 means the event took place.
-
a : np.ndarray
-
A numpy array of the treatment assignment indicators, a . - a = 1 means the individual was treated.
-
vsize : float
-
Amount of data to set aside as the validation set.
-
val_data : tuple
-
A tuple of the validation dataset. If passed vsize is ignored.
-
iters : int
-
The maximum number of training iterations on the training dataset.
-
learning_rate : float
-
The learning rate for the Adam optimizer.
-
batch_size : int
-
learning is performed on mini-batches of input data. this parameter -specifies the size of each mini-batch.
-
optimizer : str
-
The choice of the gradient based optimization method. One of -'Adam', 'RMSProp' or 'SGD'.
-
- -
-
-def predict_risk(self, x, a, t=None) -
-
-
- -
-
-def predict_survival(self, x, a, t=None) -
-
-

Returns the estimated survival probability at time t , - \widehat{\mathbb{P}}(T > t|X) for some input data x .

-

Parameters

-
-
x : np.ndarray
-
A numpy array of the input features, x .
-
a : np.ndarray
-
A numpy array of the treatmeant assignment, a .
-
t : list or float
-
a list or float of the times at which survival probability is -to be computed
-
-

Returns

-
-
np.array
-
numpy array of the survival probabilites at each time in t.
-
- -
-
-def predict_latent_z(self, x) -
-
-

Returns the estimated latent base survival group z given the confounders x .

- -
-
-def predict_latent_phi(self, x) -
-
-

Returns the estimated latent treatment effect group \phi given the confounders x .

- -
-
-
-
-
-
- -
- - - \ No newline at end of file diff --git a/html/auton_survival/models/cph/dcph_torch.html b/html/auton_survival/models/cph/dcph_torch.html deleted file mode 100644 index 041ce7c..0000000 --- a/html/auton_survival/models/cph/dcph_torch.html +++ /dev/null @@ -1,179 +0,0 @@ - - - - - - -auton_survival.models.cph.dcph_torch API documentation - - - - - - - - - - - - - -
-
-
-

Module auton_survival.models.cph.dcph_torch

-
-
- -
-
-
-
-
-
-
-
-

Classes

-
-
-class DeepCoxPHTorch -(inputdim, layers=None, optimizer='Adam') -
-
-

Base class for all neural network modules.

-

Your models should also subclass this class.

-

Modules can also contain other Modules, allowing to nest them in -a tree structure. You can assign the submodules as regular attributes::

-
import torch.nn as nn
-import torch.nn.functional as F
-
-class Model(nn.Module):
-    def __init__(self):
-        super(Model, self).__init__()
-        self.conv1 = nn.Conv2d(1, 20, 5)
-        self.conv2 = nn.Conv2d(20, 20, 5)
-
-    def forward(self, x):
-        x = F.relu(self.conv1(x))
-        return F.relu(self.conv2(x))
-
-

Submodules assigned in this way will be registered, and will have their -parameters converted too when you call :meth:to, etc.

-

Initializes internal Module state, shared by both nn.Module and ScriptModule.

- -

Class variables

-
-
var dump_patches : bool
-
-
-
-
var training : bool
-
-
-
-
-

Methods

-
-
-def forward(self, x) ‑> Callable[..., Any] -
-
-
- -
-
-
-
-class DeepRecurrentCoxPHTorch -(inputdim, typ='LSTM', layers=1, hidden=None, optimizer='Adam') -
-
-

Base class for all neural network modules.

-

Your models should also subclass this class.

-

Modules can also contain other Modules, allowing to nest them in -a tree structure. You can assign the submodules as regular attributes::

-
import torch.nn as nn
-import torch.nn.functional as F
-
-class Model(nn.Module):
-    def __init__(self):
-        super(Model, self).__init__()
-        self.conv1 = nn.Conv2d(1, 20, 5)
-        self.conv2 = nn.Conv2d(20, 20, 5)
-
-    def forward(self, x):
-        x = F.relu(self.conv1(x))
-        return F.relu(self.conv2(x))
-
-

Submodules assigned in this way will be registered, and will have their -parameters converted too when you call :meth:to, etc.

-

Initializes internal Module state, shared by both nn.Module and ScriptModule.

- -

Class variables

-
-
var dump_patches : bool
-
-
-
-
var training : bool
-
-
-
-
-

Methods

-
-
-def forward(self, x) ‑> Callable[..., Any] -
-
-
- -
-
-
-
-
-
- -
- - - \ No newline at end of file diff --git a/html/auton_survival/models/cph/dcph_utilities.html b/html/auton_survival/models/cph/dcph_utilities.html deleted file mode 100644 index 628581d..0000000 --- a/html/auton_survival/models/cph/dcph_utilities.html +++ /dev/null @@ -1,123 +0,0 @@ - - - - - - -auton_survival.models.cph.dcph_utilities API documentation - - - - - - - - - - - - - -
-
-
-

Module auton_survival.models.cph.dcph_utilities

-
-
- -
-
-
-
-
-
-

Functions

-
-
-def randargmax(b, **kw) -
-
-

a random tie-breaking argmax

- -
-
-def partial_ll_loss(lrisks, tb, eb, eps=0.001) -
-
-
- -
-
-def fit_breslow(model, x, t, e) -
-
-
- -
-
-def train_step(model, x, t, e, optimizer, bs=256, seed=100) -
-
-
- -
-
-def test_step(model, x, t, e) -
-
-
- -
-
-def train_dcph(model, train_data, val_data, epochs=50, patience=3, bs=256, lr=0.001, debug=False, random_seed=0, return_losses=False) -
-
-
- -
-
-def predict_survival(model, x, t=None) -
-
-
- -
-
-
-
-
-
- -
- - - \ No newline at end of file diff --git a/html/auton_survival/models/cph/index.html b/html/auton_survival/models/cph/index.html deleted file mode 100644 index 4ff79e7..0000000 --- a/html/auton_survival/models/cph/index.html +++ /dev/null @@ -1,286 +0,0 @@ - - - - - - -auton_survival.models.cph API documentation - - - - - - - - - - - - - -
-
-
-

Module auton_survival.models.cph

-
-
-

Deep Cox Proportional Hazards Model

- -
-
-

Sub-modules

-
-
auton_survival.models.cph.dcph_torch
-
-
-
-
auton_survival.models.cph.dcph_utilities
-
-
-
-
-
-
-
-
-
-
-

Classes

-
-
-class DeepCoxPH -(layers=None, random_seed=0) -
-
-

A Deep Cox Proportional Hazards model.

-

This is the main interface to a Deep Cox Proportional Hazards model. -A model is instantiated with approporiate set of hyperparameters and -fit on numpy arrays consisting of the features, event/censoring times -and the event/censoring indicators.

-

For full details on Deep Cox Proportional Hazards, refer [1], [2].

-

References

-

[1] DeepSurv: personalized -treatment recommender system using a Cox proportional hazards -deep neural network. BMC medical research methodology (2018)

-

[2] -A neural network model for survival data. Statistics in medicine (1995)

-

Parameters

-
-
k : int
-
The number of underlying Cox distributions.
-
layers : list
-
A list of integers consisting of the number of neurons in each -hidden layer.
-
random_seed : int
-
Controls the reproducibility of called functions.
-
-

Example

-
>>> from auton_survival import DeepCoxPH
->>> model = DeepCoxPH()
->>> model.fit(x, t, e)
-
- -

Methods

-
-
-def fit(self, x, t, e, vsize=0.15, val_data=None, iters=1, learning_rate=0.001, batch_size=100, optimizer='Adam') -
-
-

This method is used to train an instance of the DSM model.

-

Parameters

-
-
x : np.ndarray
-
A numpy array of the input features, x .
-
t : np.ndarray
-
A numpy array of the event/censoring times, t .
-
e : np.ndarray
-
A numpy array of the event/censoring indicators, \delta . - \delta = 1 means the event took place.
-
vsize : float
-
Amount of data to set aside as the validation set.
-
val_data : tuple
-
A tuple of the validation dataset. If passed vsize is ignored.
-
iters : int
-
The maximum number of training iterations on the training dataset.
-
learning_rate : float
-
The learning rate for the Adam optimizer.
-
batch_size : int
-
learning is performed on mini-batches of input data. this parameter -specifies the size of each mini-batch.
-
optimizer : str
-
The choice of the gradient based optimization method. One of -'Adam', 'RMSProp' or 'SGD'.
-
- -
-
-def predict_risk(self, x, t=None) -
-
-
- -
-
-def predict_survival(self, x, t=None) -
-
-

Returns the estimated survival probability at time t , - \widehat{\mathbb{P}}(T > t|X) for some input data x .

-

Parameters

-
-
x : np.ndarray
-
A numpy array of the input features, x .
-
t : list or float
-
a list or float of the times at which survival probability is -to be computed
-
-

Returns

-
-
np.array
-
numpy array of the survival probabilites at each time in t.
-
- -
-
-
-
-class DeepRecurrentCoxPH -(layers=None, hidden=None, typ='LSTM', random_seed=0) -
-
-

A deep recurrent Cox PH model.

-

This model is based on the paper: - Leveraging -Deep Representations of Radiology Reports in Survival Analysis for -Predicting Heart Failure Patient Mortality. NAACL (2021)

-

Parameters

-
-
k : int
-
The number of underlying Cox distributions.
-
layers : list
-
A list of integers consisting of the number of neurons in each -hidden layer.
-
random_seed : int
-
 
-
-

Controls the reproducibility of called functions. -Example

-
-
>>> from dsm.contrib import DeepRecurrentCoxPH
->>> model = DeepRecurrentCoxPH()
->>> model.fit(x, t, e)
-
- -

Methods

-
-
-def fit(self, x, t, e, vsize=0.15, val_data=None, iters=1, learning_rate=0.001, batch_size=100, optimizer='Adam') -
-
-

-Inherited from: -DeepCoxPH.fit -

-

This method is used to train an instance of the DSM model.

-

Parameters

-
-
x : np.ndarray
-
A numpy array of the input features, x .
-
t : np.ndarray
-
A numpy array of the event/censoring times, t .
-
e : np.ndarray
-
A numpy array of the event/censoring indicators, \delta . - \delta = 1 means the event took place.
-
vsize : float
-
Amount of data to set aside as the validation set.
-
val_data : tuple
-
A tuple of the validation dataset. If passed vsize is ignored.
-
iters : int
-
The maximum number of training iterations on the training dataset.
-
learning_rate : float
-
The learning rate for the Adam optimizer.
-
batch_size : int
-
learning is performed on mini-batches of input data. this parameter -specifies the size of each mini-batch.
-
optimizer : str
-
The choice of the gradient based optimization method. One of -'Adam', 'RMSProp' or 'SGD'.
-
-
-
-def predict_survival(self, x, t=None) -
-
-

-Inherited from: -DeepCoxPH.predict_survival -

-

Returns the estimated survival probability at time t , - \widehat{\mathbb{P}}(T > t|X) for some input data x .

-

Parameters

-
-
x : np.ndarray
-
A numpy array of the input features, x .
-
t : list or float
-
a list or float of the times at which survival probability is -to be computed
-
-

Returns

-
-
np.array
-
numpy array of the survival probabilites at each time in t.
-
-
-
-
-
-
-
- -
- - - \ No newline at end of file diff --git a/html/auton_survival/models/dcm/dcm_torch.html b/html/auton_survival/models/dcm/dcm_torch.html deleted file mode 100644 index f4c9da5..0000000 --- a/html/auton_survival/models/dcm/dcm_torch.html +++ /dev/null @@ -1,110 +0,0 @@ - - - - - - -auton_survival.models.dcm.dcm_torch API documentation - - - - - - - - - - - - - -
-
-
-

Module auton_survival.models.dcm.dcm_torch

-
-
- -
-
-
-
-
-
-
-
-

Classes

-
-
-class DeepCoxMixturesTorch -(inputdim, k, gamma=1, use_activation=False, layers=None, optimizer='Adam') -
-
-

PyTorch model definition of the Deep Cox Mixture Survival Model.

-

The Cox Mixture involves the assumption that the survival function -of the individual to be a mixture of K Cox Models. Conditioned on each -subgroup Z=k; the PH assumptions are assumed to hold and the baseline -hazard rates is determined non-parametrically using an spline-interpolated -Breslow's estimator.

-

Initializes internal Module state, shared by both nn.Module and ScriptModule.

- -

Class variables

-
-
var dump_patches : bool
-
-
-
-
var training : bool
-
-
-
-
-

Methods

-
-
-def forward(self, x) ‑> Callable[..., Any] -
-
-
- -
-
-
-
-
-
- -
- - - \ No newline at end of file diff --git a/html/auton_survival/models/dcm/dcm_utilities.html b/html/auton_survival/models/dcm/dcm_utilities.html deleted file mode 100644 index 479d900..0000000 --- a/html/auton_survival/models/dcm/dcm_utilities.html +++ /dev/null @@ -1,243 +0,0 @@ - - - - - - -auton_survival.models.dcm.dcm_utilities API documentation - - - - - - - - - - - - - -
-
-
-

Module auton_survival.models.dcm.dcm_utilities

-
-
- -
-
-
-
-
-
-

Functions

-
-
-def randargmax(b, **kw) -
-
-

a random tie-breaking argmax

- -
-
-def partial_ll_loss(lrisks, tb, eb, eps=0.01) -
-
-
- -
-
-def fit_spline(t, surv, s=0.0001) -
-
-
- -
-
-def smooth_bl_survival(breslow, smoothing_factor) -
-
-
- -
-
-def get_probability_(lrisks, ts, spl) -
-
-
- -
-
-def get_survival_(lrisks, ts, spl) -
-
-
- -
-
-def get_probability(lrisks, breslow_splines, t) -
-
-
- -
-
-def get_survival(lrisks, breslow_splines, t) -
-
-
- -
-
-def get_posteriors(probs) -
-
-
- -
-
-def get_hard_z(gates_prob) -
-
-
- -
-
-def sample_hard_z(gates_prob) -
-
-
- -
-
-def repair_probs(probs) -
-
-
- -
-
-def get_likelihood(model, breslow_splines, x, t, e) -
-
-
- -
-
-def q_function(model, x, t, e, posteriors, typ='soft') -
-
-
- -
-
-def e_step(model, breslow_splines, x, t, e) -
-
-
- -
-
-def m_step(model, optimizer, x, t, e, posteriors, typ='soft') -
-
-
- -
-
-def fit_breslow(model, x, t, e, posteriors=None, smoothing_factor=0.0001, typ='soft') -
-
-
- -
-
-def train_step(model, x, t, e, breslow_splines, optimizer, bs=256, seed=100, typ='soft', use_posteriors=False, update_splines_after=10, smoothing_factor=0.0001) -
-
-
- -
-
-def test_step(model, x, t, e, breslow_splines, loss='q', typ='soft') -
-
-
- -
-
-def train_dcm(model, train_data, val_data, epochs=50, patience=3, vloss='q', bs=256, typ='soft', lr=0.001, use_posteriors=True, debug=False, random_seed=0, return_losses=False, update_splines_after=10, smoothing_factor=0.01) -
-
-
- -
-
-def predict_survival(model, x, t) -
-
-
- -
-
-def predict_latent_z(model, x) -
-
-
- -
-
-
-
-
-
- -
- - - \ No newline at end of file diff --git a/html/auton_survival/models/dcm/index.html b/html/auton_survival/models/dcm/index.html deleted file mode 100644 index 5836bf2..0000000 --- a/html/auton_survival/models/dcm/index.html +++ /dev/null @@ -1,206 +0,0 @@ - - - - - - -auton_survival.models.dcm API documentation - - - - - - - - - - - - - -
-
-
-

Module auton_survival.models.dcm

-
-
-

Deep Cox Mixtures

-

The Cox Mixture involves the assumption that the survival function -of the individual to be a mixture of K Cox Models. Conditioned on each -subgroup Z=k ; the PH assumptions are assumed to hold and the baseline -hazard rates is determined non-parametrically using an spline-interpolated -Breslow's estimator.

-

For full details on Deep Cox Mixture, refer to the paper [1].

-

References

-

[1] Deep Cox Mixtures -for Survival Regression. Machine Learning in Health Conference (2021)

-
  @article{nagpal2021dcm,
-  title={Deep Cox mixtures for survival regression},
-  author={Nagpal, Chirag and Yadlowsky, Steve and Rostamzadeh, Negar and Heller, Katherine},
-  journal={arXiv preprint arXiv:2101.06536},
-  year={2021}
-  }
-
- -
-
-

Sub-modules

-
-
auton_survival.models.dcm.dcm_torch
-
-
-
-
auton_survival.models.dcm.dcm_utilities
-
-
-
-
-
-
-
-
-
-
-

Classes

-
-
-class DeepCoxMixtures -(k=3, layers=None, gamma=10, smoothing_factor=0.0001, use_activation=False, random_seed=0) -
-
-

A Deep Cox Mixture model.

-

This is the main interface to a Deep Cox Mixture model. -A model is instantiated with approporiate set of hyperparameters and -fit on numpy arrays consisting of the features, event/censoring times -and the event/censoring indicators.

-

For full details on Deep Cox Mixture, refer to the paper [1].

-

References

-

[1] Deep Cox Mixtures -for Survival Regression. Machine Learning in Health Conference (2021)

-

Parameters

-
-
k : int
-
The number of underlying Cox distributions.
-
layers : list
-
A list of integers consisting of the number of neurons in each -hidden layer.
-
random_seed : int
-
Controls the reproducibility of called functions.
-
-

Example

-
>>> from auton_survival.models.dcm import DeepCoxMixtures
->>> model = DeepCoxMixtures()
->>> model.fit(x, t, e)
-
- -

Methods

-
-
-def fit(self, x, t, e, vsize=0.15, val_data=None, iters=1, learning_rate=0.001, batch_size=100, optimizer='Adam') -
-
-

This method is used to train an instance of the DSM model.

-

Parameters

-
-
x : np.ndarray
-
A numpy array of the input features, x .
-
t : np.ndarray
-
A numpy array of the event/censoring times, t .
-
e : np.ndarray
-
A numpy array of the event/censoring indicators, \delta . - \delta = 1 means the event took place.
-
vsize : float
-
Amount of data to set aside as the validation set.
-
val_data : tuple
-
A tuple of the validation dataset. If passed vsize is ignored.
-
iters : int
-
The maximum number of training iterations on the training dataset.
-
learning_rate : float
-
The learning rate for the Adam optimizer.
-
batch_size : int
-
learning is performed on mini-batches of input data. this parameter -specifies the size of each mini-batch.
-
optimizer : str
-
The choice of the gradient based optimization method. One of -'Adam', 'RMSProp' or 'SGD'.
-
- -
-
-def predict_survival(self, x, t) -
-
-

Returns the estimated survival probability at time t , - \widehat{\mathbb{P}}(T > t|X) for some input data x .

-

Parameters

-
-
x : np.ndarray
-
A numpy array of the input features, x .
-
t : list or float
-
a list or float of the times at which survival probability is -to be computed
-
-

Returns

-
-
np.array
-
numpy array of the survival probabilites at each time in t.
-
- -
-
-def predict_latent_z(self, x) -
-
-
- -
-
-
-
-
-
- -
- - - \ No newline at end of file diff --git a/html/auton_survival/models/dsm/datasets.html b/html/auton_survival/models/dsm/datasets.html deleted file mode 100644 index f2e4986..0000000 --- a/html/auton_survival/models/dsm/datasets.html +++ /dev/null @@ -1,121 +0,0 @@ - - - - - - -auton_survival.models.dsm.datasets API documentation - - - - - - - - - - - - - -
-
-
-

Module auton_survival.models.dsm.datasets

-
-
-

Utility functions to load standard datasets to train and evaluate the -Deep Survival Machines models.

- -
-
-
-
-
-
-

Functions

-
-
-def increase_censoring(e, t, p) -
-
-
- -
-
-def load_dataset(dataset='SUPPORT', **kwargs) -
-
-

Helper function to load datasets to test Survival Analysis models.

-

Currently implemented datasets include:

-

SUPPORT: This dataset comes from the Vanderbilt University study -to estimate survival for seriously ill hospitalized adults [1]. -(Refer to http://biostat.mc.vanderbilt.edu/wiki/Main/SupportDesc. -for the original datasource.)

-

PBC: The Primary biliary cirrhosis dataset [2] is well known -dataset for evaluating survival analysis models with time -dependent covariates.

-

FRAMINGHAM: This dataset is a subset of 4,434 participants of the well -known, ongoing Framingham Heart study [3] for studying epidemiology for -hypertensive and arteriosclerotic cardiovascular disease. It is a popular -dataset for longitudinal survival analysis with time dependent covariates.

-

References

-

[1]: Knaus WA, Harrell FE, Lynn J et al. (1995): The SUPPORT prognostic -model: Objective estimates of survival for seriously ill hospitalized -adults. Annals of Internal Medicine 122:191-203.

-

[2] Fleming, Thomas R., and David P. Harrington. Counting processes and -survival analysis. Vol. 169. John Wiley & Sons, 2011.

-

[3] Dawber, Thomas R., Gilcin F. Meadors, and Felix E. Moore Jr. -"Epidemiological approaches to heart disease: the Framingham Study." -American Journal of Public Health and the Nations Health 41.3 (1951).

-

Parameters

-
-
dataset : str
-
The choice of dataset to load. Currently implemented is 'SUPPORT', -'PBC' and 'FRAMINGHAM'.
-
**kwargs : dict
-
Dataset specific keyword arguments.
-
-

Returns

-
-
tuple : (np.ndarray, np.ndarray, np.ndarray)
-
A tuple of the form of (x, t, e) where x, t, e are the input covariates, -event times and the censoring indicators respectively.
-
- -
-
-
-
-
-
- -
- - - \ No newline at end of file diff --git a/html/auton_survival/models/dsm/dsm_torch.html b/html/auton_survival/models/dsm/dsm_torch.html deleted file mode 100644 index 79f1d6c..0000000 --- a/html/auton_survival/models/dsm/dsm_torch.html +++ /dev/null @@ -1,474 +0,0 @@ - - - - - - -auton_survival.models.dsm.dsm_torch API documentation - - - - - - - - - - - - - -
-
-
-

Module auton_survival.models.dsm.dsm_torch

-
-
-

Torch model definitons for the Deep Survival Machines model

-

This includes definitons for the Torch Deep Survival Machines module. -The main interface is the DeepSurvivalMachines class which inherits -from torch.nn.Module.

-

Note: NOT DESIGNED TO BE CALLED DIRECTLY!!!

- -
-
-
-
-
-
-

Functions

-
-
-def create_representation(inputdim, layers, activation, bias=False) -
-
-

Helper function to generate the representation function for DSM.

-

Deep Survival Machines learns a representation (\ Phi(X) ) for the input -data. This representation is parameterized using a Non Linear Multilayer -Perceptron (torch.nn.Module). This is a helper function designed to -instantiate the representation for Deep Survival Machines.

-
-

Warning

-

Not designed to be used directly.

-
-

Parameters

-
-
inputdim : int
-
Dimensionality of the input features.
-
layers : list
-
A list consisting of the number of neurons in each hidden layer.
-
activation : str
-
Choice of activation function: One of 'ReLU6', 'ReLU' or 'SeLU'.
-
-

Returns

-

an MLP with torch.nn.Module with the specfied structure.

- -
-
-def create_conv_representation(inputdim, hidden, typ='ConvNet', add_linear=True) -
-
-

Helper function to generate the representation function for DSM.

-

Deep Survival Machines learns a representation (\ Phi(X) ) for the input -data. This representation is parameterized using a Convolutional Neural -Network (torch.nn.Module). This is a helper function designed to -instantiate the representation for Deep Survival Machines.

-
-

Warning

-

Not designed to be used directly.

-
-

Parameters

-
-
inputdim : tuple
-
Dimensionality of the input image.
-
hidden : int
-
The number of neurons in each hidden layer.
-
typ : str
-
Choice of convolutional neural network: One of 'ConvNet'
-
-

Returns

-

an ConvNet with torch.nn.Module with the specfied structure.

- -
-
-
-
-

Classes

-
-
-class DeepSurvivalMachinesTorch -(inputdim, k, layers=None, dist='Weibull', temp=1000.0, discount=1.0, optimizer='Adam', risks=1) -
-
-

A Torch implementation of Deep Survival Machines model.

-

This is an implementation of Deep Survival Machines model in torch. -It inherits from the torch.nn.Module class and includes references to the -representation learning MLP, the parameters of the underlying distributions -and the forward function which is called whenver data is passed to the -module. Each of the parameters are nn.Parameters and torch automatically -keeps track and computes gradients for them.

-
-

Warning

-

Not designed to be used directly. -Please use the API inferface dsm.DeepSurvivalMachines !!!

-
-

Parameters

-
-
inputdim : int
-
Dimensionality of the input features.
-
k : int
-
The number of underlying parametric distributions.
-
layers : list
-
A list of integers consisting of the number of neurons in each -hidden layer.
-
init : tuple
-
A tuple for initialization of the parameters for the underlying -distributions. (shape, scale).
-
activation : str
-
Choice of activation function for the MLP representation. -One of 'ReLU6', 'ReLU' or 'SeLU'. -Default is 'ReLU6'.
-
dist : str
-
Choice of the underlying survival distributions. -One of 'Weibull', 'LogNormal'. -Default is 'Weibull'.
-
temp : float
-
The logits for the gate are rescaled with this value. -Default is 1000.
-
discount : float
-
a float in [0,1] that determines how to discount the tail bias -from the uncensored instances. -Default is 1.
-
-

Initializes internal Module state, shared by both nn.Module and ScriptModule.

- -

Methods

-
-
-def forward(self, x, risk='1') ‑> Callable[..., Any] -
-
-

The forward function that is called when data is passed through DSM.

-

Args

-

x: -a torch.tensor of the input features.

- -
-
-def get_shape_scale(self, risk='1') -
-
-
- -
-
-
-
-class DeepRecurrentSurvivalMachinesTorch -(inputdim, k, typ='LSTM', layers=1, hidden=None, dist='Weibull', temp=1000.0, discount=1.0, optimizer='Adam', risks=1) -
-
-

A Torch implementation of Deep Recurrent Survival Machines model.

-

This is an implementation of Deep Recurrent Survival Machines model -in torch. It inherits from DeepSurvivalMachinesTorch and replaces the -input representation learning MLP with an LSTM or RNN, the parameters of the -underlying distributions and the forward function which is called whenever -data is passed to the module. Each of the parameters are nn.Parameters and -torch automatically keeps track and computes gradients for them.

-
-

Warning

-

Not designed to be used directly. -Please use the API inferface dsm.DeepRecurrentSurvivalMachines!!

-
-

Parameters

-
-
inputdim : int
-
Dimensionality of the input features.
-
k : int
-
The number of underlying parametric distributions.
-
layers : int
-
The number of hidden layers in the LSTM or RNN cell.
-
hidden : int
-
The number of neurons in each hidden layer.
-
init : tuple
-
A tuple for initialization of the parameters for the underlying -distributions. (shape, scale).
-
dist : str
-
Choice of the underlying survival distributions. -One of 'Weibull', 'LogNormal'. -Default is 'Weibull'.
-
temp : float
-
The logits for the gate are rescaled with this value. -Default is 1000.
-
discount : float
-
a float in [0,1] that determines how to discount the tail bias -from the uncensored instances. -Default is 1.
-
-

Initializes internal Module state, shared by both nn.Module and ScriptModule.

- -

Methods

-
-
-def forward(self, x, risk='1') ‑> Callable[..., Any] -
-
-

The forward function that is called when data is passed through DSM.

-

Note: As compared to DSM, the input data for DRSM is a tensor. The forward -function involves unpacking the tensor in-order to directly use the -DSM loss functions.

-

Args

-

x: -a torch.tensor of the input features.

- -
-
-def get_shape_scale(self, risk='1') -
-
-
- -
-
-
-
-class DeepConvolutionalSurvivalMachinesTorch -(inputdim, k, embedding=None, hidden=None, dist='Weibull', temp=1000.0, discount=1.0, optimizer='Adam', risks=1) -
-
-

A Torch implementation of Deep Convolutional Survival Machines model.

-

This is an implementation of Deep Convolutional Survival Machines model -in torch. It inherits from DeepSurvivalMachinesTorch and replaces the -input representation learning MLP with an simple convnet, the parameters of -the underlying distributions and the forward function which is called whenever -data is passed to the module. Each of the parameters are nn.Parameters and -torch automatically keeps track and computes gradients for them.

-
-

Warning

-

Not designed to be used directly. -Please use the API inferface -dsm.DeepConvolutionalSurvivalMachines!!

-
-

Parameters

-
-
inputdim : tuple
-
Dimensionality of the input features. A tuple (height, width).
-
k : int
-
The number of underlying parametric distributions.
-
embedding : torch.nn.Module
-
A torch CNN to obtain the representation of the input data.
-
hidden : int
-
The number of neurons in each hidden layer.
-
dist : str
-
Choice of the underlying survival distributions. -One of 'Weibull', 'LogNormal'. -Default is 'Weibull'.
-
temp : float
-
The logits for the gate are rescaled with this value. -Default is 1000.
-
discount : float
-
a float in [0,1] that determines how to discount the tail bias -from the uncensored instances. -Default is 1.
-
-

Initializes internal Module state, shared by both nn.Module and ScriptModule.

- -

Class variables

-
-
var dump_patches : bool
-
-

-Inherited from: -DeepSurvivalMachinesTorch.dump_patches -

-

dummy

-
-
var training : bool
-
-

-Inherited from: -DeepSurvivalMachinesTorch.training -

-

dummy

-
-
-

Methods

-
-
-def forward(self, x, risk='1') ‑> Callable[..., Any] -
-
-

-Inherited from: -DeepSurvivalMachinesTorch.forward -

-

The forward function that is called when data is passed through DSM.

-

Args

-

x: -a torch.tensor of the input features.

- -
-
-def get_shape_scale(self, risk='1') -
-
-
- -
-
-
-
-class DeepCNNRNNSurvivalMachinesTorch -(inputdim, k, typ='LSTM', layers=1, hidden=None, dist='Weibull', temp=1000.0, discount=1.0, optimizer='Adam', risks=1) -
-
-

A Torch implementation of Deep CNN Recurrent Survival Machines model.

-

This is an implementation of Deep Recurrent Survival Machines model -in torch. It inherits from DeepSurvivalMachinesTorch and replaces the -input representation learning MLP with an LSTM or RNN, the parameters of the -underlying distributions and the forward function which is called whenever -data is passed to the module. Each of the parameters are nn.Parameters and -torch automatically keeps track and computes gradients for them.

-
-

Warning

-

Not designed to be used directly. -Please use the API inferface dsm.DeepCNNRNNSurvivalMachines!!

-
-

Parameters

-
-
inputdim : tuple
-
Dimensionality of the input features. (height, width)
-
k : int
-
The number of underlying parametric distributions.
-
layers : int
-
The number of hidden layers in the LSTM or RNN cell.
-
hidden : int
-
The number of neurons in each hidden layer.
-
init : tuple
-
A tuple for initialization of the parameters for the underlying -distributions. (shape, scale).
-
dist : str
-
Choice of the underlying survival distributions. -One of 'Weibull', 'LogNormal'. -Default is 'Weibull'.
-
temp : float
-
The logits for the gate are rescaled with this value. -Default is 1000.
-
discount : float
-
a float in [0,1] that determines how to discount the tail bias -from the uncensored instances. -Default is 1.
-
-

Initializes internal Module state, shared by both nn.Module and ScriptModule.

- -

Class variables

-
-
var dump_patches : bool
-
-

-Inherited from: -DeepRecurrentSurvivalMachinesTorch.dump_patches -

-

dummy

-
-
var training : bool
-
-

-Inherited from: -DeepRecurrentSurvivalMachinesTorch.training -

-

dummy

-
-
-

Methods

-
-
-def forward(self, x, risk='1') ‑> Callable[..., Any] -
-
-

The forward function that is called when data is passed through DSM.

-

Note: As compared to DSM, the input data for DCRSM is a tensor. The forward -function involves unpacking the tensor in-order to directly use the -DSM loss functions.

-

Args

-

x: -a torch.tensor of the input features.

- -
-
-def get_shape_scale(self, risk='1') -
-
-
- -
-
-
-
-
-
- -
- - - \ No newline at end of file diff --git a/html/auton_survival/models/dsm/index.html b/html/auton_survival/models/dsm/index.html deleted file mode 100644 index f5db9cb..0000000 --- a/html/auton_survival/models/dsm/index.html +++ /dev/null @@ -1,299 +0,0 @@ - - - - - - -auton_survival.models.dsm API documentation - - - - - - - - - - - - - -
-
-
-

Module auton_survival.models.dsm

-
-
-

Deep Survival Machines

-

:figwidth: 20 %
-:alt: Schematic Description of Deep Survival Machines
-Schematic Description of Deep Survival Machines.

-

Deep Survival Machines (DSM) is a fully parametric approach to model -Time-to-Event outcomes in the presence of Censoring first introduced in -[1]. -In the context of Healthcare ML and Biostatistics, this is known as 'Survival -Analysis'. The key idea behind Deep Survival Machines is to model the -underlying event outcome distribution as a mixure of some fixed k -parametric distributions. The parameters of these mixture distributions as -well as the mixing weights are modelled using Neural Networks.

-

Example Usage

-
>>> from dsm import DeepSurvivalMachines
->>> from dsm import datasets
->>> # load the SUPPORT dataset.
->>> x, t, e = datasets.load_dataset('SUPPORT')
->>> # instantiate a DeepSurvivalMachines model.
->>> model = DeepSurvivalMachines()
->>> # fit the model to the dataset.
->>> model.fit(x, t, e)
->>> # estimate the predicted risks at the time
->>> model.predict_risk(x, 10)
-
-

Deep Recurrent Survival Machines

-

:figwidth: 20 %
-:alt: Schematic Description of Deep Survival Machines
-Schematic Description of Deep Survival Machines.

-

Deep Recurrent Survival Machines (DRSM) builds on the original DSM -model and allows for learning of representations of the input covariates using -Recurrent Neural Networks like LSTMs, GRUs. Deep Recurrent Survival -Machines is a natural fit to model problems where there are time dependendent -covariates. Examples include situations where we are working with streaming -data like vital signs, degradation monitoring signals in predictive -maintainance. DRSM allows the learnt representations at each time step to -involve historical context from previous time steps. DRSM implementation in -dsm is carried out through an easy to use API, -DeepRecurrentSurvivalMachines that accepts lists of data streams and -corresponding failure times. The module automatically takes care of appropriate -batching and padding of variable length sequences.

-

Deep Convolutional Survival Machines

-

Predictive maintenance and medical imaging sometimes requires to work with -image streams. Deep Convolutional Survival Machines extends DSM and -DRSM to learn representations of the input image data using -convolutional layers. If working with streaming data, the learnt -representations are then passed through an LSTM to model temporal dependencies -before determining the underlying survival distributions.

-
-

Warning: Not Implemented Yet!

-
-

References

-

Please cite the following papers if you are using the auton_survival package.

-

[1] Deep Survival Machines: -Fully Parametric Survival Regression and -Representation Learning for Censored Data with Competing Risks." -IEEE Journal of Biomedical and Health Informatics (2021)

-
  @article{nagpal2021dsm,
-  title={Deep survival machines: Fully parametric survival regression and representation learning for censored data with competing risks},
-  author={Nagpal, Chirag and Li, Xinyu and Dubrawski, Artur},
-  journal={IEEE Journal of Biomedical and Health Informatics},
-  volume={25},
-  number={8},
-  pages={3163--3175},
-  year={2021},
-  publisher={IEEE}
-  }
-
-

[2] Deep Parametric Time-to-Event Regression with Time-Varying Covariates. AAAI -Spring Symposium (2021)

-
  @InProceedings{pmlr-v146-nagpal21a,
-  title={Deep Parametric Time-to-Event Regression with Time-Varying Covariates},
-  author={Nagpal, Chirag and Jeanselme, Vincent and Dubrawski, Artur},
-  booktitle={Proceedings of AAAI Spring Symposium on Survival Prediction - Algorithms, Challenges, and Applications 2021},
-  series={Proceedings of Machine Learning Research},
-  publisher={PMLR},
-  }
-
-

[3] Deep Cox Mixtures for Survival Regression. Conference on Machine Learning for -Healthcare (2021)

-
  @inproceedings{nagpal2021dcm,
-  title={Deep Cox mixtures for survival regression},
-  author={Nagpal, Chirag and Yadlowsky, Steve and Rostamzadeh, Negar and Heller, Katherine},
-  booktitle={Machine Learning for Healthcare Conference},
-  pages={674--708},
-  year={2021},
-  organization={PMLR}
-  }
-
-

[4] Counterfactual Phenotyping with Censored Time-to-Events (2022)

-
  @article{nagpal2022counterfactual,
-  title={Counterfactual Phenotyping with Censored Time-to-Events},
-  author={Nagpal, Chirag and Goswami, Mononito and Dufendach, Keith and Dubrawski, Artur},
-  journal={arXiv preprint arXiv:2202.11089},
-  year={2022}
-  }
-
- -
-
-

Sub-modules

-
-
auton_survival.models.dsm.datasets
-
-

Utility functions to load standard datasets to train and evaluate the -Deep Survival Machines models.

-
-
auton_survival.models.dsm.dsm_torch
-
-

Torch model definitons for the Deep Survival Machines model

-

This includes definitons for the Torch Deep Survival Machines module. -The main interface is the DeepSurvivalMachines class which inherits -from torch.nn.Module.

-

Note: NOT DESIGNED TO BE CALLED DIRECTLY!!!

-
-
auton_survival.models.dsm.losses
-
-

Loss function definitions for the Deep Survival Machines model

-

In this module we define the various losses for the censored and uncensored -instances of data corresponding to Weibull and LogNormal distributions. -These losses are optimized when training DSM.

-
-

TODO

-

Use torch.distributions

-
-
-

Warning

-

NOT DESIGNED TO BE CALLED DIRECTLY!!!

-
-
-
auton_survival.models.dsm.utilities
-
-

Utility functions to train the Deep Survival Machines models

-
-
-
-
-
-
-
-
-

Classes

-
-
-class DeepSurvivalMachines -(k=3, layers=None, distribution='Weibull', temp=1000.0, discount=1.0, random_seed=0) -
-
-

A Deep Survival Machines model.

-

This is the main interface to a Deep Survival Machines model. -A model is instantiated with approporiate set of hyperparameters and -fit on numpy arrays consisting of the features, event/censoring times -and the event/censoring indicators.

-

For full details on Deep Survival Machines, refer to our paper [1].

-

References

-

[1] Deep Survival Machines: -Fully Parametric Survival Regression and -Representation Learning for Censored Data with Competing Risks." -arXiv preprint arXiv:2003.01176 (2020)

-

Parameters

-
-
k : int
-
The number of underlying parametric distributions.
-
layers : list
-
A list of integers consisting of the number of neurons in each -hidden layer.
-
distribution : str
-
Choice of the underlying survival distributions. -One of 'Weibull', 'LogNormal'. -Default is 'Weibull'.
-
temp : float
-
The logits for the gate are rescaled with this value. -Default is 1000.
-
discount : float
-
a float in [0,1] that determines how to discount the tail bias -from the uncensored instances. -Default is 1.
-
-

Example

-
>>> from dsm import DeepSurvivalMachines
->>> model = DeepSurvivalMachines()
->>> model.fit(x, t, e)
-
- -
-
-class DeepRecurrentSurvivalMachines -(k=3, layers=None, hidden=None, distribution='Weibull', temp=1000.0, discount=1.0, typ='LSTM', random_seed=0) -
-
-

The Deep Recurrent Survival Machines model to handle data with -time-dependent covariates.

-

For full details on Deep Recurrent Survival Machines, refer to our paper [1].

-

References

-

[1] -Deep Parametric Time-to-Event Regression with Time-Varying Covariates -AAAI Spring Symposium on Survival Prediction

- -
-
-class DeepConvolutionalSurvivalMachines -(k=3, layers=None, hidden=None, distribution='Weibull', temp=1000.0, discount=1.0, typ='ConvNet') -
-
-

The Deep Convolutional Survival Machines model to handle data with -image-based covariates.

- -
-
-class DeepCNNRNNSurvivalMachines -(k=3, layers=None, hidden=None, distribution='Weibull', temp=1000.0, discount=1.0, typ='LSTM') -
-
-

The Deep CNN-RNN Survival Machines model to handle data with -moving image streams.

- -
-
-
-
- -
- - - \ No newline at end of file diff --git a/html/auton_survival/models/dsm/losses.html b/html/auton_survival/models/dsm/losses.html deleted file mode 100644 index bd46148..0000000 --- a/html/auton_survival/models/dsm/losses.html +++ /dev/null @@ -1,119 +0,0 @@ - - - - - - -auton_survival.models.dsm.losses API documentation - - - - - - - - - - - - - -
-
-
-

Module auton_survival.models.dsm.losses

-
-
-

Loss function definitions for the Deep Survival Machines model

-

In this module we define the various losses for the censored and uncensored -instances of data corresponding to Weibull and LogNormal distributions. -These losses are optimized when training DSM.

-
-

TODO

-

Use torch.distributions

-
-
-

Warning

-

NOT DESIGNED TO BE CALLED DIRECTLY!!!

-
- -
-
-
-
-
-
-

Functions

-
-
-def unconditional_loss(model, t, e, risk='1') -
-
-
- -
-
-def conditional_loss(model, x, t, e, elbo=True, risk='1') -
-
-
- -
-
-def predict_mean(model, x, risk='1') -
-
-
- -
-
-def predict_pdf(model, x, t_horizon, risk='1') -
-
-
- -
-
-def predict_cdf(model, x, t_horizon, risk='1') -
-
-
- -
-
-
-
-
-
- -
- - - \ No newline at end of file diff --git a/html/auton_survival/models/dsm/utilities.html b/html/auton_survival/models/dsm/utilities.html deleted file mode 100644 index 0a748c1..0000000 --- a/html/auton_survival/models/dsm/utilities.html +++ /dev/null @@ -1,92 +0,0 @@ - - - - - - -auton_survival.models.dsm.utilities API documentation - - - - - - - - - - - - - -
-
-
-

Module auton_survival.models.dsm.utilities

-
-
-

Utility functions to train the Deep Survival Machines models

- -
-
-
-
-
-
-

Functions

-
-
-def get_optimizer(model, lr) -
-
-
- -
-
-def pretrain_dsm(model, t_train, e_train, t_valid, e_valid, n_iter=10000, lr=0.01, thres=0.0001) -
-
-
- -
-
-def train_dsm(model, x_train, t_train, e_train, x_valid, t_valid, e_valid, n_iter=10000, lr=0.001, elbo=True, bs=100, random_seed=0) -
-
-

Function to train the torch instance of the model.

- -
-
-
-
-
-
- -
- - - \ No newline at end of file diff --git a/html/auton_survival/models/index.html b/html/auton_survival/models/index.html deleted file mode 100644 index 5f13063..0000000 --- a/html/auton_survival/models/index.html +++ /dev/null @@ -1,235 +0,0 @@ - - - - - - -auton_survival.models API documentation - - - - - - - - - - - - - -
-
-
-

Namespace auton_survival.models

-
-
-
-
-

Sub-modules

-
-
auton_survival.models.cmhe
-
-

Cox Mixtures With Heterogenous Effects

-

Build Status -    -codecov -    -License: MIT -    -GitHub Repo stars

-

-

-

Cox Mixture with Heterogenous Effects (CMHE) is a flexible approach to -recover counterfactual phenotypes of individuals that demonstrate heterogneous -effects to an intervention in terms of censored Time-to-Event outcomes. -CMHE is not restricted by the strong Cox Proportional Hazards assumption -or any parametric assumption on the time to event distributions. CMHE achieves -this by describing each individual as belonging to two different latent groups, - \mathcal{Z} that mediate the base survival rate and \phi the effect -of the treatment. CMHE can also be employed to model individual level -counterfactuals or for standard factual survival regression.

-

For full details on Cox Mixtures with Heterogenous Effects, please refer to -our preprint:

-

Counterfactual Phenotyping with Censored Time-to-Events, arXiv preprint, -C. Nagpal, M. Goswami, K. Dufendach, A. Dubrawski

-


-

Example Usage

-
>>> from auton_survival import DeepCoxMixturesHeterogenousEffects
->>> from auton_survival import datasets
->>> # load the SYNTHETIC dataset.
->>> x, t, e, a = datasets.load_dataset('SYNTHETIC')
->>> # instantiate a Cox Mixtures with Heterogenous Effects model.
->>> model = DeepCoxMixturesHeterogenousEffects()
->>> # fit the model to the dataset.
->>> model.fit(x, t, e, a)
->>> # estimate the predicted risks at the time
->>> model.predict_risk(x, 10)
->>> # estimate the treatment effect phenogroups
->>> model.predict_latent_phi(x)
-
-
-
auton_survival.models.cph
-
-

Deep Cox Proportional Hazards Model

-
-
auton_survival.models.dcm
-
-

Deep Cox Mixtures

-

The Cox Mixture involves the assumption that the survival function -of the individual to be a mixture of K Cox Models. Conditioned on each -subgroup Z=k ; the PH assumptions are assumed to hold and the baseline -hazard rates is determined non-parametrically using an spline-interpolated -Breslow's estimator.

-

For full details on Deep Cox Mixture, refer to the paper [1].

-

References

-

[1] Deep Cox Mixtures -for Survival Regression. Machine Learning in Health Conference (2021)

-
  @article{nagpal2021dcm,
-  title={Deep Cox mixtures for survival regression},
-  author={Nagpal, Chirag and Yadlowsky, Steve and Rostamzadeh, Negar and Heller, Katherine},
-  journal={arXiv preprint arXiv:2101.06536},
-  year={2021}
-  }
-
-
-
auton_survival.models.dsm
-
-

Deep Survival Machines

-

:figwidth: 20 %
-:alt: Schematic Description of Deep Survival Machines
-Schematic Description of Deep Survival Machines.

-

Deep Survival Machines (DSM) is a fully parametric approach to model -Time-to-Event outcomes in the presence of Censoring first introduced in -[1]. -In the context of Healthcare ML and Biostatistics, this is known as 'Survival -Analysis'. The key idea behind Deep Survival Machines is to model the -underlying event outcome distribution as a mixure of some fixed k -parametric distributions. The parameters of these mixture distributions as -well as the mixing weights are modelled using Neural Networks.

-

Example Usage

-
>>> from dsm import DeepSurvivalMachines
->>> from dsm import datasets
->>> # load the SUPPORT dataset.
->>> x, t, e = datasets.load_dataset('SUPPORT')
->>> # instantiate a DeepSurvivalMachines model.
->>> model = DeepSurvivalMachines()
->>> # fit the model to the dataset.
->>> model.fit(x, t, e)
->>> # estimate the predicted risks at the time
->>> model.predict_risk(x, 10)
-
-

Deep Recurrent Survival Machines

-

:figwidth: 20 %
-:alt: Schematic Description of Deep Survival Machines
-Schematic Description of Deep Survival Machines.

-

Deep Recurrent Survival Machines (DRSM) builds on the original DSM -model and allows for learning of representations of the input covariates using -Recurrent Neural Networks like LSTMs, GRUs. Deep Recurrent Survival -Machines is a natural fit to model problems where there are time dependendent -covariates. Examples include situations where we are working with streaming -data like vital signs, degradation monitoring signals in predictive -maintainance. DRSM allows the learnt representations at each time step to -involve historical context from previous time steps. DRSM implementation in -auton_survival.models.dsm is carried out through an easy to use API, -DeepRecurrentSurvivalMachines that accepts lists of data streams and -corresponding failure times. The module automatically takes care of appropriate -batching and padding of variable length sequences.

-

Deep Convolutional Survival Machines

-

Predictive maintenance and medical imaging sometimes requires to work with -image streams. Deep Convolutional Survival Machines extends DSM and -DRSM to learn representations of the input image data using -convolutional layers. If working with streaming data, the learnt -representations are then passed through an LSTM to model temporal dependencies -before determining the underlying survival distributions.

-
-

Warning: Not Implemented Yet!

-
-

References

-

Please cite the following papers if you are using the auton_survival package.

-

[1] Deep Survival Machines: -Fully Parametric Survival Regression and -Representation Learning for Censored Data with Competing Risks." -IEEE Journal of Biomedical and Health Informatics (2021)

-
  @article{nagpal2021dsm,
-  title={Deep survival machines: Fully parametric survival regression and representation learning for censored data with competing risks},
-  author={Nagpal, Chirag and Li, Xinyu and Dubrawski, Artur},
-  journal={IEEE Journal of Biomedical and Health Informatics},
-  volume={25},
-  number={8},
-  pages={3163--3175},
-  year={2021},
-  publisher={IEEE}
-  }
-
-

[2] Deep Parametric Time-to-Event Regression with Time-Varying Covariates. AAAI -Spring Symposium (2021)

-
  @InProceedings{pmlr-v146-nagpal21a,
-  title={Deep Parametric Time-to-Event Regression with Time-Varying Covariates},
-  author={Nagpal, Chirag and Jeanselme, Vincent and Dubrawski, Artur},
-  booktitle={Proceedings of AAAI Spring Symposium on Survival Prediction - Algorithms, Challenges, and Applications 2021},
-  series={Proceedings of Machine Learning Research},
-  publisher={PMLR},
-  }
-
-

[3] Deep Cox Mixtures for Survival Regression. Conference on Machine Learning for -Healthcare (2021)

-
  @inproceedings{nagpal2021dcm,
-  title={Deep Cox mixtures for survival regression},
-  author={Nagpal, Chirag and Yadlowsky, Steve and Rostamzadeh, Negar and Heller, Katherine},
-  booktitle={Machine Learning for Healthcare Conference},
-  pages={674--708},
-  year={2021},
-  organization={PMLR}
-  }
-
-

[4] Counterfactual Phenotyping with Censored Time-to-Events (2022)

-
  @article{nagpal2022counterfactual,
-  title={Counterfactual Phenotyping with Censored Time-to-Events},
-  author={Nagpal, Chirag and Goswami, Mononito and Dufendach, Keith and Dubrawski, Artur},
-  journal={arXiv preprint arXiv:2202.11089},
-  year={2022}
-  }
-
-
-
-
-
-
-
-
-
-
-
- -
- - - \ No newline at end of file diff --git a/html/auton_survival/phenotyping.html b/html/auton_survival/phenotyping.html deleted file mode 100644 index fe562c2..0000000 --- a/html/auton_survival/phenotyping.html +++ /dev/null @@ -1,449 +0,0 @@ - - - - - - -auton_survival.phenotyping API documentation - - - - - - - - - - - - - -
-
-
-

Module auton_survival.phenotyping

-
-
-

Utilities to phenotype individuals based on similar survival -characteristics.

- -
-
-
-
-
-
-

Functions

-
-
-def random() -
-
-

random() -> x in the interval [0, 1).

-
-
-
-
-

Classes

-
-
-class Phenotyper -(random_seed=0) -
-
-

Base class for all phenotyping methods.

- -
-
-class IntersectionalPhenotyper -(cat_vars=None, num_vars=None, num_vars_quantiles=(0, 0.5, 1.0), random_seed=0) -
-
-

A phenotyper that phenotypes by performing an exhaustive cartesian -product on prespecified set of categorical and numerical variables.

-

Parameters

-
-
cat_vars : list of python str(s), default=None
-
List of column names of categorical variables to phenotype on.
-
num_vars : list of python str(s), default=None
-
List of column names of continuous variables to phenotype on.
-
num_vars_quantiles : tuple of floats, default=(0, .5, 1.0)
-
A tuple of quantiles as floats (inclusive of 0 and 1) used to -discretize continuous variables into equal-sized bins.
-
features : pd.DataFrame
-
A pandas dataframe with rows corresponding to individual -samples and columns as covariates.
-
phenotypes : list
-
List of lists containing all possible combinations of specified -categorical and numerical variable values.
-
- -

Methods

-
-
-def fit(self, features) -
-
-

Fit the phenotyper by finding all possible intersectional groups -on a passed set of features.

-

Parameters

-
-
features : pd.DataFrame
-
A pandas dataframe with rows corresponding to individual samples -and columns as covariates.
-
-

Returns

-

Trained instance of intersectional phenotyper.

- -
-
-def predict(self, features) -
-
-

Phenotype out of sample test data.

-

Parameters

-
-
features : pd.DataFrame
-
a pandas dataframe with rows corresponding to individual samples -and columns as covariates.
-
-

Returns

-
-
np.array:
-
a numpy array containing a list of strings that define -subgroups from all possible combinations of specified categorical -and numerical variables.
-
- -
-
-def fit_predict(self, features) -
-
-

Fit and perform phenotyping on a given dataset.

-

Parameters

-
-
features : pd.DataFrame
-
A pandas dataframe with rows corresponding to individual samples -and columns as covariates.
-
-

Returns

-
-
np.array:
-
A numpy array containing a list of strings that define -subgroups from all possible combinations of specified categorical -and numerical variables.
-
- -
-
-
-
-class ClusteringPhenotyper -(clustering_method='kmeans', dim_red_method=None, random_seed=0, **kwargs) -
-
-

Phenotyper that performs dimensionality reduction followed by clustering. -Learned clusters are considered phenotypes and used to group samples based -on similarity in the covariate space.

-

Parameters

-
-
features : pd.DataFrame
-
A pandas dataframe with rows corresponding to individual samples -and columns as covariates.
-
clustering_method : str, default='kmeans'
-
-

The clustering method applied for phenotyping. -Options include:

-
    -
  • kmeans: K-Means Clustering
  • -
  • dbscan: Density-Based Spatial Clustering of Applications with -Noise (DBSCAN)
  • -
  • gmm: Gaussian Mixture
  • -
  • hierarchical: Agglomerative Clustering
  • -
-
-
dim_red_method : str, default=None
-
-

The dimensionality reductions method applied. -Options include:

-
    -
  • pca : Principal Component Analysis
  • -
  • kpca : Kernel Principal Component Analysis
  • -
  • nnmf : Non-Negative Matrix Factorization
  • -
  • None : dimensionality reduction is not applied.
  • -
-
-
random_seed : int, default=0
-
Controls the randomness and reproducibility of called functions
-
kwargs : dict
-
-

Additional arguments for dimensionality reduction and clustering -Please include dictionary key and item pairs specified by the following -scikit-learn modules:

-
    -
  • pca : sklearn.decomposition.PCA
  • -
  • nnmf : sklearn.decomposition.NMF
  • -
  • kpca : sklearn.decomposition.KernelPCA
  • -
  • kmeans : sklearn.cluster.KMeans
  • -
  • dbscan : sklearn.cluster.DBSCAN
  • -
  • gmm : sklearn.mixture.GaussianMixture
  • -
  • hierarchical : sklearn.cluster.AgglomerativeClustering
  • -
-
-
- -

Methods

-
-
-def fit(self, features) -
-
-

Perform dimensionality reduction and train an instance -of the clustering algorithm.

-

Parameters

-
-
features : pd.DataFrame
-
a pandas dataframe with rows corresponding to individual -samples and columns as covariates.
-
-

Returns

-

Trained instance of clustering phenotyper.

- -
-
-def predict_proba(self, features) -
-
-

Peform dimensionality reduction, clustering, and estimate probability -estimates of sample association to learned clusters, or subgroups.

-

Parameters

-
-
features : pd.DataFrame
-
a pandas dataframe with rows corresponding to individual samples -and columns as covariates.
-
-

Returns

-
-
np.array:
-
a numpy array of the probability estimates of sample association to -learned subgroups.
-
- -
-
-def predict(self, features) -
-
-

Peform dimensionality reduction, clustering, and extract phenogroups -that maximize the probability estimates of sample association to -specific learned clusters, or subgroups.

-

Parameters

-
-
features : pd.DataFrame
-
a pandas dataframe with rows corresponding to individual samples -and columns as covariates.
-
-

Returns

-
-
np.array:
-
a numpy array of phenogroup labels
-
- -
-
-def fit_predict(self, features) -
-
-

Fit and perform phenotyping on a given dataset.

-

Parameters

-
-
features : pd.DataFrame
-
a pandas dataframe with rows corresponding to individual samples -and columns as covariates.
-
-

Returns

-
-
np.array
-
a numpy array of the probability estimates of sample association -to learned clusters.
-
- -
-
-
-
-class SurvivalVirtualTwinsPhenotyper -(cf_method='dcph', phenotyping_method='rfr', cf_hyperparams=None, random_seed=0, **phenotyper_hyperparams) -
-
-

Phenotyper that estimates the potential outcomes under treatment and -control using a counterfactual Deep Cox Proportional Hazards model, -followed by regressing the difference of the estimated counterfactual -Restricted Mean Survival Times using a Random Forest regressor.

- -

Methods

-
-
-def fit(self, features, outcomes, interventions, horizons, metric) -
-
-

Fit a counterfactual model and regress the difference of the estimated -counterfactual Restricted Mean Survival Time using a Random Forest regressor.

-

Parameters

-
-
features : pd.DataFrame
-
A pandas dataframe with rows corresponding to individual samples -and columns as covariates.
-
outcomes : pd.DataFrame
-
A pandas dataframe with rows corresponding to individual samples -and columns 'time' and 'event'.
-
interventions : np.array
-
Boolean numpy array of treatment indicators. True means individual -was assigned a specific treatment.
-
horizons : int or float or list
-
Event-horizons at which to evaluate model performance.
-
metric : str, default='ibs'
-
Metric used to evaluate model performance and tune hyperparameters. -Options include: -- 'auc': Dynamic area under the ROC curve -- 'brs' : Brier Score -- 'ibs' : Integrated Brier Score -- 'ctd' : Concordance Index
-
-

Returns

-

Trained instance of Survival Virtual Twins Phenotyer.

- -
-
-def predict_proba(self, features) -
-
-

Estimate the probability that the Restrictred Mean Survival Time under -the Treatment group is greater than that under the control group.

-

Parameters

-
-
features : pd.DataFrame
-
a pandas dataframe with rows corresponding to individual samples -and columns as covariates.
-
-

Returns

-
-
np.array
-
a numpy array of the phenogroup probabilties in the format -[control_group, treated_group].
-
- -
-
-def predict(self, features) -
-
-

Extract phenogroups that maximize probability estimates.

-

Parameters

-
-
features : pd.DataFrame
-
a pandas dataframe with rows corresponding to individual samples -and columns as covariates.
-
-

Returns

-
-
np.array
-
a numpy array of the phenogroup labels
-
- -
-
-def fit_predict(self, features, outcomes, interventions, horizon) -
-
-

Fit and perform phenotyping on a given dataset.

-

Parameters

-
-
features : pd.DataFrame
-
A pandas dataframe with rows corresponding to individual samples -and columns as covariates.
-
outcomes : pd.DataFrame
-
A pandas dataframe with rows corresponding to individual samples -and columns 'time' and 'event'.
-
treatment_indicator : np.array
-
Boolean numpy array of treatment indicators. True means individual -was assigned a specific treatment.
-
horizon : np.float
-
The event horizon at which to compute the counterfacutal RMST for -regression.
-
-

Returns

-
-
np.array
-
a numpy array of the phenogroup labels.
-
- -
-
-
-
-
-
- -
- - - \ No newline at end of file diff --git a/html/auton_survival/preprocessing.html b/html/auton_survival/preprocessing.html deleted file mode 100644 index f633df1..0000000 --- a/html/auton_survival/preprocessing.html +++ /dev/null @@ -1,317 +0,0 @@ - - - - - - -auton_survival.preprocessing API documentation - - - - - - - - - - - - - -
-
-
-

Module auton_survival.preprocessing

-
-
- -
-
-
-
-
-
-
-
-

Classes

-
-
-class Imputer -(cat_feat_strat='ignore', num_feat_strat='mean', remaining='drop') -
-
-

A class to impute missing values in the input features.

-

Real world datasets are often subject to missing covariates. -Imputation replaces the missing values allowing downstream experiments. -This class allows multiple strategies to impute both categorical and -numerical/continuous covariates.

-

For categorical features, the class allows:

-
    -
  • replace: Replace all null values with a user specificed constant.
  • -
  • ignore: Keep all missing values as is.
  • -
  • mode: Replace null values with most commonly occurring variable.
  • -
-

For numerical/continuous features, -the user can choose between the following strategies:

-
    -
  • mean: Replace all missing values with the mean in the column.
  • -
  • median: Replace all missing values with the median in the column.
  • -
  • knn: Use a k Nearest Neighbour model to predict the missing value.
  • -
  • missforest: Use the MissForest model to predict the null values.
  • -
-

Parameters

-
-
cat_feat_strat : str
-
Strategy for imputing categorical features. -One of 'replace', 'ignore', 'mode'. Default is ignore.
-
num_feat_strat : str
-
Strategy for imputing numerical/continuous features. -One of 'mean', 'median', 'knn', 'missforest'. Default is mean.
-
remaining : str
-
Strategy for handling remaining columns. -One of 'ignore', 'drop'. Default is drop.
-
- -

Methods

-
-
-def fit(self, data, cat_feats=None, num_feats=None, fill_value=-1, n_neighbors=5, **kwargs) -
-
-
- -
-
-def transform(self, data) -
-
-
- -
-
-def fit_transform(self, data, cat_feats, num_feats, fill_value=-1, n_neighbors=5, **kwargs) -
-
-

Imputes dataset using imputation strategies.

-

Parameters

-
-
data : pandas.DataFrame
-
The dataframe to be imputed.
-
cat_feats : list
-
List of categorical features.
-
num_feats : list
-
List of numerical/continuous features.
-
fill_value : int
-
Value to be filled if cat_feat_strat='replace'.
-
n_neighbors : int
-
Number of neighbors to be used if num_feat_strat='knn'.
-
**kwargs
-
Passed on.
-
-

Returns

-
-
pandas.DataFrame
-
Imputed dataset.
-
- -
-
-
-
-class Scaler -(scaling_strategy='standard') -
-
-

Scaler to rescale numerical features.

-

For scaling, the user can choose between the following strategies:

-
    -
  • standard: Perform the standard scaling method.
  • -
  • minmax: Perform the minmax scaling method.
  • -
  • none: Do not perform scaling.
  • -
-

Parameters

-
-
scaling_strategy : str
-
Strategy to use for scaling numerical/continuous data. -One of 'standard', 'minmax', 'none'. -Default is standard.
-
- -

Methods

-
-
-def fit(self, data, num_feats=None) -
-
-

Fits scaler to dataset using scaling strategy.

-

Parameters

-
-
data : pandas.DataFrame
-
Dataframe to be scaled.
-
feats : list
-
List of numerical/continuous features to be scaled. -NOTE: if left empty, all features are interpreted as numerical.
-
-

Returns

-

Fitted instance of scaler.

- -
-
-def transform(self, data) -
-
-

Scales data using scaling strategy.

-

Parameters

-
-
data : pandas.DataFrame
-
Dataframe to be scaled.
-
feats : list
-
List of numerical/continuous features to be scaled. -NOTE: if left empty, all features are interpreted as numerical.
-
-

Returns

-

Fitted instance of scaler.

- -
-
-def fit_transform(self, data, num_feats=[]) -
-
-

Fits a scaler and rescales a dataset using a standard rescaling -strategy.

-

Parameters

-
-
data : pandas.DataFrame
-
Dataframe to be scaled.
-
feats : list
-
List of numerical/continuous features to be scaled. -NOTE: if left empty, all features are interpreted as numerical.
-
-

Returns

-
-
pandas.DataFrame
-
Scaled dataset.
-
- -
-
-
-
-class Preprocessor -(cat_feat_strat='ignore', num_feat_strat='mean', scaling_strategy='standard', one_hot=True, remaining='drop') -
-
-

A composite transform involving both scaling and preprocessing.

-

Parameters

-
-
cat_feat_strat : str
-
Strategy for imputing categorical features.
-
num_feat_strat : str
-
Strategy for imputing numerical/continuous features.
-
scaling_strategy : str
-
Strategy to use for scaling numerical/continuous data.
-
one_hot : bool
-
Whether to apply one hot encoding to the data.
-
remaining : str
-
Strategy for handling remaining columns.
-
- -

Methods

-
-
-def fit(self, data, cat_feats, num_feats, fill_value=-1, n_neighbors=5, **kwargs) -
-
-

Fit imputer and scaler to dataset.

- -
-
-def transform(self, data) -
-
-

Impute and scale the dataset.

- -
-
-def fit_transform(self, data, cat_feats, num_feats, fill_value=-1, n_neighbors=5, **kwargs) -
-
-

Imputes and scales dataset.

-

Parameters

-
-
data : pandas.DataFrame
-
The dataframe to be imputed.
-
cat_feats : list
-
List of categorical features.
-
num_feats : list
-
List of numerical/continuous features.
-
one_hot : bool
-
Indicating whether to perform one-hot encoding.
-
fill_value : int
-
Value to be filled if cat_feat_strat='replace'.
-
n_neighbors : int
-
Number of neighbors to be used if num_feat_strat='knn'.
-
**kwargs
-
Passed on.
-
-

Returns:

-
pandas.DataFrame: Imputed and scaled dataset.
-
- -
-
-
-
-
-
- -
- - - \ No newline at end of file diff --git a/html/auton_survival/reporting.html b/html/auton_survival/reporting.html deleted file mode 100644 index 2427d34..0000000 --- a/html/auton_survival/reporting.html +++ /dev/null @@ -1,114 +0,0 @@ - - - - - - -auton_survival.reporting API documentation - - - - - - - - - - - - - -
-
-
-

Module auton_survival.reporting

-
-
- -
-
-
-
-
-
-

Functions

-
-
-def plot_kaplanmeier(outcomes, groups=None, plot_counts=False, **kwargs) -
-
-

Plot a Kaplan-Meier Survival Estimator stratified by groups.

-

Parameters

-
-
outcomes : pandas.DataFrame
-
 
-
a pandas dataframe containing the survival outcomes. The index of the
-
dataframe should be the same as the index of the features dataframe.
-
Should contain a column named 'time' that contains the survival time and
-
a column named 'event' that contains the censoring status.
-
\delta_i = 1 if the event is observed.
-
groups : pandas.Series
-
 
-
a pandas series containing the groups to stratify the Kaplan-Meier
-
estimates by.
-
plot_counts : bool
-
 
-
-

if True, plot the number of at risk and censored individuals in each group.

- -
-
-def plot_nelsonaalen(outcomes, groups=None, **kwargs) -
-
-

Plot a Nelson-Aalen Survival Estimator stratified by groups.

-

Parameters

-
-
outcomes : pandas.DataFrame
-
 
-
a pandas dataframe containing the survival outcomes. The index of the
-
dataframe should be the same as the index of the features dataframe.
-
Should contain a column named 'time' that contains the survival time and
-
a column named 'event' that contains the censoring status.
-
\delta_i = 1 if the event is observed.
-
groups : pandas.Series
-
 
-
-

a pandas series containing the groups to stratify the Kaplan-Meier -estimates by.

- -
-
-
-
-
-
- -
- - - \ No newline at end of file diff --git a/html/auton_survival/utils.html b/html/auton_survival/utils.html deleted file mode 100644 index d3b9ff0..0000000 --- a/html/auton_survival/utils.html +++ /dev/null @@ -1,83 +0,0 @@ - - - - - - -auton_survival.utils API documentation - - - - - - - - - - - - - -
-
-
-

Module auton_survival.utils

-
-
- -
-
-
-
-
-
-

Functions

-
-
-def interp_x(y, x, thres) -
-
-
- -
-
-def func(x, y, x1, y1, x2, y2) -
-
-
- -
-
-
-
-
-
- -
- - - \ No newline at end of file