View source: R/visualize.loss.R
visualize.loss | R Documentation |
Makes a plot or returns a data frame containing the specified loss function evaluated at a sequence of input values.
visualize.loss(x = seq(-3, 3, length.out = 1001),
family = c("gaussian", "multigaussian",
"svm1", "svm2", "logit",
"binomial", "multinomial",
"poisson", "negative.binomial",
"Gamma", "inverse.gaussian"),
theta = 1,
type = c("link", "response"),
y = NULL,
plot = TRUE,
add = FALSE,
...)
x |
sequence of linear predictor values at which to evaluate the loss. |
family |
Character specifying the assumed distribution for the response variable. Partial matching is allowed. See options below. |
theta |
For SVM1: additional ("smoothing") parameter, that controls the smoothing rate of the hinge loss function.
For negative binomial: additional ("size") parameter, where the variance function is defined as |
type |
Default of |
y |
Response value used to compute loss. Note that the loss function is interpreted as a function of |
plot |
if |
add |
if |
... |
additional arguments passed to |
grpnet implements the following loss functions:
L = (y - \mu)^2
L = \left\{ \begin{array}{ll}
\frac{1}{2\theta}(1 - \mu y)_{+}^2 & 1 - \theta < \mu y \\
1 - \mu y - \theta / 2 & \mu y \leq 1 - \theta
\end{array} \right.
L = (1 - \mu y)_{+}^2
L = \log(1 + \exp(-\mu y))
L = -y\log(\mu) - (1-y) \log(1-\mu)
L = -\sum_{l=1}^m I(y=l) \log(\mu_l)
L = \mu - y \log(\mu)
L = (\theta + y) \log(\theta + \mu) - y \log(\mu) + c
where c = \log(\Gamma(\theta)) - \log(\Gamma(\theta + y)) - \theta \log(\theta)
is a constant with respect to \mu
L = \log(\mu) + y / \mu
L = (y - \mu)^2 / (\mu^2 y)
If plot = TRUE
, a plot is produced and nothing is returned.
If plot = FALSE
, a data frame is returned with columns:
eta |
linear predictor, i.e., fitted values on link scale (same as input |
mu |
expected value, i.e., fitted values on response scale ( |
loss |
loss function evaluation for given |
Nathaniel E. Helwig <helwig@umn.edu>
Helwig, N. E. (2025). Versatile descent algorithms for group regularization and variable selection in generalized linear models. Journal of Computational and Graphical Statistics, 34(1), 239-252. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1080/10618600.2024.2362232")}
visualize.penalty
for plotting penalty function
visualize.shrink
for plotting shrinkage operator
visualize.loss(family = "gaussian")
visualize.loss(family = "svm1", theta = 0.1)
visualize.loss(family = "svm2")
visualize.loss(family = "logit")
visualize.loss(family = "binomial")
visualize.loss(family = "poisson")
visualize.loss(family = "negative.binomial", theta = 10)
visualize.loss(family = "Gamma")
visualize.loss(family = "inverse.gaussian")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.