-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathllms-full.txt
More file actions
90 lines (76 loc) · 22.1 KB
/
Copy pathllms-full.txt
File metadata and controls
90 lines (76 loc) · 22.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
AUTO-GENERATED by PyAutoHands — do not edit by hand; regenerate with generate.py.
# PyAutoFit Workspace — Full Catalogue
> Complete, generated listing of every script (and its matching notebook) in this
> workspace, grouped by top-level `scripts/` folder. This is the expanded companion to
> the curated `llms.txt` routing layer. Each entry links the script's title to its path
> and gives the first line of its docstring; `Contents:` lists the sections within.
## cookbooks
- [Cookbook: Analysis](scripts/cookbooks/analysis.py): The `Analysis` class is the interface between the data and model, whereby a `log_likelihood_function` is defined and called by the non-linear search to fit the model.
- Contents: Example: A simple example of an analysis class which can be adapted for you use-case., Customization: Customizing an analysis class with different data inputs and editing the `log_likelihood_function`., Visualization: Using a `visualize` method so that model-specific visuals are output to hard-disk., Custom Result: Return a custom Result object with methods specific to your model fitting problem., Latent Variables: Declaring a `Latent` class on the analysis to output latent variables to hard-disk., Custom Output: Add methods which output model-specific results to hard-disk in the `files` folder (e.g. as .json
- [Cookbook: Config](scripts/cookbooks/configs.py): Configuration files are used to control the behaviour model components in **PyAutoFit**, which perform the following tasks:
- Contents: No Config Behaviour: An example of what happens when a model component does not have a config file., Templates: A template config file for specifying default model component priors., Modules: Writing prior config files based on the Python module the model component Python class is contained in., Labels: Config files which specify the labels of model component parameters for visualization.
- [Cookbook: Latent Variables](scripts/cookbooks/latent_variables.py): A latent variable is a quantity derived from the model parameters that is not itself sampled by the non-linear search. Once the search has explored parameter space, every accepted sample can be transformed into a value of the latent variable, building up a posterior distribution for it. This lets you report scientifically meaningful quantities (with proper Bayesian uncertainties) without paying any cost during likelihood evaluation.
- Contents: Model Fit: Perform a model-fit using the example Gaussian + Analysis (which already ships a latent variable)., What is a Latent Variable?: The Bayesian framing — a deterministic function of the model parameters whose, Why Latent Variables?: Three motivating cases — physical interpretability, derived quantities, aggregates., How PyAutoFit Computes Latents: The `Latent.variables` hook and where in the search lifecycle it runs., Two Output Modes: Every-sample versus N-draws-from-PDF, the `output.yaml` flags that toggle between them, and, Errors on Latents: The 1σ / 3σ intervals are empirical quantiles of the *induced* latent posterior — not, Posterior Draws Under the Hood: What `analysis.compute_latent_samples(result.samples)` actually does., Loading Results Downstream: In-session access via the `Samples` API and out-of-session access via files /, When To Add A Latent vs A Sampled Parameter: A short rule-of-thumb.
- [Cookbook: Models](scripts/cookbooks/model.py): Model composition is the process of defining a probabilistic model as a collection of model components, which are ultimate fitted to a dataset via a non-linear search.
- Contents: Models, Python Class Template: The template of a model component written as a Python class., Model Composition (Model): Creating a model via `af.Model()`., Priors (Model): How the default priors of a model are set and how to customize them., Instances (Model): Creating an instance of a model via input parameters., Model Customization (Model): Customizing a model (e.g. fixing parameters or linking them to one another)., Tuple Parameters (Model): Defining model components with parameters that are tuples., Json Output (Model): Output a model in human readable text via a .json file and loading it back again., Model Composition (Collection): Creating a model via `af.Collection()`., Priors (Collection): How the default priors of a collection are set and how to customize them., Instances (Collection): Create an instance of a collection via input parameters., Model Customization (Collection): Customize a collection (e.g. fixing parameters or linking them to one another)., Json Output (Collection): Output a collection in human readable text via a .json file and loading it back again., Extensible Models (Collection): Using collections to extend models with new model components, including the use, Model Composition (af.Array): Composing models using NumPy arrays and `af.Array`()., Prior Customization (af.Array): How to customize the priors of a numpy array model., Instances (af.Array): Create an instance of a numpy array model via input parameters., Model Customization (af.Array): Customize a numpy array model (e.g. fixing parameters or linking them to one another)., Json Output (af.Array): Output a numpy array model in human readable text via a .json file and loading it back again., Extensible Models (af.Array): Using numpy arrays to compose models with a flexible number of parameters., Wrap Up: A summary of model composition in PyAutoFit.
- [Cookbook: Model Internals](scripts/cookbooks/model_internal.py): The model composition cookbooks show how to compose models and fit them to data using the high level **PyAutoFit** API (e.g. ``af.Model``, ``af.Collection``, ``af.Array``).
- Contents: Prior Identity And Shared Priors: How linked parameters work via Python object identity., Prior Tuples And Ordering: The canonical ordering of priors that defines the parameter vector layout., Argument Dictionaries: Building ``{Prior: value}`` dictionaries and using ``instance_for_arguments`` directly., Model Tree Navigation: Using ``paths``, ``object_for_path``, and ``path_instance_tuples_for_class`` to traverse models., Creating New Models From Existing Ones: ``mapper_from_prior_arguments``, ``take_attributes``, ``from_instance``., Model Subsetting: ``with_paths`` and ``without_paths`` to extract sub-models., Freezing For Performance: Caching repeated lookups during fitting., Serialization Round Trip: ``dict()`` and ``from_dict()`` for JSON persistence.
- [Cookbook: Multi Level Models](scripts/cookbooks/multi_level_model.py): A multi level model is one where one or more of the input parameters in the model components `__init__` constructor are Python classes, as opposed to a float or tuple.
- Contents: Python Class Template: The template of multi level model components written as a Python class., Model Composition: How to compose a multi-level model using the `af.Model()` object., Instances: Creating an instance of a multi-level model via input parameters., Why Use Multi-Level Models?: A description of the benefits of using multi-level models compared to a `Collection`., Model Customization: Customizing a multi-level model (e.g. fixing parameters or linking them to one another)., Alternative API: Alternative API for multi-level models which may be more concise and readable for certain models., Json Output (Model): Output a multi-level model in human readable text via a .json file and loading it back again.
- [Cookbook: Multiple Datasets](scripts/cookbooks/multiple_datasets.py): This cookbook illustrates how to fit multiple datasets simultaneously, where each dataset is fitted by a different `Analysis` class.
- Contents: Model Fit: Setup a model-fit to 3 datasets to illustrate multi-dataset fitting., Analysis List: Create a list of `Analysis` objects, one for each dataset, which are fitted simultaneously., Analysis Factor: Wrap each `Analysis` object in an `AnalysisFactor`, which pairs it with the model and prepares it for model fitting., Factor Graph: Combine all `AnalysisFactor` objects into a `FactorGraphModel`, which represents a global model fit to multiple datasets., Result List: Use the output of fits to multiple datasets which are a list of `Result` objects., Variable Model Across Datasets: Fit a model where certain parameters vary across the datasets whereas others, Relational Model: Fit models where certain parameters vary across the dataset as a user, Different Analysis Objects: Fit multiple datasets where each dataset is fitted by a different `Analysis` class,, Hierarchical / Graphical Models: Use hierarchical / graphical models to fit multiple datasets simultaneously,, Interpolation: Fit multiple datasets with a model one-by-one and interpolation over a smoothly varying parameter, Wrap Up: A summary of multi-dataset fitting in PyAutoFit.
- [Cookbook: Result](scripts/cookbooks/result.py): A non-linear search fits a model to a dataset, returning a `Result` object that contains a lot of information on the model-fit.
- Contents: Simple Fit: Perform a simple model-fit to generate a `Result` object., Info: Print the `info` attribute of the `Result` object to display a summary of the model-fit., Max Log Likelihood Instance: Getting the maximum likelihood model instance., Samples: Getting the samples of the non-linear search from a result., Custom Result: Extending the `Result` object with custom attributes specific to the model-fit., Output To Hard-Disk: Output results to hard-disk so they can be inspected and used to restart a crashed search., Files: The files that are stored in the `files` folder that is created when results are output to hard-disk., Loading From Hard-disk: Loading results from hard-disk to Python variables via the aggregator., Generators: Why loading results uses Python generators to ensure memory efficiency., Samples: The samples of the non-linear search loaded via the aggregator., Loading Model: The model fitted by the non-linear search., Loading Search: The search used to perform the model-fit., Loading Samples: The samples of the non-linear search (e.g. all parameter values, log likelihoods, etc.)., Loading Samples Info: Additional information on the samples., Loading Samples Summary: A summary of the samples of the non-linear search (e.g. the maximum log likelihood model)., Loading Info: The `info` dictionary passed to the search., Custom Output: Extend `Analysis` classes to output additional information which can be loaded via the aggregator., Querying Datasets: Query based on the name of the dataset., Querying Searches: Query based on the name of the search., Querying Models: Query based on the model that is fitted., Querying Results: Query based on the results of the model-fit., Querying with Logic: Use logic to combine queries to load specific results (e.g. AND, OR, etc.)., Database: Building a database file from the output folder., Unique Identifiers: The unique identifier of each model-fit., Building From Output Folder: Build the database from the output folder on hard-disk., Writing Directly To Database: Writing results directly to the database.
- [Cookbook: Samples](scripts/cookbooks/samples.py): A non-linear search samples parameter space to find the global maximum log likelihood solution.
- Contents: Model Fit: Perform a simple model-fit to create a ``Samples`` object., Samples: The `Samples` object`, containing all non-linear samples (e.g. parameters, log likelihoods, etc.)., Parameters: Accessing the parameters of the model from the samples., Figures of Merit: The log likelihood, log prior, log posterior and weight_list of every accepted sample., Instances: Returning instances of the model corresponding to a particular sample (e.g. the maximum log likelihood)., Posterior / PDF: The median PDF model instance and PDF vectors of all model parameters via 1D marginalization., Errors: The errors on every parameter estimated from the PDF, computed via marginalized 1D PDFs at an input sigma., Samples Summary: A summary of the samples of the non-linear search (e.g. the maximum log likelihood model) which can, Sample Instance: The model instance of any accepted sample., Search Plots: Plots of the non-linear search, for example a corner plot or 1D PDF of every parameter., Maximum Likelihood: The maximum log likelihood model value., Bayesian Evidence: The log evidence estimated via a nested sampling algorithm., Collection: Results created from models defined via a `Collection` object., Lists: Extracting results as Python lists instead of instances., Latex: Producing latex tables of results (e.g. for a paper)., Derived Quantities: Computing quantities and errors for quantities and parameters not included directly in the model., Derived Errors Manual (Advanced): Manually computing errors on derived quantities from the PDF of samples., Samples Filtering (Advanced): Filter the `Samples` object to only contain samples fulfilling certain criteria.
- [Cookbook: Searches](scripts/cookbooks/search.py): This cookbook provides an overview of the non-linear searches available in **PyAutoFit**, and how to use them.
- Contents: Example Fit: A simple example of a non-linear search to remind us how it works., Output To Hard-Disk: Output results to hard-disk so they can be inspected and used to restart a crashed search., Output Customization: Customize the output of a non-linear search to hard-disk., Unique Identifier: Ensure results are output in unique folders, so they do not overwrite each other., Iterations Per Update: Control how often non-linear searches output results to hard-disk., Parallelization: Use parallel processing to speed up the sampling of parameter space., Plots: Perform non-linear search specific visualization using their in-built visualization tools., Start Point: Manually specify the start point of a non-linear search, or sample a specific region of parameter space., Emcee (MCMC): The Emcee ensemble sampler MCMC., Zeus (MCMC): The Zeus ensemble sampler MCMC., DynestyDynamic (Nested Sampling): The Dynesty dynamic nested sampler., DynestyStatic (Nested Sampling): The Dynesty static nested sampler., LBFGS: The L-BFGS scipy optimization.
## features
- [Feature: Expectation Propagation (Step-by-Step)](scripts/features/expectation_propagation.py): The `graphical_models.py` feature example composed a graphical model from many datasets and fitted it with a single non-linear search over the joint parameter space. That approach hits a ceiling: with tens of datasets the joint parameter space becomes too high dimensional to sample.
- Contents: Example Source Code (`af.ex`), Dataset, Model, Factor Graph, Mean Field, Cavity, Tilted Fit, Damped Update, Convergence, Full EP Fit, Wrap Up
- [Feature: Graphical Models](scripts/features/graphical_models.py): The examples so far have focused on fitting one model to one dataset, for example fitting 1D profiles composed of Gaussians to noisy 1D data. When multiple datasets were available each is fitted individually and their results interpreted one-by-one.
- Contents: Example Source Code (`af.ex`), Dataset, Analysis, Model, Analysis Factors, Factor Graph, Search, Hierarchical Models, Expectation Propagation
- [Feature: Interpolate](scripts/features/interpolate.py): It is common to fit a model to many similar datasets, where it is anticipated that one or more model parameters vary smoothly across the datasets.
- Contents: Example Source Code (`af.ex`), Dataset, Fit, Interpolation, Serialization, Database
- [Feature: Model Comparison](scripts/features/model_comparison.py): Common questions when fitting a model to data are: what model should I use? How many parameters should the model have? Is the model too complex or too simple?
- Contents: Metrics, Example Source Code (`af.ex`), Data, Model x1 Gaussian, Model x2 Gaussian, Model x3 Gaussian, Wrap Up
- [Feature: Search Chaining](scripts/features/search_chaining.py): To perform a model-fit, we typically compose one model and fit it to our data using one non-linear search.
- Contents: Example Source Code (`af.ex`), Data, Analysis, Model, Search 1, Result 1, Search 2, Model, Result 2, Search 3, Prior Passing, EXAMPLE, Prerequisites, Overview, Model-Fit, Instance & Model, Component Specification, Take Attributes, As Model
- [Feature: Search Grid Search](scripts/features/search_grid_search.py): A classic method to perform model-fitting is a grid search, where the parameters of a model are divided on to a grid of values and the likelihood of each set of parameters on this grid is sampled. For low dimensionality problems this simple approach can be sufficient to locate high likelihood solutions, however it scales poorly to higher dimensional problems.
- Contents: Example Source Code (`af.ex`), Data, Model, Analysis, Search, Result, Search Grid Search
- [Feature: Sensitivity Mapping](scripts/features/sensitivity_mapping.py): Bayesian model comparison allows us to take a dataset, fit it with multiple models and use the Bayesian evidence to quantify which model objectively gives the best-fit following the principles of Occam's Razor.
- Contents: Example Source Code (`af.ex`), Data, Analysis, Model Comparison, Sensitivity Mapping, Base Model, Perturb Model, Mapping Grid, Simulation Instance, Simulate Function Class, Base Fit, Perturb Fit, Results
- [Feature: Shared Analysis State](scripts/features/shared_analysis_state.py): The `graphical_models.py` feature example showed how to fit many datasets simultaneously with a `FactorGraphModel`, where each dataset has its own `Analysis` (and therefore its own `log_likelihood_function`) and the factors are linked by shared priors. When a `FactorGraphModel` evaluates its likelihood it loops over every factor, calls each factor's `log_likelihood_function`, and sums the results.
- Contents: Example Source Code (`af.ex`), Dataset, Analysis, Shared State, Model, Analysis Factors / Factor Graph, Search
## overview
- [Overview: The Basics](scripts/overview/overview_1_the_basics.py): --------------------
- Contents: Example Use Case, Model, Instances, Analysis, Non Linear Search, Model Fit, Result, Samples, Multiple Datasets, Factor Graph, Wrap Up, Resources, Extending Models
- [Overview: Scientific Workflow](scripts/overview/overview_2_scientific_workflow.py): A scientific workflow comprises the tasks you perform to conduct a scientific study. This includes fitting models to datasets, interpreting the results, and gaining insights into your scientific problem.
- Contents: Data, On The Fly, Hard Disk Output, Visualization, Loading Results, Result Customization, Model Composition, Searches, Configs, Database, Scaling Up, Wrap Up
- [Overview: Statistical Methods](scripts/overview/overview_3_statistical_methods.py): **PyAutoFit** supports numerous statistical methods that allow for advanced Bayesian inference to be performed.
- Contents: Graphical Models, Hierarchical Models, Model Comparison, Interpolation, Search Grid Search, Search Chaining, Sensitivity Mapping
## plot
- [Plots: dynesty_plotter](scripts/plot/dynesty_plotter.py): This example illustrates how to plot visualization summarizing the results of a dynesty non-linear search using the `autofit.plot` module-level functions.
- Contents: Notation, Plotting, Search Specific Visualization, Plots
- [Plots: emcee_plotter](scripts/plot/emcee_plotter.py): This example illustrates how to plot visualization summarizing the results of a emcee non-linear search using the `autofit.plot` module-level functions.
- Contents: Notation, Plotting, Search Specific Visualization
- [Plots: GetDist](scripts/plot/get_dist.py): This example illustrates how to plot visualization summarizing the results of model-fit using any non-linear search using GetDist:
- Contents: Model Fit, Param Names, GetDist MCSamples, Parameter Names, GetDist Plotter, GetDist Subplots, GetDist Single Plots, Output, GetDist Other Plots, Plotting Multiple Samples
- [Plots: nautilus_plotter](scripts/plot/nautilus_plotter.py): This example illustrates how to plot visualization summarizing the results of a nautilus non-linear search using the `autofit.plot` module-level functions.
- Contents: Notation, Plotting, Search Specific Visualization, Plots
- [Plots: zeus_plotter](scripts/plot/zeus_plotter.py): This example illustrates how to plot visualization summarizing the results of a zeus non-linear search using the `autofit.plot` module-level functions.
- Contents: Notation, Plotting, Search Specific Visualization
## searches
- [Searches: MCMC](scripts/searches/mcmc.py): This example illustrates how to use the MCMC sampler algorithms supported by **PyAutoFit**:
- Contents: Data, Model + Analysis, Search: Emcee, Search: Zeus, Search: BlackJAXNUTS, Search Internal
- [Searches: Maximum Likelihood Estimation](scripts/searches/mle.py): This example illustrates how to use the maximum likelihood / optimization algorithms supported by **PyAutoFit**:
- Contents: Data, Model + Analysis, Search: Drawer, Search: LBFGS, Search Internal, Search: MultiStartAdam
- [Searches: Nested Sampling](scripts/searches/nest.py): This example illustrates how to use the nested sampling algorithms supported by **PyAutoFit**:
- Contents: Data, Model + Analysis, Search: DynestyStatic, Search: DynestyDynamic, Search: Nautilus, Search Internal
- [Feature: Start Point](scripts/searches/start_point.py): For maximum likelihood estimator (MLE) and Markov Chain Monte Carlo (MCMC) non-linear searches, parameter space sampling is built around having a "location" in parameter space.
- Contents: Comparison to Priors, Example Source Code (`af.ex`), Start Here Notebook, Data, Start Point Priors, Start Point, Search + Analysis + Model-Fit, Result
## simulators
- [__Simulators__](scripts/simulators/simulators.py): These scripts simulate the 1D Gaussian datasets used to demonstrate model-fitting.
- Contents: Gaussian x1, Gaussian x1 (0), Gaussian x1 (1), Gaussian x1 (2), Gaussian x1 (Identical 0), Gaussian x1 (Identical 1), Gaussian x1 (Identical 2), Gaussian x1 + Exponential x1, Gaussian x2 + Exponential x1, Gaussian x2, Gaussian x3, Gaussian x5, Gaussian x1 unconvolved, Gaussian x1 convolved, Gaussian x1 with feature, Gaussian x2 split, Gaussian x1 time
- [__Simulators__](scripts/simulators/simulators_sample.py): These scripts simulates many 1D Gaussian datasets with a low signal to noise ratio, which are used to demonstrate model-fitting.
- Contents: Gaussian x1 low snr (centre fixed to 50.0), Gaussian x1 low snr (centre drawn from parent Gaussian distribution to 50.0), Gaussian x2 offset centre