Skip to contents

V = mean log D(x) + mean log(1 - D(G(z))) after clipping to [eps, 1-eps]; the accuracy uses the UNCLIPPED probabilities.

Usage

morie_geron_gan_minimax(real, fake, D_real, D_fake, eps = 1e-12)

Arguments

real, fake

Real and fake batches (used only for their sizes).

D_real, D_fake

Discriminator probabilities in [0, 1].

eps

Clip guard in (0, 0.5).

Value

List with value, d_loss, g_loss_nonsaturating, g_loss_saturating, d_accuracy, at_equilibrium.

Examples

x <- matrix(c(1, 0, 0.5, 1), 2, byrow = TRUE)
morie_geron_encoder_decoder_seq2seq(function(x) c(sum(x), 1),
    function(yp, cc, t) as.numeric(yp) * 0.5 + cc[1]/t, c(1,
        2, 3), 4)
#> $outputs
#> $outputs[[1]]
#> [1] 6 6
#> 
#> $outputs[[2]]
#> [1] 6 6
#> 
#> $outputs[[3]]
#> [1] 5 5
#> 
#> $outputs[[4]]
#> [1] 4 4
#> 
#> 
#> $context
#> [1] 6 1
#> 
#> $context_dim
#> [1] 2
#> 
#> $n_steps
#> [1] 4
#> 
#> $stopped_early
#> [1] FALSE
#> 
#> $estimate
#> $estimate[[1]]
#> [1] 6 6
#> 
#> $estimate[[2]]
#> [1] 6 6
#> 
#> $estimate[[3]]
#> [1] 5 5
#> 
#> $estimate[[4]]
#> [1] 4 4
#> 
#> 
#> $n
#> [1] 4
#> 
morie_geron_gan_minimax(real = x, fake = x, D_real = x, D_fake = x)
#> $value
#> [1] -21.06985
#> 
#> $d_loss
#> [1] 21.06985
#> 
#> $g_loss_nonsaturating
#> [1] 7.081042
#> 
#> $g_loss_saturating
#> [1] -13.98881
#> 
#> $d_accuracy
#> [1] 0.5
#> 
#> $at_equilibrium
#> [1] FALSE
#> 
#> $n_real
#> [1] 2
#> 
#> $n_fake
#> [1] 2
#> 
#> $estimate
#> [1] -21.06985
#> 
#> $n
#> [1] 8
#>