How pymultieis works
The fitting algorithm implemented in pymultieis is described in the paper
by Alberto Battistel, Guoqing Du, and Fabio La Mantia.
Fitting is done via complex non-linear optimization of the model parameters using two approaches - deterministic and stochastic.
The deterministic optimization is based on the TNC/BFGS/L-BFGS solvers from the Optimizer API
provided by the Pytorch-minimize library.
The stochastic option uses Adam from the torch.optim.Optimizer class.
Rather than rely on the use prefit and use previous approach to batch-fitting, the algorithm implemented in pymultieis preserves the correlation between parameters by introducing a custom cost function which is a combination of the scaled version of the chisquare used in complex nonlinear regression and two additional terms:
Numerical integral of the second derivative of the parameters with respect to the immittance and
A smoothing factor.
Minimizing these additional terms allow the algorithm to minimize the number of times the curve changes concavity. This allows the minimization algorithm to obtain parameters which smoothly vary as a function of the sequence index.