PyAutoFit#
PyAutoFit is a Python package for scientific model fitting and Bayesian inference. Bring your own model classes, data and likelihood code; PyAutoFit provides priors, inference algorithms and tools for interpreting and organising the results. It is domain agnostic: inference can sit around your existing scientific software.
We recommend getting started with autofit_assistant, which lets you perform scientific inference using natural language. Describe the model you want to fit, ask the assistant to run the analysis, and explore the results through follow-up requests — see Natural Language Inference.
Users can then set up a PyAutoFit scientific workflow, which enables streamlined modeling of small datasets with tools to scale up to large datasets.
PyAutoFit supports advanced statistical methods, most notably a big data framework for Bayesian hierarchical analysis.
Getting Started#
The following links are useful for new starters:
The autofit_assistant repository, which lets you perform inference in natural language via a coding agent — the recommended starting point.
The PyAutoFit readthedocs, which includes an installation guide and an overview of PyAutoFit’s core features.
The introduction Jupyter Notebook on Colab, where you can try PyAutoFit in a web browser (without installation).
The autofit_workspace GitHub repository, which includes example scripts demonstrating PyAutoFit’s features.
The standalone HowToFit repository, a series of Jupyter notebook lectures which give new users a step-by-step introduction to PyAutoFit.
Support#
Support for installation issues, help with Fit modeling and using PyAutoFit is available by raising an issue on the GitHub issues page.
We also offer support on the PyAutoFit Slack channel, where we also provide the latest updates on PyAutoFit. Slack is invitation-only, so if you’d like to join send an email requesting an invite.
HowToFit#
For users less familiar with Bayesian inference and scientific analysis you may wish to read through the HowToFits lectures. These teach you the basic principles of Bayesian inference, with the content pitched at undergraduate level and above.
The lectures are available in the standalone HowToFit repository.
Overview#
To illustrate PyAutoFit we use a toy model of fitting a one-dimensional Gaussian to noisy 1D data. Here’s
the data (black) and the model (red) we’ll fit:
Start with Quick Start, which sets up the assistant and gets inference running on your own likelihood in a few minutes. After that, there are two ways to read the rest of these docs:
Natural Language Inference walks through this fit as a conversation with an assistant — composing the model, defining the likelihood, choosing a search, running the fit and inspecting the results, all described in words rather than written by hand. This is the recommended route through the docs.
The Python API walks through the same fit in code, showing the
Model,Analysis, search andResultobjects the assistant writes for you, and which you can read, run and extend yourself.
Between them sit the Scientific Workflow, which makes inference scalable to large datasets, and the Statistical Methods overview, covering hierarchical models, search chaining and Bayesian model comparison.