Skip to contents

Summed cross-entropy over the masked image regions. 1-D labels are 0-BASED class indices; 2-D labels must be one-hot rows. as_printed carries the book's sign, which is the negative of a loss.

Usage

morie_kamath_ch9_moc_loss(theta, w, v, g_theta, labels = NULL)

Arguments

theta

Optional model.

w

Fallback labels.

v

Regions.

g_theta

Class distributions or a function of v.

labels

Truth.

Value

List with estimate, per_region, true_class_probability.

Examples

morie_kamath_ch9_moc_loss(NULL, NULL, NULL, matrix(c(0.7, 0.2,
    0.3, 0.8), 2), labels = c(0, 1))
#> $estimate
#> [1] 0.5798185
#> 
#> $as_printed
#> [1] -0.5798185
#> 
#> $per_region
#> [1] 0.3566749 0.2231436
#> 
#> $true_class_probability
#> [1] 0.7 0.8
#> 
#> $n_masked_regions
#> [1] 2
#> 
#> $n
#> [1] 2
#> 
#> $method
#> [1] "masked object classification loss (Kamath Eq 9.12)"
#>