Release notes for sbmlsim 0.20.0
Correlated priors and the Laplace posterior of a fit as a source of the uncertainty analyses, the posterior in the fit report, faster defaults of the optimizers and faster evaluations of a fit.
Results which change: the defaults of the optimizers of a fit changed (#496), so a fit with a seed draws other start values than before and reaches its optimum with fewer evaluations; the optima are the same within the tolerances of the fit. A fit with the old defaults takes sampling=SamplingType.UNIFORM, ftol=xtol=gtol=1e-8 for least squares and popsize=15, polish=True for differential evolution. The Fisher information of a fit of the objective likelihood or posterior is the information of the data, without the residuals of the priors and without the factor σ² (#492); a record of least squares is unchanged.
Features
- Correlated priors (#492, #190).
OptimizationProblem(prior_correlation=...)andFitDefinition.prior_correlationtake aCovariance.correlationof normal and log-normal priors by pid, a Gaussian copula of the priors restricted to their bounds.sbmlsim.fit.priors.JointPriorwrites the priors as whitened residuals, so the cost of the objectiveposterioris the negative log posterior up to a constant. The correlation is pickled with the problem, stored with the result and written into the PEtab extension 0.5.0 (gapprior-correlation). - The Laplace posterior of a fit (#492).
sbmlsim.fit.posterior.posterior_laplaceis the normal of the precisionJ'J / σ² + H_priorin the space of the optimizer, reusing a given Fisher information; it raises for a direction neither the data nor the priors constrain and reports a parameter at a bound. AParameterPosterior(posterior.json) gives its marginals, its correlations and anUncertaintyModel;FitRun.posterior(), andposterior: trueof the kindsfitandfisherof the run layer. The record of an adopted fit keepsposterior.jsonandposterior.tsv. - The posterior and the priors as a source (#492).
ParameterPosterior.uncertainty_model()forpropagate, the designposterior_parametersofsbmlsim.simulation.sampling, andprior_distributions(problem)/prior_model(problem), the priors truncated at the bounds as distributions and as anUncertaintyModelwith their correlation. - The posterior in the fit report (#493).
FitReport(posterior=...)adds the section Posterior (the credible intervals and the correlation of the parameters,posterior.json,posterior.tsv), the overview shows the priors and their correlation, and the report document gets the tableresults:posteriorand the methodsmethods:posterior. The methods of the objectiveslikelihoodandposteriordescribe the negative log-likelihood with the noise models of the training data and the truncated priors with their copula, instead of weighted least squares. - Correlated draws of the fitted parameters (#493).
AdoptedRecordreadsfisher.jsonandposterior.json, andparameter_correlationgives the dependence of the parameters of a record: the correlation of the posterior, else of a Fisher information of full rank, else independent. The experiments over the draws of the fitted parameters (Project.run_experiments(uncertainty=...), the kindsimulate) and the uncertainty of the credibility draw the distrib distributions of the SBML with that correlation. - Faster defaults of the optimizers (#496). Least squares from many start points stays the default of every fit, differential evolution is a global check of a final fit. The start values are a Latin hypercube on the logarithms of the bounds (
SamplingType.LOGUNIFORM_LHS) inrun_optimization,OptimizationProblem.optimizeandstart_values; least squares takesftol,xtolandgtolfrom the relative tolerance of the integrator, at least1e-8; differential evolution takespopsize=5and is polished by least squares on the residuals (polish="least_squares"). On the HCTZ fits, least squares needs 2.5 to 2.8 times fewer evaluations per run which reaches the optimum and differential evolution about 4 times fewer.
Performance
- Less python per simulation (#494). The output grid of a segment is built without sorting, the restore of a model before its reset reads only the parameters and the compartments, and the integrator and the model of roadrunner are fetched once per initialization; an evaluation of a fit is about 5 % faster, the results are bitwise the same. A port of the simulation core to Rust was evaluated in #227 and not done: roadrunner integrates in compiled code for 87 to 93 % of a scan and about 60 % of an evaluation of a fit.
- A fit simulates what its training data needs (#495). A group of a fit whose output is the times of its data ends at its last data point for a model without events (
Plan.until) and selects only what its evaluated mappings read, so an optimization does not select the validation and outlier data; the residuals are bitwise the same and the curves of a report keep the whole simulation.
Fixes
- The Fisher information of a fit of the objective
likelihoodorposteriorhas the covariance(J'J)⁻¹of the data with normal intervals andnthe number of measurements; it scaled the covariance byσ²of the residuals of the likelihood and counted the priors as data (#492).FisherInformation.objectiverecords the objective.
Dependencies
- The lock moves to the newest releases, among them sbmlutils 0.17.2, sbmlode 0.3.1, simrun 0.3.2, pandas 3.1.1, pydantic 2.14.3, ruff 0.17.4, ty 0.0.100 and zensical 0.1.0; the hooks of ruff and ty follow the locked versions, and the ignore comments of ty use its renamed rules.