{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# `auton-survival` Cross Validation Survival Regression\n", "\n", "`auton-survival` offers a simple to use API to train Survival Regression Models that performs cross validation model selection by minimizing integrated brier score. In this notebook we demonstrate the use of `auton-survival` to train survival models on the *SUPPORT* dataset in cross validation fashion." ] }, { "cell_type": "markdown", "metadata": {}, "source": [] }, { "cell_type": "code", "execution_count": 4, "metadata": {}, "outputs": [], "source": [ "import sys\n", "\n", "sys.path.append('../')\n", "from auton_survival import datasets\n", "outcomes, features = datasets.load_support()" ] }, { "cell_type": "code", "execution_count": 5, "metadata": {}, "outputs": [], "source": [ "from auton_survival.preprocessing import Preprocessor\n", "\n", "cat_feats = ['sex', 'dzgroup', 'dzclass', 'income', 'race', 'ca']\n", "num_feats = ['age', 'num.co', 'meanbp', 'wblc', 'hrt', 'resp', \n", "\t 'temp', 'pafi', 'alb', 'bili', 'crea', 'sod', 'ph', \n", " 'glucose', 'bun', 'urine', 'adlp', 'adls']\n", "\n", "features = Preprocessor().fit_transform(features, cat_feats=cat_feats, num_feats=num_feats)" ] }, { "cell_type": "code", "execution_count": 6, "metadata": {}, "outputs": [], "source": [ "import numpy as np\n", "horizons = [0.25, 0.5, 0.75]\n", "times = np.quantile(outcomes.time[outcomes.event==1], horizons).tolist()" ] }, { "cell_type": "code", "execution_count": 21, "metadata": {}, "outputs": [ { "name": "stderr", "output_type": "stream", "text": [ " 0%| | 0/4 [00:00