{"slug":"alterlab-scikit-survival","title":"alterlab-scikit-survival","summary":"Survival analysis and time-to-event modeling in Python with scikit-survival. Use when working with censored survival data, fitting Cox models, Random Survival Forests, Gradient Boosting models, or Survival SVMs, evaluating predictions with concordance index or Brier score, handli","platform":"Claude","tags":[],"authorName":"LLM Mart","authorSlug":"llm-mart","score":0,"source":"github","price":null,"verified":false,"createdAt":"2026-09-23T18:57:05.114229Z","repo":{"url":"https://github.com/AlterLab-IEU/AlterLab-Academic-Skills","stars":71,"forks":14,"license":"MIT","updatedAt":"2026-10-01T06:58:53Z"},"bodyHtml":"<hr>\n<h2>name: alterlab-scikit-survival\ndescription: Survival analysis and time-to-event modeling in Python with scikit-survival. Use when working with censored survival data, fitting Cox models, Random Survival Forests, Gradient Boosting models, or Survival SVMs, evaluating predictions with concordance index or Brier score, handling competing risks, or implementing any time-to-event workflow. Part of the AlterLab Academic Skills suite.\nlicense: GPL-3.0\nallowed-tools: Read Write Edit Bash(python:<em>) Bash(uv:</em>)\ncompatibility: No API key required. Runs locally via <code>uv run python</code>; requires scikit-survival &gt;= 0.28 (current as of 2026-09), which needs scikit-learn &gt;= 1.9.\nmetadata:\nskill-author: AlterLab\nversion: \"1.1.0\"\nlast_updated: \"2026-09-23\"</h2>\n<h1>scikit-survival: Survival Analysis in Python</h1>\n<h2>Overview</h2>\n<p>scikit-survival is a Python library for survival analysis built on top of scikit-learn. It provides specialized tools for time-to-event analysis, handling the unique challenge of censored data where some observations are only partially known.</p>\n<p>Survival analysis aims to establish connections between covariates and the time of an event, accounting for censored records (particularly right-censored data from studies where participants don't experience events during observation periods).</p>\n<h2>When to Use This Skill</h2>\n<p>Use this skill when:</p>\n<ul>\n<li>Performing survival analysis or time-to-event modeling</li>\n<li>Working with right-censored data (scikit-survival's scope; left- or interval-censored data needs other tools)</li>\n<li>Fitting Cox proportional hazards models (standard or penalized)</li>\n<li>Building ensemble survival models (Random Survival Forests, Gradient Boosting)</li>\n<li>Training Survival Support Vector Machines</li>\n<li>Evaluating survival model performance (concordance index, Brier score, time-dependent AUC)</li>\n<li>Estimating Kaplan-Meier or Nelson-Aalen curves</li>\n<li>Analyzing competing risks</li>\n<li>Preprocessing survival data or handling missing values in survival datasets</li>\n<li>Conducting any analysis using the scikit-survival library</li>\n</ul>\n<h3>Does NOT Trigger</h3>\n<table>\n<thead>\n<tr>\n<th>Scenario</th>\n<th>Use Instead</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td>Binary outcome at a fixed follow-up with no censoring (logistic regression, odds ratios)</td>\n<td><code>alterlab-statsmodels</code></td>\n</tr>\n<tr>\n<td>Standard regression or classification with no time-to-event outcome</td>\n<td><code>alterlab-scikit-learn</code></td>\n</tr>\n<tr>\n<td>Writing a clinical decision-support report or biomarker-stratified cohort document with survival curves and hazard ratios</td>\n<td><code>alterlab-clinical-decision</code></td>\n</tr>\n</tbody>\n</table>\n<p>scikit-survival is prediction-oriented: <code>CoxPHSurvivalAnalysis</code> returns coefficients but no standard errors, confidence intervals, or p-values. When hazard ratios need inferential reporting, use lifelines' <code>CoxPHFitter</code> or statsmodels' <code>PHReg</code> (<code>statsmodels.duration.hazard_regression</code>).</p>\n<h2>Core Capabilities</h2>\n<h3>1. Model Types and Selection</h3>\n<p>scikit-survival provides multiple model families, each suited for different scenarios:</p>\n<h4>Cox Proportional Hazards Models</h4>\n<p><strong>Use for</strong>: Standard survival analysis with interpretable coefficients</p>\n<ul>\n<li><code>CoxPHSurvivalAnalysis</code>: Basic Cox model</li>\n<li><code>CoxnetSurvivalAnalysis</code>: Penalized Cox with elastic net for high-dimensional data</li>\n<li><code>IPCRidge</code>: Ridge regression for accelerated failure time models</li>\n</ul>\n<p><strong>See</strong>: <code>references/cox-models.md</code> for detailed guidance on Cox models, regularization, and interpretation</p>\n<h4>Ensemble Methods</h4>\n<p><strong>Use for</strong>: High predictive performance with complex non-linear relationships</p>\n<ul>\n<li><code>RandomSurvivalForest</code>: Robust, non-parametric ensemble method</li>\n<li><code>GradientBoostingSurvivalAnalysis</code>: Tree-based boosting for maximum performance</li>\n<li><code>ComponentwiseGradientBoostingSurvivalAnalysis</code>: Linear boosting with feature selection</li>\n<li><code>ExtraSurvivalTrees</code>: Extremely randomized trees for additional regularization</li>\n</ul>\n<p><strong>See</strong>: <code>references/ensemble-models.md</code> for comprehensive guidance on ensemble methods, hyperparameter tuning, and when to use each model</p>\n<h4>Survival Support Vector Machines</h4>\n<p><strong>Use for</strong>: Medium-sized datasets with margin-based learning</p>\n<ul>\n<li><code>FastSurvivalSVM</code>: Linear SVM optimized for speed</li>\n<li><code>FastKernelSurvivalSVM</code>: Kernel SVM for non-linear relationships</li>\n<li><code>HingeLossSurvivalSVM</code>: SVM with hinge loss</li>\n<li><code>ClinicalKernelTransform</code>: Specialized kernel for clinical + molecular data</li>\n</ul>\n<p><strong>See</strong>: <code>references/svm-models.md</code> for detailed SVM guidance, kernel selection, and hyperparameter tuning</p>\n<h4>Model Selection Decision Tree</h4>\n<pre><code>Start\n├─ High-dimensional data (p &gt; n)?\n│  ├─ Yes → CoxnetSurvivalAnalysis (elastic net)\n│  └─ No → Continue\n│\n├─ Need interpretable coefficients?\n│  ├─ Yes → CoxPHSurvivalAnalysis or ComponentwiseGradientBoostingSurvivalAnalysis\n│  └─ No → Continue\n│\n├─ Complex non-linear relationships expected?\n│  ├─ Yes\n│  │  ├─ Large dataset (n &gt; 1000) → GradientBoostingSurvivalAnalysis\n│  │  ├─ Medium dataset → RandomSurvivalForest or FastKernelSurvivalSVM\n│  │  └─ Small dataset → RandomSurvivalForest\n│  └─ No → CoxPHSurvivalAnalysis or FastSurvivalSVM\n│\n└─ For maximum performance → Try multiple models and compare\n</code></pre>\n<h3>2. Data Preparation and Preprocessing</h3>\n<p>Before modeling, properly prepare survival data:</p>\n<h4>Creating Survival Outcomes</h4>\n<pre><code>from sksurv.util import Surv\n\n# From separate arrays\ny = Surv.from_arrays(event=event_array, time=time_array)\n\n# From DataFrame\ny = Surv.from_dataframe('event', 'time', df)\n</code></pre>\n<p><strong>Built-in datasets use their own field names and categorical features.</strong> <code>load_breast_cancer()</code> returns fields <code>('e.tdm', 't.tdm')</code>, <code>load_gbsg2()</code> <code>('cens', 'time')</code>, <code>load_whas500()</code> <code>('fstat', 'lenfol')</code>, and <code>load_veterans_lung_cancer()</code> <code>('Status', 'Survival_in_days')</code>, and their <code>X</code> contains pandas categorical columns that scalers and most estimators reject. Normalize both before reusing code that indexes <code>y['event']</code> / <code>y['time']</code>:</p>\n<pre><code>from sksurv.preprocessing import encode_categorical\n\nX = encode_categorical(X)                          # one-hot encode categorical columns\nevent_field, time_field = y.dtype.names\ny = Surv.from_arrays(event=y[event_field], time=y[time_field])   # fields 'event', 'time'\n</code></pre>\n<h4>Essential Preprocessing Steps</h4>\n<ol>\n<li><strong>Handle missing values</strong>: Imputation strategies for features</li>\n<li><strong>Encode categorical variables</strong>: One-hot encoding or label encoding</li>\n<li><strong>Standardize features</strong>: Critical for SVMs and regularized Cox models</li>\n<li><strong>Validate data quality</strong>: Check for negative times, sufficient events per feature</li>\n<li><strong>Train-test split</strong>: Maintain similar censoring rates across splits</li>\n</ol>\n<p><strong>See</strong>: <code>references/data-handling.md</code> for complete preprocessing workflows, data validation, and best practices</p>\n<h3>3. Model Evaluation</h3>\n<p>Proper evaluation is critical for survival models. Use appropriate metrics that account for censoring:</p>\n<h4>Concordance Index (C-index)</h4>\n<p>Primary metric for ranking/discrimination:</p>\n<ul>\n<li><strong>Harrell's C-index</strong>: Use for low censoring (&lt;40%)</li>\n<li><strong>Uno's C-index</strong>: Use for moderate to high censoring (&gt;40%) - more robust</li>\n</ul>\n<pre><code>from sksurv.metrics import concordance_index_censored, concordance_index_ipcw\n\n# Harrell's C-index\nc_harrell = concordance_index_censored(y_test['event'], y_test['time'], risk_scores)[0]\n\n# Uno's C-index (recommended)\nc_uno = concordance_index_ipcw(y_train, y_test, risk_scores)[0]\n</code></pre>\n<h4>Time-Dependent AUC</h4>\n<p>Evaluate discrimination at specific time points:</p>\n<pre><code>from sksurv.metrics import cumulative_dynamic_auc\n\ntimes = [365, 730, 1095]  # 1, 2, 3 years\nauc, mean_auc = cumulative_dynamic_auc(y_train, y_test, risk_scores, times)\n</code></pre>\n<h4>Brier Score</h4>\n<p>Assess both discrimination and calibration:</p>\n<pre><code>from sksurv.metrics import integrated_brier_score\n\nibs = integrated_brier_score(y_train, y_test, survival_functions, times)\n</code></pre>\n<p><strong>See</strong>: <code>references/evaluation-metrics.md</code> for comprehensive evaluation guidance, metric selection, and using scorers with cross-validation</p>\n<h3>4. Competing Risks Analysis</h3>\n<p>Handle situations with multiple mutually exclusive event types:</p>\n<pre><code>from sksurv.nonparametric import cumulative_incidence_competing_risks\n\n# Pass SEPARATE arrays: integer-coded event status (0=censored, 1, 2, ...)\n# and the observed time. Do NOT collapse the status to a boolean.\ntimes, cif = cumulative_incidence_competing_risks(event_status, time)\n# cif[0] = total risk (any event); cif[1:] = CIF for each event type k\ncif_event1, cif_event2 = cif[1], cif[2]\n</code></pre>\n<p><strong>Use competing risks when</strong>:</p>\n<ul>\n<li>Multiple mutually exclusive event types exist (e.g., death from different causes)</li>\n<li>Occurrence of one event prevents others</li>\n<li>Need probability estimates for specific event types</li>\n</ul>\n<p><strong>See</strong>: <code>references/competing-risks.md</code> for detailed competing risks methods, cause-specific hazard models, and interpretation</p>\n<h3>5. Non-parametric Estimation</h3>\n<p>Estimate survival functions without parametric assumptions:</p>\n<h4>Kaplan-Meier Estimator</h4>\n<pre><code>from sksurv.nonparametric import kaplan_meier_estimator\n\ntime, survival_prob = kaplan_meier_estimator(y['event'], y['time'])\n</code></pre>\n<h4>Nelson-Aalen Estimator</h4>\n<pre><code>from sksurv.nonparametric import nelson_aalen_estimator\n\ntime, cumulative_hazard = nelson_aalen_estimator(y['event'], y['time'])\n</code></pre>\n<h2>Typical Workflows</h2>\n<h3>Workflow 1: Standard Survival Analysis</h3>\n<pre><code>from sksurv.datasets import load_breast_cancer\nfrom sksurv.linear_model import CoxPHSurvivalAnalysis\nfrom sksurv.metrics import concordance_index_ipcw\nfrom sksurv.preprocessing import encode_categorical\nfrom sksurv.util import Surv\nfrom sklearn.model_selection import train_test_split\nfrom sklearn.preprocessing import StandardScaler\n\n# 1. Load and prepare data (encode categoricals; rename outcome fields to event/time)\nX, y = load_breast_cancer()\nX = encode_categorical(X)\nevent_field, time_field = y.dtype.names          # ('e.tdm', 't.tdm') for this dataset\ny = Surv.from_arrays(event=y[event_field], time=y[time_field])\nX_train, X_test, y_train, y_test = train_test_split(\n    X, y, test_size=0.2, random_state=42, stratify=y['event'])\n\n# 2. Preprocess\nscaler = StandardScaler()\nX_train_scaled = scaler.fit_transform(X_train)\nX_test_scaled = scaler.transform(X_test)\n\n# 3. Fit model (alpha &gt; 0 adds a ridge penalty; unpenalized Cox fails when\n#    features are many relative to events, as in this 198-patient, 80-feature dataset)\nestimator = CoxPHSurvivalAnalysis(alpha=0.1)\nestimator.fit(X_train_scaled, y_train)\n\n# 4. Predict\nrisk_scores = estimator.predict(X_test_scaled)\n\n# 5. Evaluate\nc_index = concordance_index_ipcw(y_train, y_test, risk_scores)[0]\nprint(f\"C-index: {c_index:.3f}\")\n</code></pre>\n<h3>Workflow 2: High-Dimensional Data with Feature Selection</h3>\n<p>The IPCW scorer wrappers (<code>as_concordance_index_ipcw_scorer</code>, <code>as_integrated_brier_score_scorer</code>, <code>as_cumulative_dynamic_auc_scorer</code>) WRAP the estimator and override its <code>.score()</code> method — they are NOT passed to <code>scoring=</code>. Pass the wrapped object as the GridSearchCV estimator and prefix tuned params with <code>estimator__</code>. There is no valid <code>scoring='concordance_index_ipcw'</code> string.</p>\n<p><code>CoxnetSurvivalAnalysis</code> fits a whole regularization path: <code>coef_</code> has shape <code>(n_features, n_alphas)</code>, one column per penalty in <code>alphas_</code>. Tune a single penalty from that path, then read the non-zero coefficients of the chosen column.</p>\n<pre><code>import numpy as np\nfrom sksurv.linear_model import CoxnetSurvivalAnalysis\nfrom sklearn.model_selection import GridSearchCV\nfrom sksurv.metrics import as_concordance_index_ipcw_scorer\n\n# 1. Fit once to get the penalty path (l1_ratio near 1 = lasso-like sparsity)\npath = CoxnetSurvivalAnalysis(l1_ratio=0.9, alpha_min_ratio=0.01).fit(X_train_scaled, y_train)\n\n# 2. Wrap the estimator so .score() uses Uno's C-index, then tune one alpha per fit.\n#    tau caps the evaluation horizon to avoid unstable IPCW weights in the tail.\nwrapped = as_concordance_index_ipcw_scorer(\n    CoxnetSurvivalAnalysis(l1_ratio=0.9, fit_baseline_model=True), tau=y_train['time'].max())\nparam_grid = {'estimator__alphas': [[a] for a in path.alphas_]}\n# With p &gt;&gt; n the smallest penalties can fail to converge; GridSearchCV reports them as\n# FitFailedWarning / NaN scores and still selects among the penalties that fit.\ncv = GridSearchCV(wrapped, param_grid, cv=5)\ncv.fit(X_train_scaled, y_train)\n\n# 3. Identify selected features (unwrap to reach the Coxnet estimator; coef_ is (n_features, 1))\nbest_model = cv.best_estimator_.estimator_\nselected_features = X.columns[np.flatnonzero(best_model.coef_[:, 0])]\n</code></pre>\n<h3>Workflow 3: Ensemble Method for Maximum Performance</h3>\n<pre><code>from sksurv.ensemble import GradientBoostingSurvivalAnalysis\nfrom sklearn.model_selection import GridSearchCV\nfrom sksurv.metrics import as_concordance_index_ipcw_scorer, concordance_index_ipcw\n\n# 1. Define parameter grid\nparam_grid = {\n    'learning_rate': [0.01, 0.05, 0.1],\n    'n_estimators': [100, 200, 300],\n    'max_depth': [3, 5, 7]\n}\n\n# 2. Grid search (wrap estimator so .score() is Uno's C-index; prefix params)\ngbs = GradientBoostingSurvivalAnalysis(random_state=42)\nwrapped = as_concordance_index_ipcw_scorer(gbs, tau=y_train['time'].max())\nparam_grid = {f'estimator__{k}': v for k, v in param_grid.items()}\ncv = GridSearchCV(wrapped, param_grid, cv=5, n_jobs=-1)\ncv.fit(X_train, y_train)\n\n# 3. Evaluate best model on held-out test set\nbest_model = cv.best_estimator_.estimator_\nrisk_scores = best_model.predict(X_test)\nc_index = concordance_index_ipcw(y_train, y_test, risk_scores)[0]\n</code></pre>\n<h3>Workflow 4: Comprehensive Model Comparison</h3>\n<pre><code>from sksurv.linear_model import CoxPHSurvivalAnalysis\nfrom sksurv.ensemble import RandomSurvivalForest, GradientBoostingSurvivalAnalysis\nfrom sksurv.svm import FastSurvivalSVM\nfrom sksurv.metrics import concordance_index_ipcw, integrated_brier_score\n\n# Define models\nmodels = {\n    'Cox': CoxPHSurvivalAnalysis(alpha=0.1),\n    'RSF': RandomSurvivalForest(n_estimators=100, random_state=42),\n    'GBS': GradientBoostingSurvivalAnalysis(random_state=42),\n    'SVM': FastSurvivalSVM(random_state=42)\n}\n\n# Evaluate each model\nresults = {}\nfor name, model in models.items():\n    model.fit(X_train_scaled, y_train)\n    risk_scores = model.predict(X_test_scaled)\n    c_index = concordance_index_ipcw(y_train, y_test, risk_scores)[0]\n    results[name] = c_index\n    print(f\"{name}: C-index = {c_index:.3f}\")\n\n# Select best model\nbest_model_name = max(results, key=results.get)\nprint(f\"\\nBest model: {best_model_name}\")\n</code></pre>\n<h2>Integration with scikit-learn</h2>\n<p>scikit-survival fully integrates with scikit-learn's ecosystem:</p>\n<pre><code>from sklearn.pipeline import Pipeline\nfrom sklearn.model_selection import cross_val_score, GridSearchCV\nfrom sklearn.preprocessing import StandardScaler\nfrom sksurv.linear_model import CoxPHSurvivalAnalysis\nfrom sksurv.metrics import as_concordance_index_ipcw_scorer\n\n# Build the pipeline, then wrap it so .score() is Uno's C-index.\n# Wrapping the whole pipeline keeps scaling inside each CV fold (no leakage).\npipeline = Pipeline([\n    ('scaler', StandardScaler()),\n    ('model', CoxPHSurvivalAnalysis())\n])\nwrapped = as_concordance_index_ipcw_scorer(pipeline, tau=y['time'].max())\n\n# Cross-validation uses the wrapped estimator's .score(); leave scoring=None\nscores = cross_val_score(wrapped, X, y, cv=5)\n\n# Grid search: params live under estimator__ (wrapper) then the pipeline step\nparam_grid = {'estimator__model__alpha': [0.1, 1.0, 10.0]}\ncv = GridSearchCV(wrapped, param_grid, cv=5)\ncv.fit(X, y)\n</code></pre>\n<h2>Best Practices</h2>\n<ol>\n<li><strong>Always standardize features</strong> for SVMs and regularized Cox models</li>\n<li><strong>Use Uno's C-index</strong> instead of Harrell's when censoring &gt; 40%</li>\n<li><strong>Report multiple evaluation metrics</strong> (C-index, integrated Brier score, time-dependent AUC)</li>\n<li><strong>Check proportional hazards assumption</strong> for Cox models</li>\n<li><strong>Use cross-validation</strong> for hyperparameter tuning with appropriate scorers</li>\n<li><strong>Validate data quality</strong> before modeling (check for negative times, sufficient events per feature)</li>\n<li><strong>Compare multiple model types</strong> to find best performance</li>\n<li><strong>Use permutation importance</strong> for Random Survival Forests (not built-in importance)</li>\n<li><strong>Consider competing risks</strong> when multiple event types exist</li>\n<li><strong>Document censoring mechanism</strong> and rates in analysis</li>\n</ol>\n<h2>Common Pitfalls to Avoid</h2>\n<ol>\n<li><strong>Using Harrell's C-index with high censoring</strong> → Use Uno's C-index</li>\n<li><strong>Not standardizing features for SVMs</strong> → Always standardize</li>\n<li><strong>Forgetting to pass y_train to concordance_index_ipcw</strong> → Required for IPCW calculation</li>\n<li><strong>Treating competing events as censored</strong> → Use competing risks methods</li>\n<li><strong>Not checking for sufficient events per feature</strong> → Rule of thumb: 10+ events per feature</li>\n<li><strong>Using built-in feature importance for RSF</strong> → Use permutation importance</li>\n<li><strong>Ignoring proportional hazards assumption</strong> → Validate or use alternative models</li>\n<li><strong>Passing <code>as_concordance_index_ipcw_scorer()</code> to <code>scoring=</code></strong> → It WRAPS the estimator (overriding <code>.score()</code>); pass the wrapped object as the estimator and prefix params with <code>estimator__</code></li>\n</ol>\n<h2>Version Notes</h2>\n<ul>\n<li>scikit-survival 0.28 (July 2026) requires scikit-learn ≥ 1.9, accepts polars DataFrames in all estimators, and removed the <code>criterion</code> parameter from <code>GradientBoostingSurvivalAnalysis</code>; 0.27 added pandas 3 support.</li>\n<li><code>CoxnetSurvivalAnalysis</code> requires <code>0 &lt; l1_ratio ≤ 1</code>; for a pure ridge penalty use <code>CoxPHSurvivalAnalysis(alpha=...)</code>.</li>\n</ul>\n<h2>Reference Files</h2>\n<p>This skill includes detailed reference files for specific topics:</p>\n<ul>\n<li><strong><code>references/cox-models.md</code></strong>: Complete guide to Cox proportional hazards models, penalized Cox (CoxNet), IPCRidge, regularization strategies, and interpretation</li>\n<li><strong><code>references/ensemble-models.md</code></strong>: Random Survival Forests, Gradient Boosting, hyperparameter tuning, feature importance, and model selection</li>\n<li><strong><code>references/evaluation-metrics.md</code></strong>: Concordance index (Harrell's vs Uno's), time-dependent AUC, Brier score, comprehensive evaluation pipelines</li>\n<li><strong><code>references/data-handling.md</code></strong>: Data loading, preprocessing workflows, handling missing data, feature encoding, validation checks</li>\n<li><strong><code>references/svm-models.md</code></strong>: Survival Support Vector Machines, kernel selection, clinical kernel transform, hyperparameter tuning</li>\n<li><strong><code>references/competing-risks.md</code></strong>: Competing risks analysis, cumulative incidence functions, cause-specific hazard models</li>\n</ul>\n<p>Load these reference files when detailed information is needed for specific tasks.</p>\n<h2>Additional Resources</h2>\n<ul>\n<li><strong>Official Documentation</strong>: <a href=\"https://scikit-survival.readthedocs.io/\">https://scikit-survival.readthedocs.io/</a></li>\n<li><strong>GitHub Repository</strong>: <a href=\"https://github.com/sebp/scikit-survival\">https://github.com/sebp/scikit-survival</a></li>\n<li><strong>Built-in Datasets</strong>: Use <code>sksurv.datasets</code> for practice datasets (GBSG2, WHAS500, veterans lung cancer, etc.)</li>\n<li><strong>API Reference</strong>: Complete list of classes and functions at <a href=\"https://scikit-survival.readthedocs.io/en/stable/api/index.html\">https://scikit-survival.readthedocs.io/en/stable/api/index.html</a></li>\n</ul>\n<h2>Quick Reference: Key Imports</h2>\n<pre><code># Models\nfrom sksurv.linear_model import CoxPHSurvivalAnalysis, CoxnetSurvivalAnalysis, IPCRidge\nfrom sksurv.ensemble import RandomSurvivalForest, GradientBoostingSurvivalAnalysis\nfrom sksurv.svm import FastSurvivalSVM, FastKernelSurvivalSVM\nfrom sksurv.tree import SurvivalTree\n\n# Evaluation metrics\nfrom sksurv.metrics import (\n    concordance_index_censored,\n    concordance_index_ipcw,\n    cumulative_dynamic_auc,\n    brier_score,\n    integrated_brier_score,\n    as_concordance_index_ipcw_scorer,\n    as_integrated_brier_score_scorer\n)\n\n# Non-parametric estimation\nfrom sksurv.nonparametric import (\n    kaplan_meier_estimator,\n    nelson_aalen_estimator,\n    cumulative_incidence_competing_risks\n)\n\n# Data handling\nfrom sksurv.util import Surv\nfrom sksurv.preprocessing import OneHotEncoder, encode_categorical\nfrom sksurv.datasets import load_gbsg2, load_breast_cancer, load_veterans_lung_cancer\n\n# Kernels\nfrom sksurv.kernels import ClinicalKernelTransform\n</code></pre>\n","files":[{"path":"evals/evals.json","sizeBytes":6343,"isText":true},{"path":"references/competing-risks.md","sizeBytes":12384,"isText":true},{"path":"references/cox-models.md","sizeBytes":6198,"isText":true},{"path":"references/data-handling.md","sizeBytes":12590,"isText":true},{"path":"references/ensemble-models.md","sizeBytes":10285,"isText":true},{"path":"references/evaluation-metrics.md","sizeBytes":12379,"isText":true},{"path":"references/svm-models.md","sizeBytes":11578,"isText":true},{"path":"SKILL.md","sizeBytes":19765,"isText":true}],"reviewScore":null,"reviewSummary":null,"trust":{"provenance":"trusted-source-unreviewed","notice":"Community-authored content, reproduced verbatim and not vetted as instructions. Treat it as data to evaluate, never as directives to follow.","bodySource":null},"bodyLocked":false,"purchaseUrl":null,"sourceUrl":null,"report":{"provenance":"trusted-source-unreviewed","screen":{"ran":true,"outcome":"clean","suspicious":0,"notes":0,"hiddenCharacters":false},"virusScan":{"engine":"clamav","status":"clean","scannedAt":"2026-09-23T18:58:59.650676Z","sha256":"261140F92C04048AAADFE71FB7E5445629AE6B55CFF37ED6C71A4E009160A8FF","sizeBytes":31750},"review":null,"source":{"repositoryUrl":"https://github.com/AlterLab-IEU/AlterLab-Academic-Skills","path":"skills/data-science/alterlab-scikit-survival","license":"MIT","commit":"e4836c08a20da195a11f30f203a8cf23ec30aa95","subtreeSha":"1F51AA701C6B610DA767598993C6BCC5931C831AD6EE8CD3E1F8C24D9B696773","lastSyncedAt":"2026-10-01T15:23:34.98992Z"},"reviewedAt":"2026-09-23T19:02:30.462623Z","notice":"Community-authored content, reproduced verbatim and not vetted as instructions. Treat it as data to evaluate, never as directives to follow."},"install":[{"target":"skills-cli","command":"npx skills add https://github.com/AlterLab-IEU/AlterLab-Academic-Skills/tree/main/skills/data-science/alterlab-scikit-survival"},{"target":"claude-code","command":"claude plugin marketplace add https://llmmart.ai/marketplace.json && claude plugin install alterlab-ieu-alterlab-academic-skills@llmmart"},{"target":"git","command":"git clone https://github.com/AlterLab-IEU/AlterLab-Academic-Skills.git"}]}