Workflow for read alignment, sorting, indexing, mapping statistics, and downstream-ready alignment artifacts.
中文简介正在准备中。当前显示原文说明。
End-to-end EHR predictive modeling pipeline with PyHealth, covering dataset loading, task definition, model training, evaluation, calibration, and clinical interpretation.
中文简介正在准备中。当前显示原文说明。
查看安装方法安装前可以查看交给 AI 代理的指令内容。
Reference examples assume:
pyhealth 1.1.6+ (stable) or 2.0+ (latest, requires Python ≥ 3.12)torch 2.0+pandas 2.0+Verify the runtime first:
python -c "import pyhealth; print(pyhealth.__version__)"pip show pyhealthUse this skill when the user needs to:
pyhealth.datasets class, then set_task.SampleBaseDataset, then follow the same pipeline.pyhealth.medcode independently without the full pipeline.pyhealth.metrics independently on existing predictions.references/technical_reference.md for dataset branching rules, task schema details, model selection guidance, and calibration caveats.references/commands_and_thresholds.md for concrete PyHealth code patterns, recommended thresholds, and output file conventions.SKILL.md as the main execution path and load reference files only when the task or failure mode needs the extra detail.split_by_patient over random splits that can leak patient data.diagnoses_icd, procedures_icd, prescriptions)results/model_checkpoint.pthresults/test_metrics.jsonresults/predictions.tsvqc/dataset_stats.tsvfigures/calibration_curve.pdffigures/feature_importance.pdfpyhealth.datasets — MIMIC3Dataset, MIMIC4Dataset, eICUDataset, OMOPDataset, SampleBaseDatasetpyhealth.tasks — MortalityPrediction, ReadmissionPrediction, DrugRecommendation, LengthOfStayPrediction, and custom task functionspyhealth.models — RNN, LSTM, GRU, Transformer, RETAIN, SafeDrug, GAMENet, AdaCare, ConCare, StageNetpyhealth.trainer — Trainerpyhealth.metrics — binary, multiclass, multilabel, fairness, interpretability metricspyhealth.medcode — InnerMap, CrossMap for ontology lookup and code mappingpyhealth.tokenizer — Tokenizer for code-to-index transformationspyhealth.calib — calibration and prediction set constructionfrom pyhealth.datasets import MIMIC3Dataset
from pyhealth.tasks import drug_recommendation_mimic3_fn
from pyhealth.datasets import split_by_patient, get_dataloader
from pyhealth.models import Transformer
from pyhealth.trainer import Trainer
# Step 1: load dataset
dataset = MIMIC3Dataset(
root="/path/to/mimic3/",
tables=["DIAGNOSES_ICD", "PROCEDURES_ICD", "PRESCRIPTIONS"],
code_mapping={"NDC": ("ATC", {"target_kwargs": {"level": 3}})},
)
# Step 2: define task
samples = dataset.set_task(task_fn=drug_recommendation_mimic3_fn)
# Step 3: split and build dataloaders
train_ds, val_ds, test_ds = split_by_patient(samples, [0.8, 0.1, 0.1])
train_loader = get_dataloader(train_ds, batch_size=32, shuffle=True)
val_loader = get_dataloader(val_ds, batch_size=32, shuffle=False)
test_loader = get_dataloader(test_ds, batch_size=32, shuffle=False)
# Step 4: initialize model
model = Transformer(
dataset=samples,
feature_keys=["conditions", "procedures"],
label_key="drugs",
mode="multilabel",
)
# Step 5: train
trainer = Trainer(model=model)
trainer.train(
train_dataloader=train_loader,
val_dataloader=val_loader,
epochs=50,
monitor="pr_auc_samples",
)
# Step 6: evaluate
metrics = trainer.evaluate(test_loader)
print(metrics)
Confirm the EHR source is accessible and the required tables are present. Inspect patient counts, visit counts, and code distributions before building tasks.
pyhealth.datasetsUse the appropriate dataset class. Apply code mappings at load time so downstream tasks and models operate on a consistent vocabulary. Record which tables and mappings were used.
Choose a predefined task function or write a custom one. Confirm the input schema (feature keys and types) and output schema (label key and mode: binary, multiclass, or multilabel) match the clinical question.
Always split by patient, not by visit or row, to prevent patient-level data leakage. Use split_by_patient and get_dataloader from pyhealth.datasets.
Select an architecture matched to the task and data size. Configure feature_keys, label_key, and mode explicitly. Use Trainer for training, validation monitoring, and checkpoint saving.
Compute task-appropriate metrics using pyhealth.metrics. For binary tasks report AUROC and AUPRC. For multilabel tasks report Jaccard and PR-AUC. Export a metrics JSON and a predictions TSV alongside the model checkpoint.
Apply calibration from pyhealth.calib when predicted probabilities will be used for clinical decision support. Use pyhealth.interpret for feature-level or visit-level attribution when the use case requires explainability.
results/
├── model_checkpoint.pth
├── test_metrics.json
└── predictions.tsv
qc/
├── dataset_stats.tsv
└── split_summary.tsv
figures/
├── calibration_curve.pdf
└── feature_importance.pdf
| Parameter | Typical value | Notes |
|---|---|---|
batch_size | 32 | reduce for large visit sequences or memory-constrained environments |
epochs | 50 | use early stopping via monitor metric |
monitor | "pr_auc_samples" for multilabel; "roc_auc" for binary | task-dependent |
split_by_patient ratios | [0.8, 0.1, 0.1] | always split by patient not by visit |
| code mapping level | ATC level 3 for drug codes | balance specificity and sparsity |
n_top_genes (HVG analog) | N/A for EHR; use vocabulary filtering | filter rare codes with min_count |
Machine Learning For OmicsMulti-Omics IntegrationPathway AnalysisReporting And Figure Exportpyhealth.medcode for standalone code mappingpyhealth.calib for post-hoc calibrationpyhealth.interpret for interpretability还没有评价。欢迎分享你的使用感受。
无需登录即可发表。欢迎分享使用感受、提问,或说明在哪些环境下无法运行。
还没有评论。来写第一条吧。
Workflow for read alignment, sorting, indexing, mapping statistics, and downstream-ready alignment artifacts.
中文简介正在准备中。当前显示原文说明。
Validate protein designs using AlphaFold2 structure prediction. Use this skill when: (1) Validating designed sequences fold correctly, (2) Predicting binder-target complex structures, (3) Calculating confidence metrics (pLDDT, pTM, ipTM), (4) Self-consistency validation of designs, (5) Multi-chain complex prediction with AlphaFold-Multimer. For faster single-chain prediction, use esm. For QC thresholds, use protein-qc.
中文简介正在准备中。当前显示原文说明。
AlphaFold2 / AlphaFold-Multimer structure prediction for validation and confidence scoring. Use this skill when: (1) Validating designed sequences fold correctly, (2) Predicting binder-target complex structures, (3) Calculating confidence metrics (pLDDT, pTM, ipTM), (4) Self-consistency validation of designs, (5) Multi-chain complex prediction with AlphaFold-Multimer. For faster single-chain prediction, use esm2-sequence-scoring. For QC thresholds, use protein-design-qc.
中文简介正在准备中。当前显示原文说明。
Workflow for event-level and isoform-level splicing analysis with sashimi-ready outputs and splice QC.
中文简介正在准备中。当前显示原文说明。
ATAC-seq processing with assay QC, MACS3 peak calling, consensus peak matrices, differential accessibility, and motif or footprint follow-up.
中文简介正在准备中。当前显示原文说明。
End-to-end binder design using BindCraft hallucination. Use this skill when: (1) Designing protein binders with built-in AF2 validation, (2) Running production-quality binder campaigns, (3) Using different design protocols (fast, default, slow), (4) Need joint backbone and sequence optimization, (5) Want high experimental success rate. For backbone-only generation, use rfdiffusion. For QC thresholds, use protein-qc. For tool selection guidance, use binder-design.
中文简介正在准备中。当前显示原文说明。