Skip to content

Commit

Permalink
update fix for pct loss
Browse files Browse the repository at this point in the history
  • Loading branch information
tianyu-z committed Jul 29, 2024
1 parent abaf8b1 commit ee22aa6
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions rice.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,10 +129,10 @@ def softthreshold(self, x, threshold, bias=0):

def percentage_adjustment(self, numerator, denominator):
# This function is used to handle division by zero and small values
if np.abs(denominator) < 1e-3:
return 0
elif np.abs(numerator) < 1e-3:
if np.abs(denominator) < 1e-2 and np.abs(numerator) < 1e-2:
return 0
elif np.abs(denominator) < 1e-2:
return 1e-2
else:
return self.softthreshold(numerator / denominator - 1, 1e-3)

Expand Down

0 comments on commit ee22aa6

Please sign in to comment.