Release notes v0.2#
Specific upgrades for the latest release can be found here.
New features since the last release#
Multi-parameter-of-interest support:
poi_testnow accepts aDict[Union[int, str], float]in addition to a plainfloat. When a dictionary is supplied, every entry fixes the corresponding parameter (identified by index or by name as recorded inModelConfig.parameter_names) during the fit, while the remaining parameters are optimised freely. A plainfloatretains exactly the previous single-POI behaviour. The new type aliasPoiTestis exported fromspey.interface.statistical_modelfor type-annotation convenience. Affected interfaces:StatisticalModel.likelihood,StatisticalModel.asimov_likelihood,StatisticalModel.fixed_poi_sampler,StatisticalModel.sigma_mu_from_hessian,HypothesisTestingBase.chi2,HypothesisTestingBase.sigma_mu,HypothesisTestingBase.exclusion_confidence_level, and the corresponding methods inUnCorrStatisticsCombiner.ModelConfiggains two new helpers:resolve_poi_indices(converts apoi_testvalue to a{param_index: value}mapping) andfixed_poi_bounds_multi(generalisesfixed_poi_boundsto multiple simultaneously fixed parameters).optimizer.fitextended to acceptfixed_poi_valueas aDict[int, float], fixing an arbitrary set of parameters in a single optimisation call.Ability to compute two-sided tests added. (#45)
Add plug-in registry that does not require creating an entire package. (#60)
Iminuit is available to be used for optimisation as alternative to scipy. (#59)
Improvements#
Autograd has been upgraded to v1.7 which supports numpy 2.0 (#50)
Enabled user control to allow negative signal yields in \(\chi^2\)-test. (#50)
Implement python version compatibility check for new releases. (#52)
Added a helper function to merge correlated bins. (#53)
Some errors are reduced to warnings in chi2 test to reduce the verbosity. (#54)
Enable compatibility for Python 3.13, and the deprecation of
pkg_resourceshas been addressed. (#56)Multivariate Normal distribution now supports callable covariance matrix function. (#59)
MultivariateNormalbackend now acceptssignal_yieldsas a callable with signature(extra_pars: np.ndarray) -> np.ndarrayin addition to a plain array. A companion keyword argumentn_signal_parameters(default0) declares how many free parameters beyond :math:\muthe callable requires; they are appended to the optimiser parameter vector assignal_par_0,signal_par_1, … and are included inModelConfigwith(None, None)bounds. The plain-array path is unchanged.maximize_likelihoodandmaximize_asimov_likelihoodgain a new optional keyword argumentpoi_indices(Optional[List[Union[int, str]]], defaultNone). WhenNonethe methods return the usual(muhat, nll)tuple. When a list of parameter indices or names is provided they return(Dict[Union[int, str], float], nll)with the fitted values for each requested parameter. Supported onStatisticalModelandUnCorrStatisticsCombiner.All default-PDF backends (
DefaultPDFBase,UncorrelatedBackground,CorrelatedBackground,ThirdMomentExpansion,EffectiveSigma) now accept asignal_parameter_boundskeyword argument (Optional[List[Tuple[Optional[float], Optional[float]]]], defaultNone). When provided, each entry supplies the(lower, upper)optimiser bound for the corresponding extra signal parameter (indexed by position in the parameter vector immediately after :math:\mu); aNoneelement leaves that side unbounded. When the argument isNone(the previous behaviour), every extra signal parameter continues to receive(None, None)bounds. The list must have exactlyn_signal_parametersentries. These bounds are stored inModelConfig.suggested_boundsand propagated to the optimiser automatically.For
pdf_type="multivariategauss"with a non-callable cov, the old code was:self._pdf = lambda pars: MultivariateNormal(mean=loc(pars), cov=cov)which re-instantiated MultivariateNormal (and re-rannp.linalg.inv+np.linalg.slogdet, both O(n³)) on every likelihood call. The fix creates a single MultivariateNormal once at construction time and only updates_mv.mean = loc(pars)on each call — the cached_inv_cov/_logdet_covclosures are reused unchanged. When cov is callable, the original per-call re-instantiation is preserved.Minor inefficiencies fixed
Normal.log_prob: value[self.domain]was sliced twice; now sliced once into x.MultivariateNormal.log_prob: value[self.domain]was sliced four times; now sliced once into x. Removed unused from copy import deepcopy import.
Bug Fixes#
Contributors#
This release contains contributions from (in alphabetical order):