stat-learn-bayesian-network
Learn the structure and conditional probabilities of a Bayesian network from observational data for causal discovery or dependency modeling.
- License 许可
- MIT
- 最近更新
- 2026-11-03
- Stars
- ★ 4
- Forks
- 1
01 前言 Front Matter
- name
- stat-learn-bayesian-network
- description
- Learn the structure and conditional probabilities of a Bayesian network from observational data for causal discovery or dependency modeling.
02 资源文件 4
- 参考文档agents/claude.yaml348 B
- 参考文档agents/openai.yaml349 B
- 参考文档config.yaml327 B
- 参考文档example.html15.5 KB
03 SKILL.md 正文
Skill: Bayesian Network Learning
Use When
- User wants to discover conditional dependencies and potential causal relationships among variables
- User wants to build a probabilistic graphical model for gene regulatory networks or clinical variable relationships
- User wants to perform probabilistic inference (e.g., what is the probability of disease given observed biomarkers)
Inputs
- Required:
- Data table (CSV or TSV): rows = observations, columns = variables (numeric or discrete)
- Optional:
- Variable types per column:
continuousordiscrete(default: auto-detected) - Structure learning algorithm:
hc(Hill-Climbing, default),tabu(Tabu search), orpc(PC algorithm, for large graphs) - Scoring function:
bic(default),aic, orbdeu(for discrete data) - Whitelist of edges to force (CSV: from, to)
- Blacklist of edges to forbid (CSV: from, to)
- Number of bootstrap replicates for edge confidence (default:
100) - Output directory (default:
./bn_output)
- Variable types per column:
Workflow
- Read data; detect or apply variable types; discretize continuous variables if needed for discrete BN learning (using quantile bins).
- Learn network structure using the specified algorithm and scoring function.
- Fit conditional probability distributions (CPDs) for each node given its parents.
- Compute bootstrap confidence for each edge (fraction of bootstrap replicates containing that edge).
- Report high-confidence edges (bootstrap support ≥ 0.8) vs. uncertain edges.
- Visualize the learned DAG: nodes = variables, directed edges = learned dependencies, edge width proportional to bootstrap support.
- Perform a Markov blanket analysis for each variable (its direct causes, effects, and spouses).
- Write the DAG adjacency matrix (TSV), CPD parameters (TSV), network plot (PDF), and Markov blanket summary (TSV) to output directory.
- Save the executable analysis script (
analysis_code.pyoranalysis_code.R) and software version manifest (session_info.txt) used to produce results.
Output Contract
- DAG adjacency matrix (TSV): row = parent, column = child, value = bootstrap support (0–1)
- CPD table (TSV): node, parents, CPD parameters
- Network visualization (PDF): DAG with node labels and edge confidence
- Markov blanket summary (TSV): variable, parents, children, spouses
- High-confidence edge list (TSV): from, to, bootstrap_support
- Reproducibility artifacts:
analysis_code.pyoranalysis_code.R, plussession_info.txt
Limits
- Structure learning is NP-hard; runtime grows exponentially with number of variables. Use PC algorithm for > 50 variables.
- Observational data cannot establish causality — learned edges represent statistical dependence, not necessarily causal direction.
- Requires sufficient sample size relative to number of variables (recommended: n > 5 × number of variables).
- Continuous variable discretization introduces information loss; consider Gaussian BN for purely continuous data.
- Common failure: cyclic structure detected during learning — enforce acyclicity via blacklisting or algorithm constraints.
04 同仓库更多 Skills
structured-intelligence-skill-creator
Create or update repository skills that conform to local templates, provider metadata requirements, registry rules, and validation workflows.
stat-survival-analysis
Estimate and compare survival functions using Kaplan-Meier curves and log-rank test, with optional Cox proportional hazards regression.
stat-pca
Perform PCA on a numeric data matrix to reduce dimensionality, visualize sample structure, and identify top contributing features.
stat-pairwise-correlation
Compute pairwise correlations and significance tests across all numeric variables, and produce a correlation heatmap.
stat-nonlinear-embedding
Embed high-dimensional data into 2D using t-SNE or UMAP for exploratory visualization of sample or cell relationships.
stat-logistic-regression
Fit a logistic regression model for binary outcomes, report odds ratios and model performance (AUC-ROC, confusion matrix).