{"owner":"pymc-devs","repo":"pymc","hasSkills":true,"totalSkillsCount":1,"totalTokensCount":1069,"categories":["project-spec"],"hasMcp":false,"mcpConfig":null,"found":["ARCHITECTURE.md"],"skills":{"ARCHITECTURE.md":"# Architecture\nThis document describes the high-level architecture of PyMC.\n\n# Bird's Eye View\n[comment]: <> (https://drive.google.com/file/d/1lfEzokkNUJr_JIeSDQfha5a57pokz0qI)\n![Architecture](docs/Architecture.png)\nLets you define probabilistic graphs or models that can be easily used to compute log probabilities for posterior\ninference or to draw random samples for prior and posterior prediction.\n\nPyMC includes a few inference techniques, in particular:\n* Markov chain Monte Carlo\n* Variational Inference\n* Sequential Monte Carlo\n\nIt also contains numerous others pieces of functionality such as GraphviZ model visualization tools\nas well as various mathematical helper functions.\n\nThe most central pieces functionality of PyMC are shown visually below, as well as their\nrelation to other major packages. Not all modules are shown, either because\nthey are smaller or self explanatory in scope, or they're pending\ndeprecation\n\n## Functionality not in PyMC\nIt is easier to start with functionality that is not present in PyMC but\nrather deferred to outside libraries. If seeking to understand any\nof the topics below refer to that specific library\n\n### PyTensor\n* Gradient computation\n* Random number generation\n* Low level tensor operation definition\n* Low level operation graphs\n\n### ArviZ\n* Plotting e.g. Trace plots, rank plots, posterior plots\n* MCMC sampling diagnostics e.g. Rhat, Effective Sample Size.\n* Model comparison, particularly efficient leave-one-out cross-validation approximation\n* Data structures for Bayesian inference data storage and manipulation\n\n\n# Modules\nThe codebase of PyMC is split among single Python file modules at the root\nlevel, as well as directories with Python code for logical groups of functionality.\nAdmittedly the split between single `.py` module or directory is not defined by a strict\ncriteria but tends to occur when single `.py` files would be \"too big\".\nWe will with the modules needed implement \"simple MCMC\" model shown below\nbefore detailing the remaining modules, such as Variational Inference, Ordinary Differential Equations,\nor Sequential Monte Carlo.\n\n```python\nwith pm.Model() as model:\n  theta = pm.Beta(\"theta\", alpha=1, beta=2)\n  p = pm.Beta(\"n\", p=theta, n=2, observed=[1,2])\n  inf_data = pm.sample()\n\n\n```\n\n## {mod}`pymc.model`\nContains primitives related model definition and methods used for evaluation of the model.\nIn no particular order they are\n\n* `ContextMeta`: The context manager that enables the `with pm.Model() as model` syntax\n* {class}`~pymc.Factor`: Defines the methods for the various logprobs for models\n* `ValueGrad` which handles the value and gradient and is the main connection point to PyTensor\n* `Deterministic` and `Potential`: Definitions for two pieces of functionality useful in some model definitions\n\n## distributions/\nContains multiple submodules that define distributions,  as well as logic that aids in distributions usage.\nImportant modules to note are\n\n* `distribution.py`: This contains parent class for all PyMC distributions.\n  Notably the `distribution.distribution` class contains the `observed` argument which in PyMC differentiates\n  a random variable distribution from a likelihood distribution.\n\n* `logprob.py`: This contains the log probability logic for the distributions themselves.\n  The log probability calculation is deferred to PyTensor\n\n* `dist_math.py`: Various convenience operators for distributions.\n  This includes mathematical operators such as `logpower` or `all_true`methods.\n  It also contains a suite of lognormal methods and transformation methods\n\n## /sampling.py\nInterface to posterior, prior predictive, and posterior sampling as well as various methods to identify and initialize\nstepper methods. Also contains logic to check for \"all continuous\" variables and initialize NUTS\n\n## step_methods/\nContains various step methods for various sampling algorithms, such as MCMC, and SMC. `step_methods.hmc` includes\nthe Hamiltonian Monte Carlo sampling methods as well as helper functions such as the integrators used for those methods\n\n## tests/\nAll tests for testing functionality of codebase. All modules prefixed with `test_` are tests themselves, whereas all\nother modules contain various supporting code such as fixtures, configurations, etc\n"},"files":{"ARCHITECTURE.md":"# Architecture\nThis document describes the high-level architecture of PyMC.\n\n# Bird's Eye View\n[comment]: <> (https://drive.google.com/file/d/1lfEzokkNUJr_JIeSDQfha5a57pokz0qI)\n![Architecture](docs/Architecture.png)\nLets you define probabilistic graphs or models that can be easily used to compute log probabilities for posterior\ninference or to draw random samples for prior and posterior prediction.\n\nPyMC includes a few inference techniques, in particular:\n* Markov chain Monte Carlo\n* Variational Inference\n* Sequential Monte Carlo\n\nIt also contains numerous others pieces of functionality such as GraphviZ model visualization tools\nas well as various mathematical helper functions.\n\nThe most central pieces functionality of PyMC are shown visually below, as well as their\nrelation to other major packages. Not all modules are shown, either because\nthey are smaller or self explanatory in scope, or they're pending\ndeprecation\n\n## Functionality not in PyMC\nIt is easier to start with functionality that is not present in PyMC but\nrather deferred to outside libraries. If seeking to understand any\nof the topics below refer to that specific library\n\n### PyTensor\n* Gradient computation\n* Random number generation\n* Low level tensor operation definition\n* Low level operation graphs\n\n### ArviZ\n* Plotting e.g. Trace plots, rank plots, posterior plots\n* MCMC sampling diagnostics e.g. Rhat, Effective Sample Size.\n* Model comparison, particularly efficient leave-one-out cross-validation approximation\n* Data structures for Bayesian inference data storage and manipulation\n\n\n# Modules\nThe codebase of PyMC is split among single Python file modules at the root\nlevel, as well as directories with Python code for logical groups of functionality.\nAdmittedly the split between single `.py` module or directory is not defined by a strict\ncriteria but tends to occur when single `.py` files would be \"too big\".\nWe will with the modules needed implement \"simple MCMC\" model shown below\nbefore detailing the remaining modules, such as Variational Inference, Ordinary Differential Equations,\nor Sequential Monte Carlo.\n\n```python\nwith pm.Model() as model:\n  theta = pm.Beta(\"theta\", alpha=1, beta=2)\n  p = pm.Beta(\"n\", p=theta, n=2, observed=[1,2])\n  inf_data = pm.sample()\n\n\n```\n\n## {mod}`pymc.model`\nContains primitives related model definition and methods used for evaluation of the model.\nIn no particular order they are\n\n* `ContextMeta`: The context manager that enables the `with pm.Model() as model` syntax\n* {class}`~pymc.Factor`: Defines the methods for the various logprobs for models\n* `ValueGrad` which handles the value and gradient and is the main connection point to PyTensor\n* `Deterministic` and `Potential`: Definitions for two pieces of functionality useful in some model definitions\n\n## distributions/\nContains multiple submodules that define distributions,  as well as logic that aids in distributions usage.\nImportant modules to note are\n\n* `distribution.py`: This contains parent class for all PyMC distributions.\n  Notably the `distribution.distribution` class contains the `observed` argument which in PyMC differentiates\n  a random variable distribution from a likelihood distribution.\n\n* `logprob.py`: This contains the log probability logic for the distributions themselves.\n  The log probability calculation is deferred to PyTensor\n\n* `dist_math.py`: Various convenience operators for distributions.\n  This includes mathematical operators such as `logpower` or `all_true`methods.\n  It also contains a suite of lognormal methods and transformation methods\n\n## /sampling.py\nInterface to posterior, prior predictive, and posterior sampling as well as various methods to identify and initialize\nstepper methods. Also contains logic to check for \"all continuous\" variables and initialize NUTS\n\n## step_methods/\nContains various step methods for various sampling algorithms, such as MCMC, and SMC. `step_methods.hmc` includes\nthe Hamiltonian Monte Carlo sampling methods as well as helper functions such as the integrators used for those methods\n\n## tests/\nAll tests for testing functionality of codebase. All modules prefixed with `test_` are tests themselves, whereas all\nother modules contain various supporting code such as fixtures, configurations, etc\n"},"items":[{"name":"ARCHITECTURE.md","path":"ARCHITECTURE.md","rawUrl":"https://raw.githubusercontent.com/pymc-devs/pymc/HEAD/ARCHITECTURE.md","title":"System Architecture & Module Boundaries","category":"project-spec","format":"markdown","content":"# Architecture\nThis document describes the high-level architecture of PyMC.\n\n# Bird's Eye View\n[comment]: <> (https://drive.google.com/file/d/1lfEzokkNUJr_JIeSDQfha5a57pokz0qI)\n![Architecture](docs/Architecture.png)\nLets you define probabilistic graphs or models that can be easily used to compute log probabilities for posterior\ninference or to draw random samples for prior and posterior prediction.\n\nPyMC includes a few inference techniques, in particular:\n* Markov chain Monte Carlo\n* Variational Inference\n* Sequential Monte Carlo\n\nIt also contains numerous others pieces of functionality such as GraphviZ model visualization tools\nas well as various mathematical helper functions.\n\nThe most central pieces functionality of PyMC are shown visually below, as well as their\nrelation to other major packages. Not all modules are shown, either because\nthey are smaller or self explanatory in scope, or they're pending\ndeprecation\n\n## Functionality not in PyMC\nIt is easier to start with functionality that is not present in PyMC but\nrather deferred to outside libraries. If seeking to understand any\nof the topics below refer to that specific library\n\n### PyTensor\n* Gradient computation\n* Random number generation\n* Low level tensor operation definition\n* Low level operation graphs\n\n### ArviZ\n* Plotting e.g. Trace plots, rank plots, posterior plots\n* MCMC sampling diagnostics e.g. Rhat, Effective Sample Size.\n* Model comparison, particularly efficient leave-one-out cross-validation approximation\n* Data structures for Bayesian inference data storage and manipulation\n\n\n# Modules\nThe codebase of PyMC is split among single Python file modules at the root\nlevel, as well as directories with Python code for logical groups of functionality.\nAdmittedly the split between single `.py` module or directory is not defined by a strict\ncriteria but tends to occur when single `.py` files would be \"too big\".\nWe will with the modules needed implement \"simple MCMC\" model shown below\nbefore detailing the remaining modules, such as Variational Inference, Ordinary Differential Equations,\nor Sequential Monte Carlo.\n\n```python\nwith pm.Model() as model:\n  theta = pm.Beta(\"theta\", alpha=1, beta=2)\n  p = pm.Beta(\"n\", p=theta, n=2, observed=[1,2])\n  inf_data = pm.sample()\n\n\n```\n\n## {mod}`pymc.model`\nContains primitives related model definition and methods used for evaluation of the model.\nIn no particular order they are\n\n* `ContextMeta`: The context manager that enables the `with pm.Model() as model` syntax\n* {class}`~pymc.Factor`: Defines the methods for the various logprobs for models\n* `ValueGrad` which handles the value and gradient and is the main connection point to PyTensor\n* `Deterministic` and `Potential`: Definitions for two pieces of functionality useful in some model definitions\n\n## distributions/\nContains multiple submodules that define distributions,  as well as logic that aids in distributions usage.\nImportant modules to note are\n\n* `distribution.py`: This contains parent class for all PyMC distributions.\n  Notably the `distribution.distribution` class contains the `observed` argument which in PyMC differentiates\n  a random variable distribution from a likelihood distribution.\n\n* `logprob.py`: This contains the log probability logic for the distributions themselves.\n  The log probability calculation is deferred to PyTensor\n\n* `dist_math.py`: Various convenience operators for distributions.\n  This includes mathematical operators such as `logpower` or `all_true`methods.\n  It also contains a suite of lognormal methods and transformation methods\n\n## /sampling.py\nInterface to posterior, prior predictive, and posterior sampling as well as various methods to identify and initialize\nstepper methods. Also contains logic to check for \"all continuous\" variables and initialize NUTS\n\n## step_methods/\nContains various step methods for various sampling algorithms, such as MCMC, and SMC. `step_methods.hmc` includes\nthe Hamiltonian Monte Carlo sampling methods as well as helper functions such as the integrators used for those methods\n\n## tests/\nAll tests for testing functionality of codebase. All modules prefixed with `test_` are tests themselves, whereas all\nother modules contain various supporting code such as fixtures, configurations, etc\n","isInternal":false,"tokens":1069,"sizeBytes":4273}],"systemPromptSnippet":"<yakaai_skills repo=\"pymc-devs/pymc\">\n<!-- File: ARCHITECTURE.md (Tokens: ~1069 | Category: project-spec) -->\n# Architecture\nThis document describes the high-level architecture of PyMC.\n\n# Bird's Eye View\n[comment]: <> (https://drive.google.com/file/d/1lfEzokkNUJr_JIeSDQfha5a57pokz0qI)\n![Architecture](docs/Architecture.png)\nLets you define probabilistic graphs or models that can be easily used to compute log probabilities for posterior\ninference or to draw random samples for prior and posterior prediction.\n\nPyMC includes a few inference techniques, in particular:\n* Markov chain Monte Carlo\n* Variational Inference\n* Sequential Monte Carlo\n\nIt also contains numerous others pieces of functionality such as GraphviZ model visualization tools\nas well as various mathematical helper functions.\n\nThe most central pieces functionality of PyMC are shown visually below, as well as their\nrelation to other major packages. Not all modules are shown, either because\nthey are smaller or self explanatory in scope, or they're pending\ndeprecation\n\n## Functionality not in PyMC\nIt is easier to start with functionality that is not present in PyMC but\nrather deferred to outside libraries. If seeking to understand any\nof the topics below refer to that specific library\n\n### PyTensor\n* Gradient computation\n* Random number generation\n* Low level tensor operation definition\n* Low level operation graphs\n\n### ArviZ\n* Plotting e.g. Trace plots, rank plots, posterior plots\n* MCMC sampling diagnostics e.g. Rhat, Effective Sample Size.\n* Model comparison, particularly efficient leave-one-out cross-validation approximation\n* Data structures for Bayesian inference data storage and manipulation\n\n\n# Modules\nThe codebase of PyMC is split among single Python file modules at the root\nlevel, as well as directories with Python code for logical groups of functionality.\nAdmittedly the split between single `.py` module or directory is not defined by a strict\ncriteria but tends to occur when single `.py` files would be \"too big\".\nWe will with the modules needed implement \"simple MCMC\" model shown below\nbefore detailing the remaining modules, such as Variational Inference, Ordinary Differential Equations,\nor Sequential Monte Carlo.\n\n```python\nwith pm.Model() as model:\n  theta = pm.Beta(\"theta\", alpha=1, beta=2)\n  p = pm.Beta(\"n\", p=theta, n=2, observed=[1,2])\n  inf_data = pm.sample()\n\n\n```\n\n## {mod}`pymc.model`\nContains primitives related model definition and methods used for evaluation of the model.\nIn no particular order they are\n\n* `ContextMeta`: The context manager that enables the `with pm.Model() as model` syntax\n* {class}`~pymc.Factor`: Defines the methods for the various logprobs for models\n* `ValueGrad` which handles the value and gradient and is the main connection point to PyTensor\n* `Deterministic` and `Potential`: Definitions for two pieces of functionality useful in some model definitions\n\n## distributions/\nContains multiple submodules that define distributions,  as well as logic that aids in distributions usage.\nImportant modules to note are\n\n* `distribution.py`: This contains parent class for all PyMC distributions.\n  Notably the `distribution.distribution` class contains the `observed` argument which in PyMC differentiates\n  a random variable distribution from a likelihood distribution.\n\n* `logprob.py`: This contains the log probability logic for the distributions themselves.\n  The log probability calculation is deferred to PyTensor\n\n* `dist_math.py`: Various convenience operators for distributions.\n  This includes mathematical operators such as `logpower` or `all_true`methods.\n  It also contains a suite of lognormal methods and transformation methods\n\n## /sampling.py\nInterface to posterior, prior predictive, and posterior sampling as well as various methods to identify and initialize\nstepper methods. Also contains logic to check for \"all continuous\" variables and initialize NUTS\n\n## step_methods/\nContains various step methods for various sampling algorithms, such as MCMC, and SMC. `step_methods.hmc` includes\nthe Hamiltonian Monte Carlo sampling methods as well as helper functions such as the integrators used for those methods\n\n## tests/\nAll tests for testing functionality of codebase. All modules prefixed with `test_` are tests themselves, whereas all\nother modules contain various supporting code such as fixtures, configurations, etc\n</yakaai_skills>"}