def log_1minus(x): """Computes log(1 - x). More accurate than doing np.log(1-x).""" return np.log1p(-x)