Convenient Interface to Inverse Ising
ConIII is a Python package for solving maximum entropy problems with a focus on the pairwise maximum entropy model, also known as the inverse Ising problem.
If you use ConIII for your research, please consider citing the following:
Lee, E.D. and Daniels, B.C., 2019. Convenient Interface to Inverse Ising (ConIII): A Python 3 Package for Solving Ising-Type Maximum Entropy Models. Journal of Open Research Software, 7(1), p.3. DOI: http://doi.org/10.5334/jors.217.
The paper also contains an overview of the modules. For code documentation, see coniii.readthedocs.io.
Package layout
| Area | Status | What's there |
|---|---|---|
coniii.solvers |
stable | Inverse-Ising solvers: Enumerate, SparseEnumerate, MPF, MCH, Pseudo, ClusterExpansion, RegularizedMeanField. |
coniii.samplers |
stable | Monte Carlo samplers: Metropolis, WolffIsing, ParallelTempering, Potts3, and the sample_ising helper. |
coniii.models |
stable | Maxent model classes: Ising, Triplet, Potts3. |
coniii.utils |
stable | Indexing, correlation, parameter-conversion, and helper-function utilities. |
coniii.enumerate, coniii.enumerate_potts, coniii.ising_eqn |
stable | Exact enumeration and the generated equation files it produces. |
coniii.experimental |
work in progress | Unvalidated samplers (SWIsing, HamiltonianMC, Heisenberg3DSampler) and an entropy stub. Not imported by import coniii; import explicitly. |
coniii.legacy |
deprecated | mean_field_ising (still used internally by ClusterExpansion/RegularizedMeanField) and pseudo_inverse_ising. Direct imports warn. |
The top-level names available via from coniii import * are listed in coniii.__all__.
Installation
To set up an Anaconda environment called "test" and install from pip, run the following code. The openblas package is only recommended for AMD users.
$ conda create -n test -c conda-forge python=3.10 numpy scipy numba cython jupyter ipython multiprocess boost==1.74 matplotlib mpmath blas=*=openblas
$ pip install coniii
The wheel on PyPI is pure Python and does not include the optional C++ samplers. To use them, build from source with Boost installed.
If you have trouble using pip, you can build from source. ConIII supports Python 3.9
and newer.
$ git clone https://github.com/eltrompetero/coniii.git
$ cd coniii
$ pip install .
The build probes for Boost and compiles the optional C++ samplers extension if it is
found; without Boost it falls back to the (slower) pure-Python samplers. To build
distributable wheels instead, run python -m build (or the convenience wrapper
./pypi_compile.sh).
Known issue (#46): on Linux,
building against the system's Boost packages (e.g. Ubuntu's libboost-python-dev) links
the extension to a Boost.NumPy library compiled for NumPy 1.x, and import coniii then
crashes with a segmentation fault under NumPy 2. Install numpy<2 in that environment.
This goes away when the C++ extension is replaced
(#41).
Setting up exact solution for systems N > 9
Enumerate ships with precomputed equation files up to N = 9. For larger systems,
generate the file yourself by running the enumerate module (works from any directory):
$ python -m coniii.enumerate [N] 1
where [N] is the system size. The trailing 1 selects the {-1,1} basis (the package
default); omit it for the {0,1} basis. See the __main__ block at the end of
enumerate.py for more options.
Quick guide with Jupyter notebook
A Jupyter notebook with a brief introduction and examples for how to use ConIII is available. The notebook is also installed into your package directory if you used pip.
To use the notebook, install jupyter such as by following the setup instructions above. Then, copy the notebook file "usage_guide.ipynb" into a directory outside the "coniii" directory. Change to this directory and run
$ jupyter notebook
This should open the notebook in your default web browser.
Troubleshooting
This package is maintained for Python 3 and has been tested on Python 3.10. Check which version you are running with
$ python --version
ConIII has been tested on the following systems
- Ubuntu 20.04.5
Trouble compiling the Boost extension? Check that your Boost library is on the include
path. If it is not, add the include directory to include_dirs in the _detect_boost()
function in "setup.py" before compiling.
Support
Please file an issue on the GitHub if you have any problems or feature requests. Provide a stack trace or other information that would be helpful in debugging. For example, OS, system configuration details, and the results of unit tests. Unit tests can be run by navigating to the package directory and running
$ pytest -q
The package directory can be found by running inside python
>>> import coniii
>>> coniii.__path__
You may also need to install pytest.
$ conda install -c conda-forge pytest
Updating
When updating, please read the RELEASE_NOTES. There may be modifications to the interface including parameter names as we make future versions more user friendly. Note: v4.0.0 contains breaking changes — see the RELEASE_NOTES before upgrading.
Metadata
Release files for coniii 4.0.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| coniii-4.0.3.tar.gz | 623.9 kB | Without provenance | Details for coniii-4.0.3.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| coniii-4.0.3-py3-none-any.whl | Python 3 | none | any | Details for coniii-4.0.3-py3-none-any.whl |
Total release size: 1.3 MB
Release files / coniii-4.0.3.tar.gz
| Download URL | coniii-4.0.3.tar.gz |
|---|---|
| Size | 623.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
ea459b93e9e598210bb88ee06f882506d2889741021cd321c8f0a9c152c670e6
|
|
BLAKE2b-256 checksum How to use checksums |
705b622df0293ed6e087c699223d382b61e7221d7f515e736477b4f53367104e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.15
|
Release files / coniii-4.0.3-py3-none-any.whl
| Download URL | coniii-4.0.3-py3-none-any.whl |
|---|---|
| Size | 664.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
7a2d4c095ec054c5941c0a49fe125fa05f03bc5e105d38f4f5cdf3631a9d76e5
|
|
BLAKE2b-256 checksum How to use checksums |
9eec7e2a93d7a6cba2f946949fcdd1c23597bf83760dd35d9ed30dcb3ea6991d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.15
|
Security for coniii 4.0.3
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.