bounded_sigmoid(x; lb = 0.05f0, ub = 0.95f0) = (ub - lb) * sigmoid(x) + lb
bounded_sigmoid_inverse(x; lb = 0.05f0, ub = 0.95f0) = log(x - lb) - log(ub - x)

softplus_inverse(x) = log(-expm1(x)) + x

reluLB(x; lb::Float32 = 0.0f0) = ifelse(x < lb, ones(size(x)) * lb, x)

rmse(x, y) = sqrt(mse(x, y))

function negative_binomial_loglikelihood(r::Number, p::Number, y::Number)
    ll = loggamma(y + r) - loggamma(y + 1) - loggamma(r) + (r * log(p)) + (y * log(1 - p))
    return -ll
end
