.. _model-surrogate-global_approx-moving_least_squares:

""""""""""""""""""""
moving_least_squares
""""""""""""""""""""


Moving Least Squares surrogate models


.. toctree::
   :hidden:
   :maxdepth: 1

   model-surrogate-global_approx-moving_least_squares-basis_order
   model-surrogate-global_approx-moving_least_squares-weight_function
   model-surrogate-global_approx-moving_least_squares-export_model
   model-surrogate-global_approx-moving_least_squares-import_model


**Specification**

- *Alias:* None

- *Arguments:* None


**Child Keywords:**

+-------------------------+--------------------+---------------------+-----------------------------------------------+
| Required/Optional       | Description of     | Dakota Keyword      | Dakota Keyword Description                    |
|                         | Group              |                     |                                               |
+=========================+====================+=====================+===============================================+
| Optional                                     | `basis_order`__     | Polynomial order for the MLS bases            |
+----------------------------------------------+---------------------+-----------------------------------------------+
| Optional                                     | `weight_function`__ | Selects the weight function for the MLS model |
+----------------------------------------------+---------------------+-----------------------------------------------+
| Optional                                     | `export_model`__    | Exports surrogate model in user-specified     |
|                                              |                     | format(s)                                     |
+----------------------------------------------+---------------------+-----------------------------------------------+
| Optional                                     | `import_model`__    | Import surrogate model from archive file      |
+----------------------------------------------+---------------------+-----------------------------------------------+

.. __: model-surrogate-global_approx-moving_least_squares-basis_order.html
__ model-surrogate-global_approx-moving_least_squares-weight_function.html
__ model-surrogate-global_approx-moving_least_squares-export_model.html
__ model-surrogate-global_approx-moving_least_squares-import_model.html



**Description**


Moving least squares is a further generalization of weighted least squares
where the weighting is "moved" or recalculated for every new point where
a prediction is desired :cite:p:`Nea04`.

*The implementation of moving least squares is still under
development.* It tends to work well in trust region optimization
methods where the surrogate model is constructed in a constrained
region over a few points. The present implementation may not work as
well globally.

*Known Issue: When using discrete variables, there have been
sometimes significant differences in surrogate behavior observed
across computing platforms in some cases.  The cause has not yet been
fully diagnosed and is currently under investigation.  In addition,
guidance on appropriate construction and use of surrogates with
discrete variables is under development.  In the meantime, users
should therefore be aware that there is a risk of inaccurate results
when using surrogates with discrete variables.*



**Theory**


Moving Least Squares can be considered a more specialized
version of linear regression models. In linear regression,
one usually attempts to minimize the sum of the squared residuals,
where the residual is defined as the difference between the
surrogate model and the true model at a fixed number of points.

In weighted least squares, the residual terms are weighted so the
determination of the optimal coefficients governing the polynomial
regression function, denoted by :math:`\hat{f}({\bf x})` , are obtained by
minimizing the weighted sum of squares at N data points:


.. math::  \sum_{n=1}^{N}w_{n}({\parallel \hat{f}({\bf x_{n}})-f({\bf x_{n}})\parallel}) 



