Jupyter-friendly Python frontend for MINUIT2 in C++
Project description
iminuit is a Jupyter-friendly Python interface for the Minuit2 C++ library maintained by CERN’s ROOT team.
Minuit was designed to minimise statistical cost functions, for likelihood and least-squares fits of parametric models to data. It provides the best-fit parameters and error estimates from likelihood profile analysis.
Supported CPython versions: 3.6+
Supported PyPy versions: 3.6+
Supported platforms: Linux, OSX and Windows.
The iminuit package comes with additional features:
Builtin cost functions for statistical fits
Binned and unbinned maximum-likelihood
Non-linear regression with (optionally robust) weighted least-squares
Gaussian penalty terms
Cost functions can be combined by adding them: total_cost = cost_1 + cost_2
Support for SciPy minimisers as alternatives to Minuit’s Migrad algorithm (optional)
Support for Numba accelerated functions (optional)
Checkout our large and comprehensive list of tutorials that take you all the way from beginner to power user. For help and how-to questions, please use the discussions on GitHub.
In a nutshell
iminuit is intended to be used with a user-provided negative log-likelihood function or least-squares function. Standard functions are included in iminuit.cost, so you don’t have to write them yourself. The following example shows how iminuit is used with a dummy least-squares function.
from iminuit import Minuit
def cost_function(x, y, z):
return (x - 2) ** 2 + (y - 3) ** 2 + (z - 4) ** 2
cost_function.errordef = Minuit.LEAST_SQUARES
m = Minuit(cost_function, x=0, y=0, z=0)
m.migrad() # run optimiser
print(m.values) # x: 2, y: 3, z: 4
m.hesse() # run covariance estimator
print(m.errors) # x: 1, y: 1, z: 1
Partner projects
numba_stats provides faster implementations of probability density functions than scipy, and a few specific ones used in particle physics that are not in scipy.
jacobi provides a robust, fast, and accurate calculation of the Jacobi matrix of any transformation function and building a function for generic error propagation.
Versions
The current 2.x series has introduced breaking interfaces changes with respect to the 1.x series.
All interface changes are documented in the changelog with recommendations how to upgrade. To keep existing scripts running, pin your major iminuit version to <2, i.e. pip install 'iminuit<2' installs the 1.x series.
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
File details
Details for the file iminuit-2.12.3b1.tar.gz
.
File metadata
- Download URL: iminuit-2.12.3b1.tar.gz
- Upload date:
- Size: 420.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.9.13
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d65f07649a2fae96e91b9a59e142ab5bc1ae95424598ae78c2706c3010487574 |
|
MD5 | 53d48cdb2ef8282be014dfba0b39ab30 |
|
BLAKE2b-256 | 934f309e06f41d8ce453308f3a86d3e63ec70d8667530232140175ace5325068 |