loss: Loss Function

Description Usage Arguments Value Author(s) References See Also

View source: R/loss.R

Description

Implementation of various loss functions to measure statistical discrepancy between two datasets.

Usage

1
2
3
4
loss(x, y, type = c("MMD", "CvM", "MSE", "BCE"), ...)

MMD(x, y, ...)
CvM(x, y)

Arguments

x

2d-tensor or (n, d)-matrix (during training, n is the batch size and d is the dimension of the input dataset).

y

2d-tensor or (m, d)-matrix (during training, m is the batch size (and typically equal to n) and d is the dimension of the input dataset).

type

character string indicating the type of loss used. Currently available are the (kernel) maximum mean discrepancy ("MMD", calling MMD()), the Cramer-von Mises statistc ("CvM", calling CvM()) of Rémillard and Scaillet (2009), the mean squared error ("MSE") and the binary cross entropy ("BCE").

...

additional arguments passed to the underlying functions, most notably bandwidth (a number or numeric vector of bandwidths for the radial basis function kernels) in case type = "MMD".

Value

loss() returns a 0d tensor containing the loss.

MMD() and CvM() return a 0d tensor (if x and y are tensors) or numeric(1) (if x or y are R matrices).

Author(s)

Marius Hofert and Avinash Prasad

References

Kingma, D. P. and Welling, M. (2014). Stochastic gradient VB and the variational auto-encoder. Second International Conference on Learning Representations (ICLR). See https://keras.rstudio.com/articles/examples/variational_autoencoder.html

Rémillard, B. and Scaillet, O. (2009). Testing for equality between two copulas. Journal of Multivariate Analysis 100, 377–386.

See Also

FNN() where loss() is used.


gnn documentation built on Sept. 20, 2021, 5:13 p.m.

Related to loss in gnn...