Computes the Frobenius norm of matrix entries
metric_frobenius_norm(estimate, oracle, na.rm = FALSE)
estimate | Estimated values from the model. |
---|---|
oracle | Known values used to generate the model. |
na.rm | A |
A single numeric
value.
The Frobenius norm is an extension of the Euclidean norm to \(\mathcal{K}^{n\times n}\).
The metric is computed under: $$\|A\|_{\rm F} = \left(\sum_{i=1}^m \sum_{j=1}^n |a_{ij}|^2\right)^{\frac{1}{2}}$$
The Frobenius norm is best used to understand differences between the estimated \(\hat\theta\) matrix and the oracle \(\theta\) matrix.
# Construct data estimate = matrix(c(1,1,2,4,3,6), nrow = 2, ncol = 3) truth = matrix(c(1,2,3,4,5,6), nrow = 2, ncol = 3) # Compute the frobenius norm metric_frobenius_norm(estimate, truth)#> [1] 2.44949