MCPcopy
hub / github.com/tensorflow/tfjs / meanSquaredLogarithmicError

Function meanSquaredLogarithmicError

tfjs-layers/src/losses.ts:56–67  ·  view source on GitHub ↗
(
    yTrue: Tensor, yPred: Tensor)

Source from the content-addressed store, hash-verified

54}
55
56export function meanSquaredLogarithmicError(
57 yTrue: Tensor, yPred: Tensor): Tensor {
58 return tidy(() => {
59 const clippedPred = tfc.clipByValue(yPred, epsilon(), Number.MAX_VALUE);
60 const firstLog = tfc.log(tfc.add(1, clippedPred));
61
62 const clippedTrue = tfc.clipByValue(yTrue, epsilon(), Number.MAX_VALUE);
63 const secondLog = tfc.log(tfc.add(1, clippedTrue));
64
65 return tfc.mean(K.square(tfc.sub(firstLog, secondLog)), -1);
66 });
67}
68
69export function squaredHinge(yTrue: Tensor, yPred: Tensor): Tensor {
70 return tidy(() => {

Callers

nothing calls this directly

Calls 8

tidyFunction · 0.90
epsilonFunction · 0.90
clipByValueMethod · 0.80
meanMethod · 0.80
squareMethod · 0.80
subMethod · 0.80
logMethod · 0.65
addMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…