# mse

Half mean squared error

## Description

The half mean squared error operation computes the half mean squared error loss between network predictions and target values for regression tasks.

The loss is calculated using the following formula

$$\text{loss}=\frac{1}{2N}{\displaystyle \sum _{i=1}^{M}{({X}_{i}-{T}_{i})}^{2}}$$

where *X _{i}* is the network
prediction,

*T*is the target value,

_{i}*M*is the total number of responses in

*X*(across all observations), and

*N*is the total number of observations in

*X*.

**Note**

This function computes the half mean squared error loss between predictions and targets
stored as `dlarray`

data. If
you want to calculate the half mean squared error loss within a `layerGraph`

object
or `Layer`

array for use
with `trainNetwork`

, use the following layer:

## Examples

## Input Arguments

## Output Arguments

## More About

## Extended Capabilities

## Version History

**Introduced in R2019b**