.. _appx-smathry-rsmerr:

RSM Error Metrics
-----------------

There are five error metrics available to assess the quality of a surrogate model
in the :ref:`sma-rsm-model` tab of the :ref:`sma-rsm` node. The commonly used metrics are
defined below where :math:`r_i` is taken to be the response of the actual (full) model and
:math:`f_i` is the response surface model evaluated at the :math:`i^\textrm{th}` (input)
sample index ranging. In the following definitions, :math:`i` is simply taken to range
from 1 to :math:`n`, however it should be noted that this range may be applied to either
the complete dataset or the holdout data if cross-validation is being considered,
see :ref:`sma-rsm-model` for more details.



.. _appx-smathry-rsmerr-mse:

Mean Squared Error
++++++++++++++++++

.. math::
  \textrm{MSE} = \frac{{1}}{{n}} {\sum_{i=1}^n \left(r_i - f_i \right)^2 }


.. _appx-smathry-rsmerr-sse:

Sum of Squared Error
++++++++++++++++++++

.. math::
  \textrm{SSE} = {\sum_{i=1}^n \left(r_i - f_i \right)^2 }


.. _appx-smathry-rsmerr-rsq:

R squared
+++++++++

.. math::
  \textrm{R}^2 = 1 - \frac{{\sum_{i=1}^n \left( r_i - f_i \right)^2}}
  {{\sum_{i=1}^n \left( r_i - \bar{r} \right)^2}}

where

.. math::
  \bar{r} = \frac{{1}}{{n}} {\sum_{i=1}^n r_i }

is the mean response.



.. _appx-smathry-rsmerr-linf:

L_infinity norm
+++++++++++++++

.. math::
  \textrm{L}_\infty = \frac{{ \max \left| r_i - f_i \right| }}{{ \max \left| r_i \right| }}



.. _appx-smathry-rsmerr-l1:

L_1 norm
++++++++

.. math::
  \textrm{L}_1 = \frac{{ \sum_{i=1}^n \left| r_i - f_i \right| }}
  {{ \sum_{i=1}^n \left| r_i \right| }}



.. _appx-smathry-rsmerr-l2:

L_2 norm
++++++++

.. math::
  \textrm{L}_2 = \frac{{ \sum_{i=1}^n \left( r_i - f_i \right)^2 }}
  {{ \sum_{i=1}^n  r_i^2 }}