<p>You'd just sum the losses over each of the dimensions.</p>
<p>If your model outputs a vector of size <span class="math-container">$d$</span>, it's functionally the same as if you had a model that outputs <span class="math-container">$d$</span> different outputs, with <span class="math-container">$d$</span> different labels.</p>
<p>If you had <span class="math-container">$d$</span> labels, for some loss <span class="math-container">$L$</span>:
<span class="math-container">$$\sum_{i\ \in\ [1 .. d]} \frac{1}{n} \sum_{j\ \in\ [1..n]} \mathcal{L}(Y_{j,i}, \hat{Y}_{j,i}) = \frac{1}{n} \sum_{j\ \in\ [1..n]} \sum_{i\ \in\ [1 .. d]} \mathcal{L}(Y_{j,i}, \hat{Y}_{j,i})$$</span></p>
<p><a href="https://arxiv.org/abs/1511.08861" rel="nofollow noreferrer">You can see this, for example, for image generation tasks, where both the target and the prediction are matrices.</a> For each image prediction, they average the loss over each of the pixels.</p>

CC BY-SA 4.0
2023-10-08T01:34:37.673Z
2023-10-08T01:34:37.673Z
Alexander Wan
<p>What are the formulas for the MAE , MSE  when output is a vector?</p>
<p>MAE: Mean Absolute Error</p>
<p>MSE: Mean squared error</p>

CC BY-SA 4.0
2023-10-07T06:56:32.787Z
By output, do you mean the output of your model? And I'm assuming the label would be a similarly shaped vector as well?
Alexander Wan
CC BY-SA 4.0
2023-10-07T19:17:28.027Z
yes, i mean the output of the model (and yes label is a vector also).
DSPinfinity
<machine-learning><linear-algebra>
What are the formulas for the MAE , MSE when output is a vector?
DSPinfinity
# What are the formulas for the MAE , MSE when output is a vector?

(Asked by: username_0 on 2023-10-06)

What are the formulas for the MAE , MSE when output is a vector?

MAE: Mean Absolute Error

MSE: Mean squared error

**Tags:** machine-learning, linear-algebra

> **Comments:**
> **username_1**: By output, do you mean the output of your model? And I'm assuming the label would be a similarly shaped vector as well?  
> **username_0**: yes, i mean the output of the model (and yes label is a vector also).  

---

## 1 answers

### Answer by username_1 on 2023-10-08. Score: 1 | Accepted answer

You'd just sum the losses over each of the dimensions.

If your model outputs a vector of size $d$, it's functionally the same as if you had a model that outputs $d$ different outputs, with $d$ different labels.

If you had $d$ labels, for some loss $L$:
$$\sum\_{i\ \in\ [1 .. d]} \frac{1}{n} \sum\_{j\ \in\ [1..n]} \mathcal{L}(Y\_{j,i}, \hat{Y}\_{j,i}) = \frac{1}{n} \sum\_{j\ \in\ [1..n]} \sum\_{i\ \in\ [1 .. d]} \mathcal{L}(Y\_{j,i}, \hat{Y}\_{j,i})$$

[You can see this, for example, for image generation tasks, where both the target and the prediction are matrices.](https://arxiv.org/abs/1511.08861) For each image prediction, they average the loss over each of the pixels.


---

