[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M7ECW2F7RYQCVNCZYS2SWSAH":3,"skill-same:01M7ECW2F7RYQCVNCZYS2SWSAH":103},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":19,"linkOnly":20,"markdownContent":21,"markdownBody":22,"frontMatter":23,"refName":29,"commitSha":30,"skillDirectory":31,"forksCount":32,"repositoryHtmlUrl":33,"repositoryHomepageUrl":6,"ownerHtmlUrl":34,"ownerBlogUrl":6,"ownerDescription":35,"updatedAt":36,"install":37,"resources":50},"01M7ECW2F7RYQCVNCZYS2SWSAH","scikit-survival",null,"Build, evaluate, and audit right-censored or competing-risk survival workflows with scikit-survival, including leakage-safe preprocessing, model selection, probability prediction, and censoring-aware metrics.","sanjeevafk\u002Fagent-skills","sanjeevafk","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F230678117?v=4","01M7C540EFY46ETG1NNWKS5X3Q","Sanjeev","01M7C540F366J5C1D587BMKH9Q",0,"MIT","https:\u002F\u002Fgithub.com\u002Fsanjeevafk\u002Fagent-skills\u002Fblob\u002Fmain\u002Fcollections\u002Fscientific-skills\u002Fscikit-survival\u002FSKILL.md",[],[],"2026-11-15 14:19:17",false,"---\nname: scikit-survival\ndescription: Build, evaluate, and audit right-censored or competing-risk survival workflows with scikit-survival, including leakage-safe preprocessing, model selection, probability prediction, and censoring-aware metrics.\nlicense: MIT\ncompatibility: Requires Python 3.11+, uv, and the pinned scikit-survival 0.28.0 stack for executable examples. Bundled CLIs are local and network-free by default.\nallowed-tools: Read Write Edit Bash\nmetadata:\n  version: \"1.1\"\n  skill-author: K-Dense Inc.\n---\n\n# scikit-survival\n\n## Scope\n\nUse this skill for scikit-survival 0.28.0 workflows involving:\n\n- right-censored structured outcomes;\n- Cox PH, Coxnet, IPC ridge, survival trees, forests, boosting, and SVMs;\n- discrimination, prediction error, calibration-oriented checks, and time-dependent prediction;\n- nonparametric cumulative incidence with competing risks;\n- scikit-learn pipelines, nested model selection, and reproducible reports.\n\nscikit-survival primarily models right-censored outcomes. Its built-in competing-risk\nsupport is nonparametric cumulative incidence; it does not provide Fine-Gray regression.\nDo not present model output as clinical advice, causal evidence, or proof of clinical\nutility.\n\n## Current release and installation\n\nVerified 2026-07-23:\n\n- Latest stable: **scikit-survival 0.28.0**, released 2026-07-05.\n- Python: **3.11 or later**; PyPI wheels cover CPython 3.11-3.14 on Linux\n  x86-64, macOS x86-64\u002FARM64, and Windows x86-64.\n- Runtime bounds: NumPy >=2.0.0, pandas >=2.2.0, SciPy >=1.13.0,\n  scikit-learn >=1.9.0,\u003C1.10, OSQP >=1.0.2, narwhals >=2.0.1.\n- 0.28 adds pandas\u002FPolars estimator support through narwhals and removes\n  `criterion` from `GradientBoostingSurvivalAnalysis`.\n\nCreate an isolated environment and install the tested snapshot:\n\n```bash\nuv venv --python 3.11\nsource .venv\u002Fbin\u002Factivate\nuv pip install \\\n  \"scikit-survival==0.28.0\" \\\n  \"scikit-learn==1.9.0\" \\\n  \"numpy==2.4.6\" \\\n  \"pandas==3.0.5\" \\\n  \"scipy==1.17.1\" \\\n  \"ecos==2.0.14\" \\\n  \"osqp==1.1.3\" \\\n  \"joblib==1.5.3\" \\\n  \"numexpr==2.14.2\" \\\n  \"narwhals==2.24.0\"\n```\n\nBinary wheels are preferred. A source build requires a C\u002FC++ compiler; OSQP may\nalso require CMake. This skill is MIT-licensed; the upstream scikit-survival package\nis GPL-3.0-or-later, so review upstream licensing before redistribution.\n\n## Non-negotiable workflow\n\n1. **Define the estimand and event coding.** Decide whether the target is\n   all-event survival, cause-specific hazard, or cause-specific cumulative incidence.\n2. **Validate outcomes.** Standard estimators need a two-field structured array:\n   boolean event first, observed time second. Competing-risk CIF instead needs a\n   separate integer event vector: 0=censored, 1..K=causes.\n3. **Split before learned preprocessing.** Never fit imputers, encoders, scalers,\n   feature selectors, or alpha choices on all rows before splitting.\n4. **Fit preprocessing inside a pipeline.** Unknown categories and missingness must\n   be handled using training-fold state only.\n5. **Tune without reusing evaluation data.** Use nested CV when reporting\n   cross-validated tuned performance, or reserve a truly untouched final holdout.\n6. **Fit censoring distributions on training data.** IPCW concordance, dynamic AUC,\n   and Brier metrics receive `survival_train`, never a pooled train+test outcome.\n7. **Restrict evaluation times.** Use a strictly increasing grid inside test\n   follow-up and below the end of training support where the estimated censoring\n   survival remains positive.\n8. **Match predictions to metrics.** Concordance\u002Fdynamic AUC consume higher-is-riskier\n   scores. Brier metrics consume survival probabilities with shape\n   `(n_test, n_times)`, not risk scores or unevaluated step functions.\n9. **Handle competing causes explicitly.** Standard survival probabilities and CIFs\n   answer different questions. Never estimate event-specific probability with\n   `1 - Kaplan-Meier` while censoring competing events.\n10. **Report limits.** Separate discrimination, calibration, prediction error,\n    and cumulative incidence. None alone establishes decision or clinical utility.\n\n## Outcome construction\n\n```python\nfrom sksurv.util import Surv\n\ny = Surv.from_arrays(event=event_bool, time=observed_time)\n# Equivalent for pandas or Polars:\ny = Surv.from_dataframe(\"event\", \"time\", frame)\n```\n\nThe first field is boolean (`True`=event, `False`=right-censored); the second is\nfloating-point time. Field names may vary, but field order and meaning may not.\nUse `references\u002Fdata-handling.md` before loading custom or competing-risk data.\n\n## Leakage-safe pipeline\n\n```python\nfrom sklearn.compose import ColumnTransformer\nfrom sklearn.impute import SimpleImputer\nfrom sklearn.model_selection import train_test_split\nfrom sklearn.pipeline import make_pipeline\nfrom sklearn.preprocessing import OneHotEncoder, StandardScaler\nfrom sksurv.linear_model import CoxPHSurvivalAnalysis\n\nX_train, X_test, y_train, y_test = train_test_split(\n    X, y, test_size=0.25, stratify=y[\"event\"], random_state=20260723\n)\n\npreprocess = ColumnTransformer(\n    [\n        (\"num\", make_pipeline(SimpleImputer(strategy=\"median\"), StandardScaler()), numeric),\n        (\n            \"cat\",\n            make_pipeline(\n                SimpleImputer(strategy=\"most_frequent\"),\n                OneHotEncoder(handle_unknown=\"ignore\", drop=\"first\", sparse_output=False),\n            ),\n            categorical,\n        ),\n    ],\n    sparse_threshold=0.0,\n)\nmodel = make_pipeline(preprocess, CoxPHSurvivalAnalysis(alpha=0.1, ties=\"efron\"))\nmodel.fit(X_train, y_train)\nrisk = model.predict(X_test)\n```\n\nThe split precedes every learned transformation. For repeated or grouped records,\nuse a group-aware split; for temporal deployment, use a time-respecting split.\n\n## Model choice\n\n- `CoxPHSurvivalAnalysis`: interpretable log-hazard coefficients under proportional\n  hazards; `alpha` is ridge shrinkage and `ties` is `\"breslow\"` or `\"efron\"`.\n- `CoxnetSurvivalAnalysis`: LASSO\u002Felastic-net path for high-dimensional data.\n  `l1_ratio` is in `(0, 1]`; use `fit_baseline_model=True` before requesting\n  survival or cumulative-hazard functions.\n- `IPCRidge`: IPC-weighted ridge AFT model; prediction is on a time\u002Flog-time scale,\n  not a Cox risk score.\n- `RandomSurvivalForest` \u002F `ExtraSurvivalTrees`: nonlinear survival and cumulative\n  hazard predictions; use permutation importance, not impurity importance.\n- `GradientBoostingSurvivalAnalysis`: tree boosting with `\"coxph\"`, `\"squared\"`,\n  or `\"ipcwls\"` loss. `criterion` was removed in 0.28.\n- `ComponentwiseGradientBoostingSurvivalAnalysis`: sparse linear componentwise\n  boosting.\n- `FastSurvivalSVM` \u002F `FastKernelSurvivalSVM`: ranking or regression objectives.\n  Only `rank_ratio=1` directly returns higher-is-riskier scores; SVMs do not yield\n  survival probabilities for Brier metrics.\n\nRead the model-specific reference before interpreting coefficients or predictions:\n`references\u002Fcox-models.md`, `references\u002Fensemble-models.md`, or\n`references\u002Fsvm-models.md`.\n\n## Prediction and metric contracts\n\n```python\nimport numpy as np\nfrom sksurv.metrics import (\n    brier_score,\n    concordance_index_ipcw,\n    cumulative_dynamic_auc,\n    integrated_brier_score,\n)\n\nrisk = model.predict(X_test)  # (n_test,), higher means higher event risk\nuno_c = concordance_index_ipcw(y_train, y_test, risk, tau=times[-1])[0]\nauc_t, mean_auc = cumulative_dynamic_auc(y_train, y_test, risk, times)\n\nsurv_fns = model.predict_survival_function(X_test)\nsurv_prob = np.vstack([fn(times) for fn in surv_fns])  # (n_test, n_times)\n_, brier_t = brier_score(y_train, y_test, surv_prob, times)\nibs = integrated_brier_score(y_train, y_test, surv_prob, times)\n```\n\n- Harrell C and Uno C measure rank discrimination, not calibration.\n- Cumulative\u002Fdynamic AUC measures discrimination at selected horizons and accepts\n  1D or time-dependent 2D risk scores; it rejects survival probabilities.\n- Brier score is censoring-weighted probability error and reflects both\n  discrimination and calibration. It is not a standalone calibration curve.\n- Calibration requires horizon-specific predicted-versus-observed checks on\n  independent data. scikit-survival 0.28 has no dedicated calibration-curve API.\n\nSee `references\u002Fevaluation-metrics.md` for assumptions, primary literature, safe\ntime-grid construction, and scorer wrappers.\n\n## Pipelines, metadata routing, and tuning\n\nOrdinary `Pipeline.fit(X, y)` needs no metadata-routing setup. Metric wrappers such\nas `as_concordance_index_ipcw_scorer` are estimator wrappers, not `scoring=`\ncallables:\n\n```python\nfrom sklearn.model_selection import GridSearchCV\nfrom sksurv.metrics import as_concordance_index_ipcw_scorer\n\nwrapped = as_concordance_index_ipcw_scorer(model, tau=tau)\nsearch = GridSearchCV(\n    wrapped,\n    {\"estimator__coxphsurvivalanalysis__alpha\": [0.01, 0.1, 1.0]},\n    cv=inner_splits,\n)\n```\n\nThe wrapper learns the censoring distribution from each fit fold. Prefix wrapped\nparameters with `estimator__`. Enable scikit-learn metadata routing only when\npassing extra metadata through a meta-estimator. For example, Coxnet's\n`set_predict_request(alpha=True)` matters only when routing the `alpha` prediction\nargument with `sklearn.set_config(enable_metadata_routing=True)`.\n\nUse an outer CV loop for an unbiased CV performance estimate after inner tuning.\nDo not select parameters and report performance from the same folds as if external.\n\n## Competing risks\n\n```python\nfrom sksurv.nonparametric import cumulative_incidence_competing_risks\n\n# status: integer array, 0=censored, 1..K=mutually exclusive causes\ntime, cif = cumulative_incidence_competing_risks(status, observed_time)\ntotal_cif = cif[0]\ncause_1_cif = cif[1]\n```\n\n`cif` has shape `(K + 1, n_times)`; row 0 is total risk and rows 1..K are\ncause-specific cumulative incidence. Cause-specific Cox models treat other causes\nas censored to estimate cause-specific hazards, but one such model's\n`1 - survival` is not the cause-specific CIF. See `references\u002Fcompeting-risks.md`.\n\n## Bundled local CLIs\n\nAll helpers use deterministic synthetic data when no input is given. They make no\nnetwork calls, reject URLs and symlinks, bound files\u002Frows\u002Ffeatures, avoid unsafe\npickle loading, and lazily import scientific packages.\n\n```bash\npython skills\u002Fscikit-survival\u002Fscripts\u002Fvalidate_survival_csv.py --help\npython skills\u002Fscikit-survival\u002Fscripts\u002Ftrain_survival_model.py --help\npython skills\u002Fscikit-survival\u002Fscripts\u002Fevaluate_survival_metrics.py --help\npython skills\u002Fscikit-survival\u002Fscripts\u002Fcompeting_risk_cif.py --help\npython skills\u002Fscikit-survival\u002Fscripts\u002Fmodel_report.py --help\n```\n\nTypical local flow:\n\n```bash\npython skills\u002Fscikit-survival\u002Fscripts\u002Fvalidate_survival_csv.py \\\n  --input data.csv --event-column event --time-column time \\\n  --feature-columns age,group,measurement --structured-output outcome.npy\n\npython skills\u002Fscikit-survival\u002Fscripts\u002Ftrain_survival_model.py \\\n  --input data.csv --event-column event --time-column time \\\n  --numeric-columns age,measurement --categorical-columns group \\\n  --model coxph --tune --prediction-output predictions.npz \\\n  --output training-summary.json\n\npython skills\u002Fscikit-survival\u002Fscripts\u002Fevaluate_survival_metrics.py \\\n  --input predictions.npz --output metrics-summary.json\n\npython skills\u002Fscikit-survival\u002Fscripts\u002Fmodel_report.py \\\n  --training-summary training-summary.json \\\n  --metrics-summary metrics-summary.json --output model-report.md\n```\n\nUse only de-identified, authorized local data. The bundled tests contain synthetic\nrecords only and no patient data or PHI.\n\n## Security triage\n\n`SECURITY.md` previously claimed this skill bundled package-shadowing files named\n`sklearn.py` and `sksurv.py`. The 2026-07-23 inventory confirmed those files did\nnot exist; the claim was a phantom analyzer finding. This refresh adds only\ndescriptively named helpers and no shadow modules, environment reads, or network\ncalls.\n\nNever name a project script after an imported package (including `sklearn.py`,\n`sksurv.py`, `numpy.py`, or `pandas.py`), because Python may import the local file\ninstead of the installed library. Inspect the working directory before executing\nexamples copied from untrusted sources.\n\n## Reference files\n\n- `references\u002Fdata-handling.md` — structured arrays, datasets, schema validation,\n  pandas\u002FPolars preprocessing, and leakage-safe splitting.\n- `references\u002Fcox-models.md` — Cox PH, Coxnet, IPCRidge, assumptions, and tuning.\n- `references\u002Fensemble-models.md` — forests, trees, boosting, predictions, and\n  permutation importance.\n- `references\u002Fsvm-models.md` — SVM objectives, prediction direction, scaling,\n  kernels, and limitations.\n- `references\u002Fevaluation-metrics.md` — metric inputs, censoring assumptions,\n  time grids, calibration, nested CV, and primary literature.\n- `references\u002Fcompeting-risks.md` — integer event coding, CIF API, built-in\n  datasets, cause-specific hazards, and unsupported Fine-Gray regression.\n\n## Dated sources\n\nOfficial API and compatibility sources, checked 2026-07-23:\n\n- [PyPI 0.28.0](https:\u002F\u002Fpypi.org\u002Fproject\u002Fscikit-survival\u002F) — released 2026-07-05.\n- [GitHub v0.28.0 release](https:\u002F\u002Fgithub.com\u002Fsebp\u002Fscikit-survival\u002Freleases\u002Ftag\u002Fv0.28.0)\n  — published 2026-07-05.\n- [0.28 release notes](https:\u002F\u002Fscikit-survival.readthedocs.io\u002Fen\u002Fstable\u002Frelease_notes\u002Fv0.28.html).\n- [Installation guide](https:\u002F\u002Fscikit-survival.readthedocs.io\u002Fen\u002Fstable\u002Finstall.html).\n- [Stable user guide](https:\u002F\u002Fscikit-survival.readthedocs.io\u002Fen\u002Fstable\u002Fuser_guide\u002Findex.html).\n- [Stable API reference](https:\u002F\u002Fscikit-survival.readthedocs.io\u002Fen\u002Fstable\u002Fapi\u002Findex.html).\n","# scikit-survival\n\n## Scope\n\nUse this skill for scikit-survival 0.28.0 workflows involving:\n\n- right-censored structured outcomes;\n- Cox PH, Coxnet, IPC ridge, survival trees, forests, boosting, and SVMs;\n- discrimination, prediction error, calibration-oriented checks, and time-dependent prediction;\n- nonparametric cumulative incidence with competing risks;\n- scikit-learn pipelines, nested model selection, and reproducible reports.\n\nscikit-survival primarily models right-censored outcomes. Its built-in competing-risk\nsupport is nonparametric cumulative incidence; it does not provide Fine-Gray regression.\nDo not present model output as clinical advice, causal evidence, or proof of clinical\nutility.\n\n## Current release and installation\n\nVerified 2026-07-23:\n\n- Latest stable: **scikit-survival 0.28.0**, released 2026-07-05.\n- Python: **3.11 or later**; PyPI wheels cover CPython 3.11-3.14 on Linux\n  x86-64, macOS x86-64\u002FARM64, and Windows x86-64.\n- Runtime bounds: NumPy >=2.0.0, pandas >=2.2.0, SciPy >=1.13.0,\n  scikit-learn >=1.9.0,\u003C1.10, OSQP >=1.0.2, narwhals >=2.0.1.\n- 0.28 adds pandas\u002FPolars estimator support through narwhals and removes\n  `criterion` from `GradientBoostingSurvivalAnalysis`.\n\nCreate an isolated environment and install the tested snapshot:\n\n```bash\nuv venv --python 3.11\nsource .venv\u002Fbin\u002Factivate\nuv pip install \\\n  \"scikit-survival==0.28.0\" \\\n  \"scikit-learn==1.9.0\" \\\n  \"numpy==2.4.6\" \\\n  \"pandas==3.0.5\" \\\n  \"scipy==1.17.1\" \\\n  \"ecos==2.0.14\" \\\n  \"osqp==1.1.3\" \\\n  \"joblib==1.5.3\" \\\n  \"numexpr==2.14.2\" \\\n  \"narwhals==2.24.0\"\n```\n\nBinary wheels are preferred. A source build requires a C\u002FC++ compiler; OSQP may\nalso require CMake. This skill is MIT-licensed; the upstream scikit-survival package\nis GPL-3.0-or-later, so review upstream licensing before redistribution.\n\n## Non-negotiable workflow\n\n1. **Define the estimand and event coding.** Decide whether the target is\n   all-event survival, cause-specific hazard, or cause-specific cumulative incidence.\n2. **Validate outcomes.** Standard estimators need a two-field structured array:\n   boolean event first, observed time second. Competing-risk CIF instead needs a\n   separate integer event vector: 0=censored, 1..K=causes.\n3. **Split before learned preprocessing.** Never fit imputers, encoders, scalers,\n   feature selectors, or alpha choices on all rows before splitting.\n4. **Fit preprocessing inside a pipeline.** Unknown categories and missingness must\n   be handled using training-fold state only.\n5. **Tune without reusing evaluation data.** Use nested CV when reporting\n   cross-validated tuned performance, or reserve a truly untouched final holdout.\n6. **Fit censoring distributions on training data.** IPCW concordance, dynamic AUC,\n   and Brier metrics receive `survival_train`, never a pooled train+test outcome.\n7. **Restrict evaluation times.** Use a strictly increasing grid inside test\n   follow-up and below the end of training support where the estimated censoring\n   survival remains positive.\n8. **Match predictions to metrics.** Concordance\u002Fdynamic AUC consume higher-is-riskier\n   scores. Brier metrics consume survival probabilities with shape\n   `(n_test, n_times)`, not risk scores or unevaluated step functions.\n9. **Handle competing causes explicitly.** Standard survival probabilities and CIFs\n   answer different questions. Never estimate event-specific probability with\n   `1 - Kaplan-Meier` while censoring competing events.\n10. **Report limits.** Separate discrimination, calibration, prediction error,\n    and cumulative incidence. None alone establishes decision or clinical utility.\n\n## Outcome construction\n\n```python\nfrom sksurv.util import Surv\n\ny = Surv.from_arrays(event=event_bool, time=observed_time)\n# Equivalent for pandas or Polars:\ny = Surv.from_dataframe(\"event\", \"time\", frame)\n```\n\nThe first field is boolean (`True`=event, `False`=right-censored); the second is\nfloating-point time. Field names may vary, but field order and meaning may not.\nUse `references\u002Fdata-handling.md` before loading custom or competing-risk data.\n\n## Leakage-safe pipeline\n\n```python\nfrom sklearn.compose import ColumnTransformer\nfrom sklearn.impute import SimpleImputer\nfrom sklearn.model_selection import train_test_split\nfrom sklearn.pipeline import make_pipeline\nfrom sklearn.preprocessing import OneHotEncoder, StandardScaler\nfrom sksurv.linear_model import CoxPHSurvivalAnalysis\n\nX_train, X_test, y_train, y_test = train_test_split(\n    X, y, test_size=0.25, stratify=y[\"event\"], random_state=20260723\n)\n\npreprocess = ColumnTransformer(\n    [\n        (\"num\", make_pipeline(SimpleImputer(strategy=\"median\"), StandardScaler()), numeric),\n        (\n            \"cat\",\n            make_pipeline(\n                SimpleImputer(strategy=\"most_frequent\"),\n                OneHotEncoder(handle_unknown=\"ignore\", drop=\"first\", sparse_output=False),\n            ),\n            categorical,\n        ),\n    ],\n    sparse_threshold=0.0,\n)\nmodel = make_pipeline(preprocess, CoxPHSurvivalAnalysis(alpha=0.1, ties=\"efron\"))\nmodel.fit(X_train, y_train)\nrisk = model.predict(X_test)\n```\n\nThe split precedes every learned transformation. For repeated or grouped records,\nuse a group-aware split; for temporal deployment, use a time-respecting split.\n\n## Model choice\n\n- `CoxPHSurvivalAnalysis`: interpretable log-hazard coefficients under proportional\n  hazards; `alpha` is ridge shrinkage and `ties` is `\"breslow\"` or `\"efron\"`.\n- `CoxnetSurvivalAnalysis`: LASSO\u002Felastic-net path for high-dimensional data.\n  `l1_ratio` is in `(0, 1]`; use `fit_baseline_model=True` before requesting\n  survival or cumulative-hazard functions.\n- `IPCRidge`: IPC-weighted ridge AFT model; prediction is on a time\u002Flog-time scale,\n  not a Cox risk score.\n- `RandomSurvivalForest` \u002F `ExtraSurvivalTrees`: nonlinear survival and cumulative\n  hazard predictions; use permutation importance, not impurity importance.\n- `GradientBoostingSurvivalAnalysis`: tree boosting with `\"coxph\"`, `\"squared\"`,\n  or `\"ipcwls\"` loss. `criterion` was removed in 0.28.\n- `ComponentwiseGradientBoostingSurvivalAnalysis`: sparse linear componentwise\n  boosting.\n- `FastSurvivalSVM` \u002F `FastKernelSurvivalSVM`: ranking or regression objectives.\n  Only `rank_ratio=1` directly returns higher-is-riskier scores; SVMs do not yield\n  survival probabilities for Brier metrics.\n\nRead the model-specific reference before interpreting coefficients or predictions:\n`references\u002Fcox-models.md`, `references\u002Fensemble-models.md`, or\n`references\u002Fsvm-models.md`.\n\n## Prediction and metric contracts\n\n```python\nimport numpy as np\nfrom sksurv.metrics import (\n    brier_score,\n    concordance_index_ipcw,\n    cumulative_dynamic_auc,\n    integrated_brier_score,\n)\n\nrisk = model.predict(X_test)  # (n_test,), higher means higher event risk\nuno_c = concordance_index_ipcw(y_train, y_test, risk, tau=times[-1])[0]\nauc_t, mean_auc = cumulative_dynamic_auc(y_train, y_test, risk, times)\n\nsurv_fns = model.predict_survival_function(X_test)\nsurv_prob = np.vstack([fn(times) for fn in surv_fns])  # (n_test, n_times)\n_, brier_t = brier_score(y_train, y_test, surv_prob, times)\nibs = integrated_brier_score(y_train, y_test, surv_prob, times)\n```\n\n- Harrell C and Uno C measure rank discrimination, not calibration.\n- Cumulative\u002Fdynamic AUC measures discrimination at selected horizons and accepts\n  1D or time-dependent 2D risk scores; it rejects survival probabilities.\n- Brier score is censoring-weighted probability error and reflects both\n  discrimination and calibration. It is not a standalone calibration curve.\n- Calibration requires horizon-specific predicted-versus-observed checks on\n  independent data. scikit-survival 0.28 has no dedicated calibration-curve API.\n\nSee `references\u002Fevaluation-metrics.md` for assumptions, primary literature, safe\ntime-grid construction, and scorer wrappers.\n\n## Pipelines, metadata routing, and tuning\n\nOrdinary `Pipeline.fit(X, y)` needs no metadata-routing setup. Metric wrappers such\nas `as_concordance_index_ipcw_scorer` are estimator wrappers, not `scoring=`\ncallables:\n\n```python\nfrom sklearn.model_selection import GridSearchCV\nfrom sksurv.metrics import as_concordance_index_ipcw_scorer\n\nwrapped = as_concordance_index_ipcw_scorer(model, tau=tau)\nsearch = GridSearchCV(\n    wrapped,\n    {\"estimator__coxphsurvivalanalysis__alpha\": [0.01, 0.1, 1.0]},\n    cv=inner_splits,\n)\n```\n\nThe wrapper learns the censoring distribution from each fit fold. Prefix wrapped\nparameters with `estimator__`. Enable scikit-learn metadata routing only when\npassing extra metadata through a meta-estimator. For example, Coxnet's\n`set_predict_request(alpha=True)` matters only when routing the `alpha` prediction\nargument with `sklearn.set_config(enable_metadata_routing=True)`.\n\nUse an outer CV loop for an unbiased CV performance estimate after inner tuning.\nDo not select parameters and report performance from the same folds as if external.\n\n## Competing risks\n\n```python\nfrom sksurv.nonparametric import cumulative_incidence_competing_risks\n\n# status: integer array, 0=censored, 1..K=mutually exclusive causes\ntime, cif = cumulative_incidence_competing_risks(status, observed_time)\ntotal_cif = cif[0]\ncause_1_cif = cif[1]\n```\n\n`cif` has shape `(K + 1, n_times)`; row 0 is total risk and rows 1..K are\ncause-specific cumulative incidence. Cause-specific Cox models treat other causes\nas censored to estimate cause-specific hazards, but one such model's\n`1 - survival` is not the cause-specific CIF. See `references\u002Fcompeting-risks.md`.\n\n## Bundled local CLIs\n\nAll helpers use deterministic synthetic data when no input is given. They make no\nnetwork calls, reject URLs and symlinks, bound files\u002Frows\u002Ffeatures, avoid unsafe\npickle loading, and lazily import scientific packages.\n\n```bash\npython skills\u002Fscikit-survival\u002Fscripts\u002Fvalidate_survival_csv.py --help\npython skills\u002Fscikit-survival\u002Fscripts\u002Ftrain_survival_model.py --help\npython skills\u002Fscikit-survival\u002Fscripts\u002Fevaluate_survival_metrics.py --help\npython skills\u002Fscikit-survival\u002Fscripts\u002Fcompeting_risk_cif.py --help\npython skills\u002Fscikit-survival\u002Fscripts\u002Fmodel_report.py --help\n```\n\nTypical local flow:\n\n```bash\npython skills\u002Fscikit-survival\u002Fscripts\u002Fvalidate_survival_csv.py \\\n  --input data.csv --event-column event --time-column time \\\n  --feature-columns age,group,measurement --structured-output outcome.npy\n\npython skills\u002Fscikit-survival\u002Fscripts\u002Ftrain_survival_model.py \\\n  --input data.csv --event-column event --time-column time \\\n  --numeric-columns age,measurement --categorical-columns group \\\n  --model coxph --tune --prediction-output predictions.npz \\\n  --output training-summary.json\n\npython skills\u002Fscikit-survival\u002Fscripts\u002Fevaluate_survival_metrics.py \\\n  --input predictions.npz --output metrics-summary.json\n\npython skills\u002Fscikit-survival\u002Fscripts\u002Fmodel_report.py \\\n  --training-summary training-summary.json \\\n  --metrics-summary metrics-summary.json --output model-report.md\n```\n\nUse only de-identified, authorized local data. The bundled tests contain synthetic\nrecords only and no patient data or PHI.\n\n## Security triage\n\n`SECURITY.md` previously claimed this skill bundled package-shadowing files named\n`sklearn.py` and `sksurv.py`. The 2026-07-23 inventory confirmed those files did\nnot exist; the claim was a phantom analyzer finding. This refresh adds only\ndescriptively named helpers and no shadow modules, environment reads, or network\ncalls.\n\nNever name a project script after an imported package (including `sklearn.py`,\n`sksurv.py`, `numpy.py`, or `pandas.py`), because Python may import the local file\ninstead of the installed library. Inspect the working directory before executing\nexamples copied from untrusted sources.\n\n## Reference files\n\n- `references\u002Fdata-handling.md` — structured arrays, datasets, schema validation,\n  pandas\u002FPolars preprocessing, and leakage-safe splitting.\n- `references\u002Fcox-models.md` — Cox PH, Coxnet, IPCRidge, assumptions, and tuning.\n- `references\u002Fensemble-models.md` — forests, trees, boosting, predictions, and\n  permutation importance.\n- `references\u002Fsvm-models.md` — SVM objectives, prediction direction, scaling,\n  kernels, and limitations.\n- `references\u002Fevaluation-metrics.md` — metric inputs, censoring assumptions,\n  time grids, calibration, nested CV, and primary literature.\n- `references\u002Fcompeting-risks.md` — integer event coding, CIF API, built-in\n  datasets, cause-specific hazards, and unsupported Fine-Gray regression.\n\n## Dated sources\n\nOfficial API and compatibility sources, checked 2026-07-23:\n\n- [PyPI 0.28.0](https:\u002F\u002Fpypi.org\u002Fproject\u002Fscikit-survival\u002F) — released 2026-07-05.\n- [GitHub v0.28.0 release](https:\u002F\u002Fgithub.com\u002Fsebp\u002Fscikit-survival\u002Freleases\u002Ftag\u002Fv0.28.0)\n  — published 2026-07-05.\n- [0.28 release notes](https:\u002F\u002Fscikit-survival.readthedocs.io\u002Fen\u002Fstable\u002Frelease_notes\u002Fv0.28.html).\n- [Installation guide](https:\u002F\u002Fscikit-survival.readthedocs.io\u002Fen\u002Fstable\u002Finstall.html).\n- [Stable user guide](https:\u002F\u002Fscikit-survival.readthedocs.io\u002Fen\u002Fstable\u002Fuser_guide\u002Findex.html).\n- [Stable API reference](https:\u002F\u002Fscikit-survival.readthedocs.io\u002Fen\u002Fstable\u002Fapi\u002Findex.html).\n",{"name":5,"license":15,"metadata":24,"description":7,"allowed-tools":27,"compatibility":28},{"version":25,"skill-author":26},"1.1","K-Dense Inc.","Read Write Edit Bash","Requires Python 3.11+, uv, and the pinned scikit-survival 0.28.0 stack for executable examples. Bundled CLIs are local and network-free by default.","main","4e084e84eb42fc53e144c89c0f7f48b39c8a4b0f","collections\u002Fscientific-skills\u002Fscikit-survival",1,"https:\u002F\u002Fgithub.com\u002Fsanjeevafk\u002Fagent-skills","https:\u002F\u002Fgithub.com\u002Fsanjeevafk","First make it work. Then make it right. Then make it fast.","2026-11-14 13:36:16",{"source":8,"skillName":5,"commands":38,"prompt":48,"zipAvailable":49},[39,42,45],{"tool":40,"command":41},"npx","npx skills add sanjeevafk\u002Fagent-skills --skill scikit-survival",{"tool":43,"command":44},"bunx","bunx skills add sanjeevafk\u002Fagent-skills --skill scikit-survival",{"tool":46,"command":47},"pnpm","pnpm dlx skills add sanjeevafk\u002Fagent-skills --skill scikit-survival","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fsanjeevafk\u002Fagent-skills\u002Fblob\u002Fmain\u002Fcollections\u002Fscientific-skills\u002Fscikit-survival\u002FSKILL.md",true,[51,57,61,65,69,73,77,83,87,91,95,99],{"path":52,"resourceType":53,"resourceTypeDesc":54,"sizeBytes":55,"sourceHtmlUrl":56},"references\u002Fcompeting-risks.md","REFERENCE","参考文档",9619,"https:\u002F\u002Fgithub.com\u002Fsanjeevafk\u002Fagent-skills\u002Fblob\u002Fmain\u002Fcollections\u002Fscientific-skills\u002Fscikit-survival\u002Freferences\u002Fcompeting-risks.md",{"path":58,"resourceType":53,"resourceTypeDesc":54,"sizeBytes":59,"sourceHtmlUrl":60},"references\u002Fcox-models.md",8567,"https:\u002F\u002Fgithub.com\u002Fsanjeevafk\u002Fagent-skills\u002Fblob\u002Fmain\u002Fcollections\u002Fscientific-skills\u002Fscikit-survival\u002Freferences\u002Fcox-models.md",{"path":62,"resourceType":53,"resourceTypeDesc":54,"sizeBytes":63,"sourceHtmlUrl":64},"references\u002Fdata-handling.md",9398,"https:\u002F\u002Fgithub.com\u002Fsanjeevafk\u002Fagent-skills\u002Fblob\u002Fmain\u002Fcollections\u002Fscientific-skills\u002Fscikit-survival\u002Freferences\u002Fdata-handling.md",{"path":66,"resourceType":53,"resourceTypeDesc":54,"sizeBytes":67,"sourceHtmlUrl":68},"references\u002Fensemble-models.md",9666,"https:\u002F\u002Fgithub.com\u002Fsanjeevafk\u002Fagent-skills\u002Fblob\u002Fmain\u002Fcollections\u002Fscientific-skills\u002Fscikit-survival\u002Freferences\u002Fensemble-models.md",{"path":70,"resourceType":53,"resourceTypeDesc":54,"sizeBytes":71,"sourceHtmlUrl":72},"references\u002Fevaluation-metrics.md",14123,"https:\u002F\u002Fgithub.com\u002Fsanjeevafk\u002Fagent-skills\u002Fblob\u002Fmain\u002Fcollections\u002Fscientific-skills\u002Fscikit-survival\u002Freferences\u002Fevaluation-metrics.md",{"path":74,"resourceType":53,"resourceTypeDesc":54,"sizeBytes":75,"sourceHtmlUrl":76},"references\u002Fsvm-models.md",8825,"https:\u002F\u002Fgithub.com\u002Fsanjeevafk\u002Fagent-skills\u002Fblob\u002Fmain\u002Fcollections\u002Fscientific-skills\u002Fscikit-survival\u002Freferences\u002Fsvm-models.md",{"path":78,"resourceType":79,"resourceTypeDesc":80,"sizeBytes":81,"sourceHtmlUrl":82},"scripts\u002F_common.py","SCRIPT","脚本",15360,"https:\u002F\u002Fgithub.com\u002Fsanjeevafk\u002Fagent-skills\u002Fblob\u002Fmain\u002Fcollections\u002Fscientific-skills\u002Fscikit-survival\u002Fscripts\u002F_common.py",{"path":84,"resourceType":79,"resourceTypeDesc":80,"sizeBytes":85,"sourceHtmlUrl":86},"scripts\u002Fcompeting_risk_cif.py",10334,"https:\u002F\u002Fgithub.com\u002Fsanjeevafk\u002Fagent-skills\u002Fblob\u002Fmain\u002Fcollections\u002Fscientific-skills\u002Fscikit-survival\u002Fscripts\u002Fcompeting_risk_cif.py",{"path":88,"resourceType":79,"resourceTypeDesc":80,"sizeBytes":89,"sourceHtmlUrl":90},"scripts\u002Fevaluate_survival_metrics.py",10672,"https:\u002F\u002Fgithub.com\u002Fsanjeevafk\u002Fagent-skills\u002Fblob\u002Fmain\u002Fcollections\u002Fscientific-skills\u002Fscikit-survival\u002Fscripts\u002Fevaluate_survival_metrics.py",{"path":92,"resourceType":79,"resourceTypeDesc":80,"sizeBytes":93,"sourceHtmlUrl":94},"scripts\u002Fmodel_report.py",11156,"https:\u002F\u002Fgithub.com\u002Fsanjeevafk\u002Fagent-skills\u002Fblob\u002Fmain\u002Fcollections\u002Fscientific-skills\u002Fscikit-survival\u002Fscripts\u002Fmodel_report.py",{"path":96,"resourceType":79,"resourceTypeDesc":80,"sizeBytes":97,"sourceHtmlUrl":98},"scripts\u002Ftrain_survival_model.py",19335,"https:\u002F\u002Fgithub.com\u002Fsanjeevafk\u002Fagent-skills\u002Fblob\u002Fmain\u002Fcollections\u002Fscientific-skills\u002Fscikit-survival\u002Fscripts\u002Ftrain_survival_model.py",{"path":100,"resourceType":79,"resourceTypeDesc":80,"sizeBytes":101,"sourceHtmlUrl":102},"scripts\u002Fvalidate_survival_csv.py",5721,"https:\u002F\u002Fgithub.com\u002Fsanjeevafk\u002Fagent-skills\u002Fblob\u002Fmain\u002Fcollections\u002Fscientific-skills\u002Fscikit-survival\u002Fscripts\u002Fvalidate_survival_csv.py",[104,111,119,128,136,143],{"skillNo":105,"name":106,"nameZh":6,"description":107,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":108,"categories":109,"keywords":110,"publishedAt":19},"01M7EFHX67M3KKXT1BXVPA5ADT","zarr-python","Chunked N-D arrays for cloud storage (Zarr-Python 3). Compressed arrays, parallel I\u002FO, S3\u002FGCS via fsspec, NumPy\u002FDask\u002FXarray compatible, for large-scale scientific computing pipelines.","https:\u002F\u002Fgithub.com\u002Fsanjeevafk\u002Fagent-skills\u002Fblob\u002Fmain\u002Fskills\u002Fzarr-python\u002FSKILL.md",[],[],{"skillNo":112,"name":113,"nameZh":6,"description":114,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":115,"sourceHtmlUrl":116,"categories":117,"keywords":118,"publishedAt":19},"01M7EFFQGM51TZBGRENXY50ZYM","whiteboard-diagrams","Create accurate, simple, hand-drawn whiteboard diagrams from a user's process, system, architecture, learning workflow, comparison, or causal explanation. Use when the user asks for a scribbly whiteboard visual, educational workflow graphic, hand-drawn explainer, or diagram like the bundled reference; ask one focused clarification question when the subject or relationships are missing, then generate and visually verify the final image.","https:\u002F\u002Fgithub.com\u002Fsanjeevafk\u002Fagent-skills\u002Fblob\u002Fmain\u002Fskills\u002Fwhiteboard-diagrams\u002FLICENSE","https:\u002F\u002Fgithub.com\u002Fsanjeevafk\u002Fagent-skills\u002Fblob\u002Fmain\u002Fskills\u002Fwhiteboard-diagrams\u002FSKILL.md",[],[],{"skillNo":120,"name":121,"nameZh":6,"description":122,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":123,"licenseFileUrl":124,"sourceHtmlUrl":125,"categories":126,"keywords":127,"publishedAt":19},"01M7EFF1CSQNTDMHFK4ZGY6NYK","webapp-testing","Toolkit for interacting with and testing local web applications using Playwright. Supports verifying frontend functionality, debugging UI behavior, capturing browser screenshots, and viewing browser logs.","Apache-2.0","https:\u002F\u002Fgithub.com\u002Fsanjeevafk\u002Fagent-skills\u002Fblob\u002Fmain\u002Fskills\u002Fwebapp-testing\u002FLICENSE.txt","https:\u002F\u002Fgithub.com\u002Fsanjeevafk\u002Fagent-skills\u002Fblob\u002Fmain\u002Fskills\u002Fwebapp-testing\u002FSKILL.md",[],[],{"skillNo":129,"name":130,"nameZh":6,"description":131,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":123,"licenseFileUrl":132,"sourceHtmlUrl":133,"categories":134,"keywords":135,"publishedAt":19},"01M7EFE8106X6C28FT8PA74427","web-artifacts-builder","Suite of tools for creating elaborate, multi-component claude.ai HTML artifacts using modern frontend web technologies (React, Tailwind CSS, shadcn\u002Fui). Use for complex artifacts requiring state management, routing, or shadcn\u002Fui components - not for simple single-file HTML\u002FJSX artifacts.","https:\u002F\u002Fgithub.com\u002Fsanjeevafk\u002Fagent-skills\u002Fblob\u002Fmain\u002Fskills\u002Fweb-artifacts-builder\u002FLICENSE.txt","https:\u002F\u002Fgithub.com\u002Fsanjeevafk\u002Fagent-skills\u002Fblob\u002Fmain\u002Fskills\u002Fweb-artifacts-builder\u002FSKILL.md",[],[],{"skillNo":137,"name":138,"nameZh":6,"description":139,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":140,"categories":141,"keywords":142,"publishedAt":19},"01M7EFCSNZM9G7ZHS6F127Q71X","verification-loop","A comprehensive verification system for Claude Code sessions.","https:\u002F\u002Fgithub.com\u002Fsanjeevafk\u002Fagent-skills\u002Fblob\u002Fmain\u002Fskills\u002Fverification-loop\u002FSKILL.md",[],[],{"skillNo":144,"name":145,"nameZh":6,"description":146,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":147,"sourceHtmlUrl":148,"categories":149,"keywords":150,"publishedAt":19},"01M7EFCE7EZMKPRYDDNKBQ9EEH","vercel-deploy","Deploy applications and websites to Vercel. Use when the user requests deployment actions like \"deploy my app\", \"deploy and give me the link\", \"push this live\", or \"create a preview deployment\".","https:\u002F\u002Fgithub.com\u002Fsanjeevafk\u002Fagent-skills\u002Fblob\u002Fmain\u002Fskills\u002Fvercel-deploy\u002FLICENSE.txt","https:\u002F\u002Fgithub.com\u002Fsanjeevafk\u002Fagent-skills\u002Fblob\u002Fmain\u002Fskills\u002Fvercel-deploy\u002FSKILL.md",[],[]]