Chuyển đến nội dung
Skillpedia
Học máy33k · #9026

scikit-survival

Skill này làm gì

Skill này dạy agent của bạn dùng scikit-survival để phân tích sinh tồn. Nó xử lý dữ liệu bị kiểm duyệt, tức là những kết quả chưa biết đầy đủ. Skill dành cho nhà nghiên cứu theo dõi thời gian đến các sự kiện như tái phát hoặc hỏng hóc.

Khi nào nên dùng

  • ✓Khi bạn có dữ liệu thời gian đến sự kiện mà một số đối tượng chưa có sự kiện khi nghiên cứu kết thúc.
  • ✓Khi bạn muốn khớp mô hình Cox hoặc rừng sinh tồn ngẫu nhiên để dự đoán sự sống còn.
  • ✓Khi bạn cần kiểm tra mô hình sinh tồn bằng chỉ số concordance index hoặc điểm Brier.

Liên kết skill

https://github.com/davila7/claude-code-templates/blob/main/cli-tool/components/skills/scientific/scikit-survival/SKILL.md

Sao chép rồi dán vào AI của bạn (Claude, ChatGPT hoặc Cursor) và nhờ nó làm theo hướng dẫn.

Cách dùng

Cách dễ nhất: sao chép tin nhắn và dán vào AI của bạn. AI sẽ đọc skill và làm theo hướng dẫn.

Tin nhắn có sẵn để dán

Hãy dùng skill này để giúp tôi: https://github.com/davila7/claude-code-templates/blob/main/cli-tool/components/skills/scientific/scikit-survival/SKILL.md Đọc tệp SKILL.md tại liên kết đó và làm theo hướng dẫn cho việc của tôi.
Bạn muốn AI tự tìm những skill như thế này?Cài MCP Skillpedia miễn phí: chỉ một dòng, và AI sẽ tìm trong 15.000+ skill trước mỗi việc.Cài đặt trong 1 phút →

Ví dụ cách nhờ AI

“Khớp mô hình Cox và rừng sinh tồn ngẫu nhiên trên dữ liệu bệnh nhân của tôi, rồi so sánh concordance index của chúng.”

5 skill mới mỗi tuần. Đọc chỉ 1 phút.

Cách hoạt động

Agent chuẩn bị dữ liệu kết quả bị kiểm duyệt, khớp từng mô hình, và đánh giá bằng các chỉ số như concordance index. Sau đó nó cho biết mô hình nào dự đoán sự sống còn tốt hơn.

Nội dung kỹ thuật (SKILL.md gốc)

Lấy nguyên văn từ GitHub, do tác giả viết bằng tiếng Anh.

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 model
  • CoxnetSurvivalAnalysis: Penalized Cox with elastic net for high-dimensional data
  • IPCRidge: 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 method
  • GradientBoostingSurvivalAnalysis: Tree-based boosting for maximum performance
  • ComponentwiseGradientBoostingSurvivalAnalysis: Linear boosting with feature selection
  • ExtraSurvivalTrees: 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 speed
  • FastKernelSurvivalSVM: Kernel SVM for non-linear relationships
  • HingeLossSurvivalSVM: SVM with hinge loss
  • ClinicalKernelTransform: 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

  1. Handle missing values: Imputation strategies for features
  2. Encode categorical variables: One-hot encoding or label encoding
  3. Standardize features: Critical for SVMs and regularized Cox models
  4. Validate data quality: Check for negative times, sufficient events per feature
  5. 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:

Câu hỏi thường gặp

Dữ liệu bị kiểm duyệt là gì?

Đó là dữ liệu mà thời gian xảy ra sự kiện chỉ được biết một phần, như khi bệnh nhân rời nghiên cứu trước khi có sự kiện.

Những mô hình nào được bao gồm?

Skill bao gồm mô hình Cox, rừng sinh tồn ngẫu nhiên, gradient boosting và SVM sinh tồn.

Nó có vẽ được đường sinh tồn không?

Có. Skill bao gồm ước lượng Kaplan-Meier và Nelson-Aalen.

Chi tiết

Mô tả gốc của tác giả

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.

repo: davila7/claude-code-templates

Độ phổ biến

Sao GitHub
33k
Vị trí xếp hạng
#9026
Giấy phép
MIT
Cập nhật
2/11/2026

Skill này có hữu ích không?

0

Đăng nhập để bình chọn.

Bình luận

  • …

Thêm skill từ kho mã này

Skill tương tự