bn-fit-modify

Recover Bayesian Network DAGs and estimate conditional probabilities from data.

134|21|Updated Nov 12, 2025
One-click install
npx skills add https://github.com/letta-ai/skills --skill bn-fit-modify
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: bn-fit-modify
Source: https://github.com/letta-ai/skills/tree/main/ai/benchmarks/letta/terminal-bench-2/trajectory-feedback/bn-fit-modify
Command: npx skills add https://github.com/letta-ai/skills --skill bn-fit-modify

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill guides Bayesian Network tasks including structure learning, parameter estimation, intervention (do-calculus), and sampling with libraries like pgmpy.

Core Features & Use Cases

  • Structure learning: DAG recovery from data under constraints.
  • Parameter estimation: Fit CPDs and verify with model diagnostics.
  • Interventions & sampling: Do-calculus operations and interventional sampling workflows.

Quick Start

Example: recover a DAG from data, fit CPDs, perform a do-intervention, and sample from the intervened network.

Frequently Asked Questions about bn-fit-modify

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I recover a Bayesian Network structure from data?

Structure learning recovers the DAG (directed acyclic graph) of a Bayesian Network from observational data. pgmpy and similar libraries use constraint-based or score-based algorithms to identify conditional independence relationships and infer edge direction, producing a network topology you can then fit with parameters.

Can I fit conditional probability distributions after learning a network structure?

Yes. After structure learning, parameter estimation fits CPDs (conditional probability distributions) to your data using model.fit(data). This estimates the probability tables for each node conditioned on its parents, completing a fully parameterized Bayesian Network ready for inference.

How do I perform interventions and causal inference on a Bayesian Network?

Do-calculus operations implement interventions by removing incoming edges to target nodes, simulating forced variable assignments. This lets you answer causal questions and sample from intervened networks, distinguishing observational inference from counterfactual scenarios.

What's the difference between observational and interventional sampling in Bayesian Networks?

Observational sampling follows the learned network structure as-is. Interventional sampling applies do-calculus modifications—removing edges and fixing node values—to generate samples that reflect causal interventions rather than passively observing data.

Can Bayesian Network structure learning work with constraints on edge direction or relationships?

Yes. Structure learning supports constraints that restrict which edges can appear, enforce domain knowledge about forbidden or required relationships, and guide the algorithm toward plausible DAGs that align with your prior beliefs about the system.

Do I need domain expertise to use structure learning on my data?

Structure learning can run unsupervised on raw data, but incorporating domain constraints—forbidden edges, required relationships, or prior beliefs—improves accuracy and interpretability. pgmpy supports both approaches depending on your confidence in the data.