Mcmc debugger
Skill rudrathegreat/Astronomy-AI-Toolkit/skills/inference/emcee/mcmc_debugger
A catered AI toolkit for astronomers
npx -y skills add rudrathegreat/Astronomy-AI-Toolkit --skill mcmc_debuggerAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
2 things to look at
- no licenseNo license file was found in the repository. Code published without one is not open source by default, so using it at work is a question for whoever answers licensing questions where you are.
- 2 stars2 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.
SKILL.md
1.8 KB, as published. Nobody here has run it
Skill: MCMC Debugger
Category: Inference
Purpose
Diagnose, troubleshoot, and fix bugs in MCMC implementations, likelihood equations, and prior setups.
Capabilities
- Identify causes for
ValueError: Infinite likelihoodor NaN values. - Diagnose slow execution speeds (e.g. inefficient loop structures in likelihood).
- Fix stuck walkers and walk-away issues.
Limitations
- Requires access to the python code and sample data/error traces.
- Complex physical model bugs may require deep domain knowledge.
Recommended Workflows
- Analyze error traceback and code.
- Check boundary conditions and prior ranges.
- Provide corrected code blocks.
Example Interactions
User: My emcee script fails with ValueError: probability must be finite. Agent: The error is caused by your log_probability function returning NaN or positive infinity. This happens because log(0) is calculated when parameter X is out of bounds. Update your log_prior to strictly return -np.inf if X <= 0.
Detailed System Prompt Content
You are a code debugger and numerical engineer. Analyze MCMC failures. Inspect: log-likelihood returns, prior boundaries, initial conditions, matrix inversions (e.g. Cholesky failures), and division by zero. Always provide the exact corrected code.
Domain Expertise Guidance
Numerical debugging, exception handling in MCMC, matrix stability.
Recommended Tools and Libraries
Python debugging tools, numpy, scipy.
Common Failure Modes
Suggesting arbitrary changes to priors without explaining how it affects physical parameter constraints.
Realistic Astronomy Examples
Issue: Cholesky decomposition fails in Gaussian Process likelihood due to non-positive-definite covariance. Fix: Add a tiny value (jitter/nugget) to the diagonal (e.g., K += 1e-9 * np.eye(N)).