Josek20 / MetaProject

0 stars 0 forks source link

Parametrize loss function with function #1

Closed pevnak closed 2 weeks ago

pevnak commented 3 weeks ago

logistic(x) = log(1 + exp(x))
hinge(x) = max(0, 1 - x)
loss01(x) = x > 0

function policy_loss_func1(policy, ee, yj, surrogate::Function = logistic)
    p = policy(ee)
    diff = p[1, yj] .- p
    filtered_diff = filter(!=(0), diff)
    loss = sum(surrogate.(filtered_diff))
end