ssfortran.fit_many#
- ssfortran.fit_many(models, maxiter=500, m=10, factr=10000000.0, pgtol=1e-05, compute_cov=True, gradient='auto')#
Fit independent models in parallel.
The library fits the models on OpenMP threads, with the GIL released.
- Parameters:
- modelssequence of StructuralModel or MappedModel
The models; each is left at its estimates.
- maxiterint, optional
Maximum number of iterations.
- mint, optional
Number of L-BFGS corrections.
- factrfloat, optional
Relative reduction tolerance, in units of the machine epsilon.
- pgtolfloat, optional
Projected gradient tolerance.
- compute_covbool, optional
Compute standard errors.
- gradient{“auto”, “analytic”, “numerical”}, optional
As for
Model.fit().
- Returns:
- list of FitResults or None
One result per model; None where the likelihood could not be evaluated.
- Raises:
- TypeError
If a model is an
MLEModel: Python callbacks cannot run on the library’s threads.
Notes
The library must be built with OpenMP (the default with CMake). For large models set
OPENBLAS_NUM_THREADS=1to avoid nested threading in BLAS.Examples
>>> rng = np.random.default_rng(5) >>> ys = [np.cumsum(rng.standard_normal(80)) for _ in range(4)] >>> results = ss.fit_many([ss.StructuralModel(y, [ss.Irregular(), ss.Level()]) ... for y in ys]) >>> [r.converged for r in results] [True, True, True, True]