diff --git a/rice.py b/rice.py index 8b78e74..ff85355 100644 --- a/rice.py +++ b/rice.py @@ -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)