Skip to contents

Visual-linguistic matching losses (Kamath Eq 9.8-9.9)

Usage

morie_kamath_ch9_mml_vlm_loss(Pos, Neg)

morie_kamath_ch9_itm_hard_negative(Pos, HardNeg)

Arguments

Pos, Neg

Probabilities of the correct label in [0, 1].

HardNeg

Hard-negative probabilities.

Value

List with estimate, positive_loss, negative_loss.

Details

One core serves both Python modules exactly as km137 calls km136: km136 -> morie_kamath_ch9_mml_vlm_loss, km137 -> morie_kamath_ch9_itm_hard_negative (the same sum with a hard-negative set).

Examples

morie_kamath_ch9_mml_vlm_loss(c(0.5, 0.25), c(0.5))
#> $estimate
#> [1] 2.772589
#> 
#> $positive_loss
#> [1] 2.079442
#> 
#> $negative_loss
#> [1] 0.6931472
#> 
#> $n_positive
#> [1] 2
#> 
#> $n_negative
#> [1] 1
#> 
#> $n
#> [1] 3
#> 
#> $method
#> [1] "visual-linguistic matching loss (Kamath Eq 9.8)"
#>