Intro to CoFI#
With a mission to bridge the gap between the domain expertise and the
inference expertise, cofi
provides an interface across a
wide range of inference algorithms from different sources, underpinned by a rich set
of domain relevant examples.
This page contains explanation about the basic concepts of this package.
In the workflow of cofi
, there are three main
components: BaseProblem
, InversionOptions
, and Inversion
.
BaseProblem
defines the inverse problem including any user supplied quantities such as data vector, number of model parameters and measure of fit between model predictions and data.inv_problem = BaseProblem() inv_problem.set_objective(some_function_here) # if needed inv_problem.set_jacobian(some_function_here) # if needed inv_problem.set_initial_model(a_starting_point) # if needed # more could be set here # choose depending on the problem and how you want to solve it
InversionOptions
describes details about how one wants to run the inversion, including the backend tool and solver-specific parameters. It is based on the concept of a method and tool.inv_options = InversionOptions() inv_options.suggest_solving_methods() inv_options.set_solving_method("matrix solvers") inv_options.suggest_tools() inv_options.set_tool("scipy.linalg.lstsq") inv_options.summary()
Inversion
can be seen as an inversion engine that takes in the above two as information, and will produce anInversionResult
upon running.inv = Inversion(inv_problem, inv_options) result = inv.run()
Internally CoFI decides the nature of the problem from the quantities set by the user and performs internal checks to ensure it has all that it needs to solve a problem.
For each of the above components, there’s an associated summary()
method to check the
current status.
Hint
Congrats! You are on board. Click here if you haven’t installed CoFI locally yet. Otherwise, continue with tutorials for a step-by-step guide, or example gallery if you are eager to learn through examples.