pypi sbmlsim 0.20.0

one hour ago

Release notes for sbmlsim 0.20.0

sbmlsim

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=...) and FitDefinition.prior_correlation take a Covariance.correlation of normal and log-normal priors by pid, a Gaussian copula of the priors restricted to their bounds. sbmlsim.fit.priors.JointPrior writes the priors as whitened residuals, so the cost of the objective posterior is 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 (gap prior-correlation).
  • The Laplace posterior of a fit (#492). sbmlsim.fit.posterior.posterior_laplace is the normal of the precision J'J / σ² + H_prior in 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. A ParameterPosterior (posterior.json) gives its marginals, its correlations and an UncertaintyModel; FitRun.posterior(), and posterior: true of the kinds fit and fisher of the run layer. The record of an adopted fit keeps posterior.json and posterior.tsv.
  • The posterior and the priors as a source (#492). ParameterPosterior.uncertainty_model() for propagate, the design posterior_parameters of sbmlsim.simulation.sampling, and prior_distributions(problem)/prior_model(problem), the priors truncated at the bounds as distributions and as an UncertaintyModel with 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 table results:posterior and the methods methods:posterior. The methods of the objectives likelihood and posterior describe 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). AdoptedRecord reads fisher.json and posterior.json, and parameter_correlation gives 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 kind simulate) 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) in run_optimization, OptimizationProblem.optimize and start_values; least squares takes ftol, xtol and gtol from the relative tolerance of the integrator, at least 1e-8; differential evolution takes popsize=5 and 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 likelihood or posterior has the covariance (J'J)⁻¹ of the data with normal intervals and n the number of measurements; it scaled the covariance by σ² of the residuals of the likelihood and counted the priors as data (#492). FisherInformation.objective records 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.

Don't miss a new sbmlsim release

NewReleases is sending notifications on new releases.