I am trying to implement a custom objective function in keras frame. Respectively a weighted average function that takes the two arguments tensors y_true and y_pred ; the weights information is derived from y_true tensor.
Is there a weighted average function in tensorflow ? Or any other suggestions on how to implement this kind of loss function ?
My function would look something like this:
function(y_true,y_pred) A=(y_true-y_pred)**2 w - derivable from y_true, tensor of same shape as y_true return average(A, weights=w) <-- a scalar
y_true and y_pred are 3D tensors.