一键导入
sklearn-eval-patterns
scikit-learn patterns for single-feature LR and RF evaluation with cross-validation and AUC scoring.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
scikit-learn patterns for single-feature LR and RF evaluation with cross-validation and AUC scoring.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
| name | sklearn-eval-patterns |
| description | scikit-learn patterns for single-feature LR and RF evaluation with cross-validation and AUC scoring. |
from sklearn.linear_model import LogisticRegression
from sklearn.ensemble import RandomForestClassifier
from sklearn.model_selection import StratifiedKFold, cross_val_predict
from sklearn.metrics import roc_auc_score
from sklearn.preprocessing import StandardScaler
def single_feature_model(X, y, n_folds=5):
cv = StratifiedKFold(n_splits=n_folds, shuffle=True, random_state=42)
# LR (needs scaling)
X_scaled = StandardScaler().fit_transform(X)
lr_probs = cross_val_predict(
LogisticRegression(max_iter=1000, random_state=42),
X_scaled, y, cv=cv, method="predict_proba",
)[:, 1]
# RF (no scaling needed)
rf_probs = cross_val_predict(
RandomForestClassifier(
n_estimators=100, max_depth=5, min_samples_leaf=10,
class_weight="balanced", random_state=42,
),
X, y, cv=cv, method="predict_proba",
)[:, 1]
return {
"auc_lr": roc_auc_score(y, lr_probs),
"auc_rf": roc_auc_score(y, rf_probs),
}
class_weight="balanced" — groups are heavily imbalancedmax_depth=None for RF — will overfit on small strataTesting conventions, patterns, and best practices for kreview. MANDATORY reading before adding or modifying tests.
nbdev cell directives, module export conventions, editing workflow, and testing patterns for notebook-first development. MANDATORY reading before editing any kreview Python module.
5-tier ctDNA labeling hierarchy with IMPACT tissue rescue, CH hotspot filtering, configurable VAF/variant thresholds, and continuous VAF regression stats.
How to parse cBioPortal MAF, SV, CNA, and clinical files for the labeling pipeline.
Structured debugging framework for kreview data pipeline issues
DuckDB glob scan patterns, connection management, and performance for kreview