Release notes for sbmlsim 0.12.0
A release of the evaluation of a fit and of the first milestone of the uncertainty quantification: acceptance criteria next to the metrics, the evaluation by subsets of the data, one figure per fit mapping and better Bland-Altman plots; uncertain values with covariances, their propagation through simulations and probability statements about the predictions which do not depend on the number of draws. Every error of a fit is a standard deviation now, which changes the weights of data reported with a standard error.
Features
- Acceptance criteria of a fit (#325, #326, #365). The new module
sbmlsim.fit.evaluationhas the criteria of a data point,Fold(fold)(DV/fold <= IPRED <= DV*fold, for the points with a positive value and prediction) andUncertainty(k)(|DV - IPRED| <= k SD, for the points with a standard deviation), the fold errorsgmfe(10**mean(|log10(IPRED/DV)|)) andafe(the bias as a fold factor) andcriteria_metrics. The metrics of a fit (summary_df,mappings_df,metrics.tsv,metrics_mappings.tsv) have the columnsGMFE,AFE,within_1.25fold,within_1.5fold,within_1sdandwithin_2sdafter the existing ones;FitMetrics.observables_dfandmetrics_observables.tsvare the metrics per kind and observable with the median standard deviation of its data, so the RMSE of an observable is read against the uncertainty of its data. The criterion of Guest et al. (2011) for ratios, e.g. the AUC ratios of drug-drug interactions, isguest_limitsandwithin_guestas published (delta = 1); it is not applied to the absolute data points of a fit, where its limits would depend on the unit. - The data points of a fit carry their observable, standard deviation, count and metadata (#356, #365).
FitMetrics.datapoints_dfanddatapoints.tsvappend the columnsobservable,observation(timecourse, value per simulation, values over a dimension),DV_SD,N(the count of the subjects) and one column per field of the metadata of the mappings (OptimizationProblem.mapping_metadata), empty where a mapping has no such field. - The evaluation by subsets of the data (#356, #367).
FitReport(groupings=[Grouping.by("tissue")])groups the data points by the values of columns, e.g. the tissue or the health of the metadata,Grouping.of_subsets(name, Subset(label, filter), ...)by named subsets of the fit mappings selected with the filters a fit selects its data with. Every grouping adds a goodness of fit and a Bland-Altman figure with a row per group and a column per kind, a figure of the criteria per group and kind,metrics_groups.tsvand a section "Evaluation" of the report.FitDefinition.groupingssets the groupings of the reports of a fit,--group-by COLUMNSoffit_cli,report_cliandidentifiability_clireplaces them. - One figure per fit mapping (#356, #366).
FitReport.plot_mappingdraws the data and the simulation of every parameter set, linear and logarithmic, with the prediction at the data points as open markers, and the goodness of fit and the Bland-Altman plot of the points of the mapping, drawn as the summary figures draw them, with the metrics of the mapping (the number of points, GMFE, AFE, the percentages within twofold and within two standard deviations and the cost of the mapping with its share of the cost of the training data). The title has the kind of every mapping, training too, and below it the observable and the metadata of the mapping. - Better Bland-Altman plots (#325, #368). The lines of twofold,
±log10(2), and the agreement of the points of a panel itself with the 95% confidence intervals of its bias and limits (Bland and Altman 1999),subset_agreement, for a panel of at least ten points: the validation panel, the panels of a grouping and the figure of a mapping.FitReport(error_bars=True)draws the standard deviations of the data,FitReport(color_by="tissue")colors the points by a column instead of their study. The box of a goodness of fit has GMFE, AFE and the percentages within twofold and within two standard deviations. - The optimization level of the JIT is a setting (#331, #361). A model is compiled with LLJIT at a level of
JitOptimization,O0toO3:jit_optimization=ofRoadrunnerSBMLModel,ExperimentRunnerandOptimizationProblem, else the environment variableSBMLSIM_JIT_OPTIMIZATION.O2stays the default;O0compiles about four times faster (the dulaglutide model of pkdb_models in 1.1 s against 4.1 s), simulates up to a quarter slower and gives the results of MCJIT bitwise, e.g. for the runs of experiments which compile more than they simulate. The workers of a scan and of a fit compile at the level of the parent. - The evaluation by subsets of the data, completed (#369). The metrics of a group have the denominators of their percentages,
n_ratioandn_sd, and no RMSE over the units of several observables; the values which are not reported, empty orNR, are one groupnot reported; the figures of a grouping of many groups are pages of at most six rows; the section "Evaluation" has a tab per grouping with the headers of the criteria;FitReportchecks the columns of its groupings and ofcolor_bywhen it is created; a field of the metadata named like a column of the data points raises;within_guestchecks its ratios. - Uncertainty quantification, first milestone (#357, #190, #358, #375, #376, #377, #378, #379).
sbmlsim.uncertainty:Uncertainvalues (a value with its SD, CV, range, interval or distribution; a positive value given with SD or CV is log-normal by default) wherever a change takes a value and as the prior of a fit parameter, simulated at their nominal values;Covariance(matrices and correlations, validated) for the dependence between them;propagateruns them through a simulation or scenarios with common random numbers on the scan core, with correlated quasi-random draws and an adaptive number of draws (GUM Supplement 1), and gives the summaries with their Monte Carlo errors, the contrasts between scenarios and the contributions of the uncertain values; probability statements about the predictions which do not depend on the number of draws (anytime-valid confidence sequences; decisionsaccepted,rejected,equivalentorundecidedwhich more draws never reverse), several of them decided at the level of Bonferroni, and hypotheses which a propagation draws until they are decided. The page Uncertainty andexamples/uncertainty_midazolam.pyshow it. The priors of a fit do not enter the optimization yet (MAP, #190), and tests of simulated studies are #380. - Bands, quantiles and log axes for the steps of the integrator (#364). A band of a ragged scan, whose simulations output the steps of their integrator, is drawn: every draw is interpolated onto the time points of the figure (
plot_times,PLOT_POINTS500 points, dense where the integrator stepped densely, and the times of the changes), where a band of a ragged scan raised before. The quantiles of a band sort once (nan_quantile) instead ofnumpy.nanquantile, which took 87 of the 94 s of a sensitivity experiment of midazolam. A log axis shows at mostLOG_DECADES(6) decades below its largest value (log_limits, both backends,limit_log_axesforfigures_mpl), so the tiny first steps of the integrator do not stretch it over dozens of decades.
Fixes
- The margins of a figure do not grow with its number of panels (#323, #363). The margins of a matplotlib figure were the fractions of matplotlib of the whole figure while the panels have a size in inches: a figure of six rows had 3.3 in below its last row. They are the margins of a figure of one panel now.
- The labels of a figure saved without a tight box are not cut off (#362, #381). The margins of matplotlib are sized for its fonts of 10 pt, the label of the x axis of the fonts of sbmlsim ended below the figure, which
figures_mpl(), asavefigwithoutbbox_inches="tight"andshow_mpl_figurescut off. A figure grows by what the ticks and labels of its panels need beyond its margins, at least 0.1 in; the panels keep their size. A label longer than its axis is wrapped at its words. - The links of a report have slashes on Windows (#359). The links of the models, the code, the datasets and the figures of the page of an experiment had the backslashes of a path of Windows; they are paths with slashes, an absolute one a file URL.
- An error which the weights fill is no standard deviation of its point (#368). A zero or missing error of a data point is filled with the largest error of its mapping for the weights of the fit, as before;
DV_SD, the criteria of the standard deviation and the error bars of the figures leave it out (OptimizationProblem.y_errors_measured). - The results of LLJIT at
DEFAULTare not the ones of MCJIT bitwise. The notes of 0.11.0 said so; they differ in the last bits, so a fit can take another path, e.g. the best cost of the hctz fit of the PK data 59.337223 against 59.337767.JitOptimization.O0gives the results of MCJIT bitwise. - No deprecated calls of pandas 3.1. The
inplacekeyword ofDataFrame.renameanddropandfloat_precision="round_trip"ofread_csvare deprecated in pandas 3.1; the comparison of results raised its warning. The tables of the PEtab SciML test suite are read with the parser of python, which reads every number as it was written.
Changes
- Every error of a fit is a standard deviation (#365). The problem keeps the count of every data point (
FitData(count=...), an integer or a column of the dataset, now per row,OptimizationProblem.y_counts) and converts a standard error to a standard deviation,SE * sqrt(count);y_errorsare standard deviations andy_errors_typeis"SD"orNone. The fits of data reported with a standard error change: the weights ofERROR_WEIGHTING, the default noise model of the PEtab likelihood and the error type of the PEtab export use the standard deviation, which issqrt(count)times the standard error. A data point with a standard error and without a count raises aValueErrorwhen the problem is initialized, naming the mapping and the rows. - The residual figure of a fit mapping is removed (#366):
FitReport.plot_fitandplot_fit_residualareplot_mapping, the filesfit_<experiment>_<mapping>.<format>are not written, the figure of a mapping is<experiment>_<mapping>.<format>.FitReport.mapping_titlestates the kind of every mapping,[training]too. - The legend of the data of a mapping is
data (mean ± SD, N = 12), with the count of the subjects, instead ofreference_data ± SD. - The datasets of a run go into the folder
datasetsof the experiment (#359). A run wrote every dataset as<sid>_<dataset>.tsvnext to the figures and results; it writesdatasets/<sid>_<dataset>.tsvbelow the output path of the experiment now (DATASETS_DIR,SimulationExperiment.dataset_file), and the report links them there. An experiment without datasets gets no folder.