Skip to main content

Common Framework for Inference

Project description

CoFI (Common Framework for Inference)

PyPI version Wheels Python versions build Documentation Status codecov Slack

Introduction

CoFI (Common Framework for Inference) is an open-source initiative for interfacing between generic inference algorithms and specific geoscience problems.

With a mission to bridge the gap between the domain expertise and the inference expertise, this Python package provides an interface across a wide range of inference algorithms from different sources, as well as ways of defining inverse problems with examples included.

This project and documentation are under initial development stage. Please feel free to contact us for feedback or issues!

Installation

It's optional, but recommended to use a virtual environment:

conda create -n cofi_env python=3.8 scipy
conda activate cofi_env

Install cofi with:

pip install cofi

Basic Usage

CoFI API has flexible ways of defining an inversion problem. For instance:

from cofi import BaseProblem

inv_problem = BaseProblem()
inv_problem.set_objective(my_objective_func)

We have a series of pre-defined problems and ways of setting up the problem. Feel free to check out our getting-started page on how to plug in your own inference problems (with different tiers of flexibility)

Once a problem is defined, cofi can tell you what inference solvers you can use based on what level of information you've provided:

inv_problem.suggest_solvers()   # a list will be returned

Run an inversion with these lines:

from cofi import InversionOptions, InversionRunner

inv_options = InversionOptions()
inv_options.set_method("optimisation")
inv_options.set_iteration_limit(100)

inv_runner = InversionRunner(inv_problem, inv_options)
result = inv_runner.run()
print(result.ok)
print(result.model)

And now we are done! Check out our tutorial pages for more examples and advanced usages.

Project details


Release history Release notifications | RSS feed

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

cofi-0.1.1.dev3.tar.gz (1.0 MB view hashes)

Uploaded Source

Built Distributions

cofi-0.1.1.dev3-cp310-cp310-win_amd64.whl (44.2 kB view hashes)

Uploaded CPython 3.10 Windows x86-64

cofi-0.1.1.dev3-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.2 MB view hashes)

Uploaded CPython 3.10 manylinux: glibc 2.17+ x86-64

cofi-0.1.1.dev3-cp310-cp310-macosx_10_9_x86_64.whl (64.4 kB view hashes)

Uploaded CPython 3.10 macOS 10.9+ x86-64

cofi-0.1.1.dev3-cp39-cp39-win_amd64.whl (44.2 kB view hashes)

Uploaded CPython 3.9 Windows x86-64

cofi-0.1.1.dev3-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.2 MB view hashes)

Uploaded CPython 3.9 manylinux: glibc 2.17+ x86-64

cofi-0.1.1.dev3-cp39-cp39-macosx_10_9_x86_64.whl (64.3 kB view hashes)

Uploaded CPython 3.9 macOS 10.9+ x86-64

cofi-0.1.1.dev3-cp38-cp38-win_amd64.whl (44.2 kB view hashes)

Uploaded CPython 3.8 Windows x86-64

cofi-0.1.1.dev3-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.2 MB view hashes)

Uploaded CPython 3.8 manylinux: glibc 2.17+ x86-64

cofi-0.1.1.dev3-cp38-cp38-macosx_10_9_x86_64.whl (64.3 kB view hashes)

Uploaded CPython 3.8 macOS 10.9+ x86-64

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page