scikit-survival
What it does
This skill teaches your agent to use scikit-survival for survival analysis. It handles censored data, where some outcomes are not yet known. It is for researchers studying time until events such as relapse or failure.
When to use it
- βWhen you have time-to-event data where some subjects did not have the event by the end of the study.
- βWhen you want to fit a Cox model or a random survival forest to predict survival.
- βWhen you need to check a survival model with the concordance index or Brier score.
Skill link
https://github.com/davila7/claude-code-templates/blob/main/cli-tool/components/skills/scientific/scikit-survival/SKILL.mdCopy it and paste it into your AI (Claude, ChatGPT or Cursor), asking it to follow the instructions.
How to use
The easiest way: copy the message and paste it into your AI. It reads the skill and follows the instructions.
Ready-to-paste message
For Claude Code, Codex or Cursor: run it in your project folder and the skill gets installed.
Download the SKILL.md and drop it into your agentβs skills folder.
Example of what to ask your AI
βFit a Cox model and a random survival forest on my patient data, and compare their concordance index.β
5 new skills a week. 1 minute to read.
How it works
The agent prepares the censored outcome data, fits each model, and evaluates it with metrics such as the concordance index. It then reports which model predicts survival better.
Technical content (original SKILL.md)
Original text by the author, straight from GitHub.
scikit-survival: Survival Analysis in Python
Overview
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.
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).
When to Use This Skill
Use this skill when:
- Performing survival analysis or time-to-event modeling
- Working with censored data (right-censored, left-censored, or interval-censored)
- Fitting Cox proportional hazards models (standard or penalized)
- Building ensemble survival models (Random Survival Forests, Gradient Boosting)
- Training Survival Support Vector Machines
- Evaluating survival model performance (concordance index, Brier score, time-dependent AUC)
- Estimating Kaplan-Meier or Nelson-Aalen curves
- Analyzing competing risks
- Preprocessing survival data or handling missing values in survival datasets
- Conducting any analysis using the scikit-survival library
Core Capabilities
1. Model Types and Selection
scikit-survival provides multiple model families, each suited for different scenarios:
Cox Proportional Hazards Models
Use for: Standard survival analysis with interpretable coefficients
CoxPHSurvivalAnalysis: Basic Cox modelCoxnetSurvivalAnalysis: Penalized Cox with elastic net for high-dimensional dataIPCRidge: Ridge regression for accelerated failure time models
See: references/cox-models.md for detailed guidance on Cox models, regularization, and interpretation
Ensemble Methods
Use for: High predictive performance with complex non-linear relationships
RandomSurvivalForest: Robust, non-parametric ensemble methodGradientBoostingSurvivalAnalysis: Tree-based boosting for maximum performanceComponentwiseGradientBoostingSurvivalAnalysis: Linear boosting with feature selectionExtraSurvivalTrees: Extremely randomized trees for additional regularization
See: references/ensemble-models.md for comprehensive guidance on ensemble methods, hyperparameter tuning, and when to use each model
Survival Support Vector Machines
Use for: Medium-sized datasets with margin-based learning
FastSurvivalSVM: Linear SVM optimized for speedFastKernelSurvivalSVM: Kernel SVM for non-linear relationshipsHingeLossSurvivalSVM: SVM with hinge lossClinicalKernelTransform: Specialized kernel for clinical + molecular data
See: references/svm-models.md for detailed SVM guidance, kernel selection, and hyperparameter tuning
Model Selection Decision Tree
Start
ββ High-dimensional data (p > n)?
β ββ Yes β CoxnetSurvivalAnalysis (elastic net)
β ββ No β Continue
β
ββ Need interpretable coefficients?
β ββ Yes β CoxPHSurvivalAnalysis or ComponentwiseGradientBoostingSurvivalAnalysis
β ββ No β Continue
β
ββ Complex non-linear relationships expected?
β ββ Yes
β β ββ Large dataset (n > 1000) β GradientBoostingSurvivalAnalysis
β β ββ Medium dataset β RandomSurvivalForest or FastKernelSurvivalSVM
β β ββ Small dataset β RandomSurvivalForest
β ββ No β CoxPHSurvivalAnalysis or FastSurvivalSVM
β
ββ For maximum performance β Try multiple models and compare
2. Data Preparation and Preprocessing
Before modeling, properly prepare survival data:
Creating Survival Outcomes
from sksurv.util import Surv
# From separate arrays
y = Surv.from_arrays(event=event_array, time=time_array)
# From DataFrame
y = Surv.from_dataframe('event', 'time', df)
Essential Preprocessing Steps
- Handle missing values: Imputation strategies for features
- Encode categorical variables: One-hot encoding or label encoding
- Standardize features: Critical for SVMs and regularized Cox models
- Validate data quality: Check for negative times, sufficient events per feature
- Train-test split: Maintain similar censoring rates across splits
See: references/data-handling.md for complete preprocessing workflows, data validation, and best practices
3. Model Evaluation
Proper evaluation is critical for survival models. Use appropriate metrics that account for censoring:
Concordance Index (C-index)
Primary metric for ranking/discrimination:
FAQ
What is censored data?
It is data where the event time is only partly known, such as when a patient leaves the study before the event.
Which models are included?
The skill covers Cox models, random survival forests, gradient boosting, and survival SVMs.
Can it draw survival curves?
Yes. The skill covers Kaplan-Meier and Nelson-Aalen estimates.
Details
Original description by the author
Comprehensive toolkit for survival analysis and time-to-event modeling in Python using scikit-survival. Use this skill when working with censored survival data, performing time-to-event analysis, fitting Cox models, Random Survival Forests, Gradient Boosting models, or Survival SVMs, evaluating survival predictions with concordance index or Brier score, handling competing risks, or implementing any survival analysis workflow with the scikit-survival library.
Popularity
- GitHub stars
- 33k
- Ranking position
- #9026
- License
- MIT
- Updated
- 11/2/2026
Comments
- β¦
More skills from this repository
owasp-security
33kTeaches your agent OWASP security guidance for web apps, APIs, mobile, containers and AI agents, so it can spot common weaknesses and suggest fixes.
agent-management
33kLets your agent create, list, hibernate, wake, rename and delete AI agents using the AI Maestro command line, managing each agent's lifecycle.
agent-messaging
33kLets your agent send, receive and reply to signed messages between AI agents, using the Agent Messaging Protocol, mostly on your own machine.
docs-search
33kLets your agent search auto-generated code documentation for function signatures, class definitions and comments, so it checks the real API before changing code.
Similar skills
pytorch-patterns
280kHelps your agent use PyTorch for machine learning models. It applies best practices for efficient model training and ensures reproducible results.
evm-token-decimals
280kHelps your agent avoid errors with decimal numbers across different blockchain networks. It ensures token values are accurate in transactions and calculations.
ito-inference
280kLets your agent check the availability of AI models for use. It connects the compute request with the ready model service.