Least square fit variable
This variable fits a parameter vector \(\mathbf{p}\) consisting of \(M\) parameters \(p_1, p_2,\dots, p_M\) to a model function \(f(\mathbf{x}, \mathbf{p})\) that depends on the model variables \(x_1, x_2,\dots, x_D\). The output of the variable is a least-square estimate of the fit parameters to data points \((\mathbf{x}_i, y_i), i=1,\dots,N\), where \(y_1,\dots,y_n\) are the mean values of the input. That is, the variable locally minimizes
where \(\eta_i^2\) is the variance of input \(i\) to the variable.
name (str)
The name of the variable under which it can be addressed by other variables or objectives. The name must be distinct from any surrogate name.
Default:
"v"
output_dim (int)
Output dimension of the fit variable. The variables outputs the values of the fitted parameters in the first \(M\) entries and the minimum value of the mean squared error \({\rm MSE} = \chi^2/(N-M)\) found after the least-square fit in the last entry. Hence, the output_dim is \(M+1\).
Default: This value has no default and must be provided
output_names (cell{str})
Allows to assign names to each of the outputs of the variable. By specifying input names they can be accessed in variables as
{output_names[0]}, {output_names[1]}, ..., {output_names[K-1]}
, whereK
is the output dimension.Default:
By default, the variables can be accessed as
{name}0, {name}1, ...,{name}(K-1)
, where{name}
is the name of the variable andK
is the output dimension.
input (str)
Names of a multi-output surrogate or variable.
Default: This value has no default and must be provided
initial_parameters (cell{float})
Initial values of the fit parameters to perform the least-square fit.
Default: This value has no default and must be provided
Example
The initial value of \(M=2\) parameters.
{0.5,0.2}
prior_uncertainties (cell{float})
Prior uncertainties of the fit parameters. The posterior covariance of the parameters is determined as the likelihood times the prior.
Default: Each parameter has a uncertainty of 100.
model_variables (cell{str})
The names of the variables \(x_1, x_2,\dots, x_D\) of the model function. The number of variables \(D\) must correspond to the output dimensionality of the input surrogate or variable.
Default: By default, the variables are named ‘x0’, ‘x1’, … ‘x{D-1}’.
variable_values (cell{cell{float}})
The values of the model variables \(\mathbf{x}_1,\dots,\mathbf{x}_N\). This is a list of \(N\) vectors where each entry is a list of \(D\) values.
Default: This value has no default and must be provided
Example
A list with of six values for two variables.
{{1.0,0.0},... {1.0,0.2},... {1.0,0.4},... {2.0,0.0},... {2.0,0.2},... {2.0,0.4}}
expression (str)
The expression describing the model function \(f(\mathbf{x}, \mathbf{p})\). The names of the fit parameters correspond to the first \(M\) output names.
Default: This value has no default and must be provided
Example
Fit of the amplitude, frequency and phase of an oscillating input.
"p0*sin(p1*x0 + p2)"
ftol (float)
The least square problem is solved using scipy.optimize.least_squares. The parameter ftol is one of the convergence criteria. Smaller values correspond to more accurate fitting parameters, but longer fitting times that lead to longer sample computation times.
Default:
1e-05
diff_step (float)
Absolute step size for the finite difference approximation of the Jacobian.
Default:
1e-10
max_nfev (int)
Maximum number of function evaluations before the termination of the least-square fit.
Default: \(100\cdot M\).