Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions deerlab/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -1018,7 +1018,7 @@ def decorator(func):
#==============================================================================================
@insert_snlls_optionals_docstrings()
def fit(model_, y, *constants, par0=None, penalties=None, bootstrap=0, noiselvl=None, mask=None, weights=None,
regparam='aic',reg='auto',regparamrange=None,**kwargs):
regparam='aic',reg='auto',regparamrange=None, bootcores=1,**kwargs):
r"""
Fit the model(s) to the dataset(s)

Expand Down Expand Up @@ -1051,6 +1051,10 @@ def fit(model_, y, *constants, par0=None, penalties=None, bootstrap=0, noiselvl=
bootstrap : scalar, optional,
Bootstrap samples for uncertainty quantification. If ``bootstrap>0``, the uncertainty quantification will be
performed via the boostrapping method with based on the number of samples specified as the argument.

bootcores : scalar, optional
Number of CPU cores/processes for parallelization of the bootstrap uncertainty quantification. If ``cores=1`` no parallel
computing is used. If ``cores=-1`` all available CPUs are used. The default is one core (no parallelization).

reg : boolean or string, optional
Determines the use of regularization on the solution of the linear problem.
Expand Down Expand Up @@ -1264,7 +1268,7 @@ def bootstrap_fcn(ysim):
if not isinstance(fit.model,list): fit.model = [fit.model]
return (fit.param,*fit.model)
# Bootstrapped uncertainty quantification
param_uq = bootstrap_analysis(bootstrap_fcn,ysplit,fitresults.model,samples=bootstrap,noiselvl=noiselvl)
param_uq = bootstrap_analysis(bootstrap_fcn,ysplit,fitresults.model,samples=bootstrap,noiselvl=noiselvl,cores=bootcores)
# Include information on the boundaries for better uncertainty estimates
paramlb = model._vecsort(model._getvector('lb'))[np.concatenate(param_idx)]
paramub = model._vecsort(model._getvector('ub'))[np.concatenate(param_idx)]
Expand Down