b0fbaafddcb5a67eb3e4e093974c546324ccb5d0,pyglmnet/pyglmnet.py,,_mu,#Any#Any#Any#Any#,93
Before Change
def _mu(distr, z, eta, fit_intercept):
The non-linearity (inverse link).
if distr in ["softplus", "gamma", "neg-binomial"]:
mu = log1p(np.exp(z))
elif distr == "poisson":
mu = z.copy()
beta0 = (1 - eta) * np.exp(eta) if fit_intercept else 0.
mu[z > eta] = z[z > eta] * np.exp(eta) + beta0
After Change
// prevent zeros.
// https://cran.r-project.org/web/packages/Rmpfr/vignettes/log1mexp-note.pdf
mu = z.copy()
mu[z <= 1] = log1p(np.exp(z[z <= 1]))
mu[z > 1] = (z[z > 1] + log1p(np.exp(-z[z > 1]))) + 1 * 10e-10
elif distr == "poisson":
mu = z.copy()
beta0 = (1 - eta) * np.exp(eta) if fit_intercept else 0.
In pattern: SUPERPATTERN
Frequency: 3
Non-data size: 6
Instances
Project Name: glm-tools/pyglmnet
Commit Name: b0fbaafddcb5a67eb3e4e093974c546324ccb5d0
Time: 2020-08-16
Author: giovanni.det@gmail.com
File Name: pyglmnet/pyglmnet.py
Class Name:
Method Name: _mu
Project Name: glm-tools/pyglmnet
Commit Name: b0fbaafddcb5a67eb3e4e093974c546324ccb5d0
Time: 2020-08-16
Author: giovanni.det@gmail.com
File Name: pyglmnet/pyglmnet.py
Class Name:
Method Name: _mu
Project Name: pymc-devs/pymc3
Commit Name: 823906a3efcf66897eac8a4c89052d9153bca49e
Time: 2021-01-22
Author: 28983449+ricardoV94@users.noreply.github.com
File Name: pymc3/math.py
Class Name:
Method Name: log1mexp_numpy
Project Name: PIQuIL/QuCumber
Commit Name: aacf14504b82087378db638d8f0463bc9933cabd
Time: 2018-05-22
Author: emerali@users.noreply.github.com
File Name: benchmarks/python/rbm.py
Class Name: RBM
Method Name: ln1pexp