Skip to content

Commit

Permalink
Update misc_fcns.py
Browse files Browse the repository at this point in the history
  • Loading branch information
tsikes committed Mar 31, 2021
1 parent cef069b commit f6822d9
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/optimize/misc_fcns.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,7 @@ def diff(x_outlier):
return c*x_outlier

def generalized_loss_fcn(x, mu=0, a=2, c=1): # defaults to L2 loss
c_2 = c**2
x_c_2 = (x-mu)**2/c_2
x_c_2 = ((x-mu)/c)**2

if a == 1: # generalized function reproduces
loss = (x_c_2 + 1)**(0.5) - 1
Expand All @@ -123,7 +122,7 @@ def generalized_loss_fcn(x, mu=0, a=2, c=1): # defaults to L2 loss
else:
loss = np.abs(a-2)/a*((x_c_2/np.abs(a-2) + 1)**(a/2) - 1)

return loss*c_2 + mu # multiplying by c^2 is not necessary, but makes order appropriate
return loss*c**a + mu # multiplying by c^2 is not necessary, but makes order appropriate

def set_bnds(mech, rxnIdx, keys, coefNames):
rxn = mech.gas.reaction(rxnIdx)
Expand Down

0 comments on commit f6822d9

Please sign in to comment.