.. _FitVariable: Least square fit variable ------------------------- This variable fits a parameter vector :math:`\mathbf{p}` consisting of :math:`M` parameters :math:`p_1, p_2,\dots, p_M` to a model function :math:`f(\mathbf{x}, \mathbf{p})` that depends on the model variables :math:`x_1, x_2,\dots, x_D`. The output of the variable is a least-square estimate of the fit parameters to data points :math:`(\mathbf{x}_i, y_i), i=1,\dots,N`, where :math:`y_1,\dots,y_n` are the mean values of the input. That is, the variable locally minimizes .. math:: \chi^2(\mathbf{p}) = \sum_{i=1}^N \frac{\left(f\left(\mathbf{x}_i, \mathbf{p}\right) - y_i\right)^2}{\eta_i^2}, where :math:`\eta_i^2` is the variance of input :math:`i` to the variable. .. _ActiveLearning.Fit.name: 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'`` .. _ActiveLearning.Fit.output_dim: output_dim (int) """""""""""""""" Output dimension of the fit variable. The variables outputs the values of the fitted parameters in the first :math:`M` entries and the minimum value of the mean squared error :math:`{\rm MSE} = \chi^2/(N-M)` found after the least-square fit in the last entry. Hence, the `output_dim` is :math:`M+1`. Default: This value has no default and must be provided .. _ActiveLearning.Fit.output_names: output_names (list[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]}``, where ``K`` 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 and ``K`` is the output dimension. .. _ActiveLearning.Fit.input: input (str) """"""""""" Names of a multi-output surrogate or variable. Default: This value has no default and must be provided .. _ActiveLearning.Fit.initial_parameters: initial_parameters (list[float]) """""""""""""""""""""""""""""""" Initial values of the fit parameters to perform the least-square fit. Default: This value has no default and must be provided .. admonition:: Example The initial value of :math:`M=2` parameters. .. code-block:: python [0.5,0.2] .. _ActiveLearning.Fit.prior_uncertainties: prior_uncertainties (list[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. .. _ActiveLearning.Fit.model_variables: model_variables (list[str]) """"""""""""""""""""""""""" The names of the variables :math:`x_1, x_2,\dots, x_D` of the model function. The number of variables :math:`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}'. .. _ActiveLearning.Fit.variable_values: variable_values (list[list[float]]) """"""""""""""""""""""""""""""""""" The values of the model variables :math:`\mathbf{x}_1,\dots,\mathbf{x}_N`. This is a list of :math:`N` vectors where each entry is a list of :math:`D` values. Default: This value has no default and must be provided .. admonition:: Example A list with of six values for two variables. .. code-block:: python [[1.0,0.0], [1.0,0.2], [1.0,0.4], [2.0,0.0], [2.0,0.2], [2.0,0.4]] .. _ActiveLearning.Fit.expression: expression (str) """""""""""""""" The expression describing the model function :math:`f(\mathbf{x}, \mathbf{p})`. The names of the fit parameters correspond to the first :math:`M` output names. Default: This value has no default and must be provided .. admonition:: Example Fit of the amplitude, frequency and phase of an oscillating input. .. code-block:: python 'p0*sin(p1*x0 + p2)' .. _ActiveLearning.Fit.ftol: 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`` .. _ActiveLearning.Fit.diff_step: diff_step (float) """"""""""""""""" Absolute step size for the finite difference approximation of the Jacobian. Default: ``1e-10`` .. _ActiveLearning.Fit.max_nfev: max_nfev (int) """""""""""""" Maximum number of function evaluations before the termination of the least-square fit. Default: :math:`100\cdot M`.