Here is the function im running to get these values:
local function Loss(Inputs, Targets)
local Results = {}
for Index, Input in ipairs(Inputs) do
local SubResult = 0
for SampleIndex, Sample in ipairs(Input) do
local Product = Sample * Targets[SampleIndex]
SubResult += math.log(Product)
end
Results[Index] = -SubResult
end
return Results
end
Example:
Loss({
{ 0.02100454376380645, 0.9789954562361937 },
{ 5.075780888480321e-05, 0.9999492421911151 },
{ 1.255685226570402e-67, 1 },
{ 7.185125660791943e-75, 1 }
}, {1, 0})
Output:
{ inf, inf, inf, inf }
I’ve tried running this same function in the output however but doing the math manually, and it returns a proper number instead of inf or -inf.