Description Usage Arguments Details Value Examples
Fit a dropout lasso (droplasso) model. The regularization path is computed for the lasso component of the penalty at a grid of values for the regularization parameter lambda.
1 2 3 4 |
x |
Input matrix, of dimension |
y |
Response variable, a vector of length |
family |
Response type. |
keep_prob |
The probability that each element is kept (default:
|
nlambda |
The number of |
lambda.min.ratio |
Smallest value for |
lambda |
The sequence of regularization parameters. By default,
|
init |
Initial model to start optimization (default: zero vector). |
gamma0 |
Initial value of the learning rate (default: |
decay |
Learning rate decay (default: |
n_passes |
Number of passes over each example of the data on average
(default: |
minibatch_size |
Batch size (default: |
Droplasso estimates a linear model by minimizing an objective function
\min_{w} R(w) + λ*||w||_1
where R(w) is the
expected loss when the linear model is applied to a random training example
subject to dropout noise, i.e., each coordinate is kept intact with
probability keep_prob
and set to zero with probability 1 -
keep_prob
.
Given a prediction u and a true label y, the loss is
(u-y)^2 / 2 when family="gaussian"
, and -y*u + ln( 1+e^u
) when family="binomial"
(i.e., the negative log-likelihood of the
logistic regression model).
The optimization problem is solved with a stochastic proximal
gradient descent algorithm, using mini-batches of size
minibatch_size
, and a learning rate decaying as
gamma0/(1+decay*t)
, where t
is the number of mini-batches
processed.
The problem is solved for all regularization parameters provided in
the lambda
argument. If no lambda
argument is provided, then
the function automatically chooses a decreasing sequence of λ's
to start from the null model and add features in the model along the
regularization path. We use warm restart to start optimization for a given
λ from the solution of the previous lambda, therefore it
is strongly recommended to provide a sequence of λ$'s in
decreasing order if a sequence is provided in the lambda
argument.
An object of class "droplasso"
, i.e. a list with the
following:
beta |
The |
lambda |
The sequence of lambda for which the weigth is given |
nzero |
The number of non-zero coefficient in each model |
call |
The function call |
1 2 3 4 5 6 7 8 9 10 11 12 13 | #create data:
nobs = 100
nvars = 5
x = matrix(rnorm(nobs*nvars),nrow=nobs)
b = c(1,1,0,0,0)
p = 1/(1+exp(-x%*%b))
y = p>0.5
# Fit a lasso model (no dropout)
droplasso(x, y, family="binomial", lambda=0.1, keep_prob=1)
# Fit a dropout model (no lasso)
droplasso(x, y, family="binomial", lambda=0, keep_prob=0.5)
# Fit a dropout lasso model
droplasso(x, y, family="binomial", lambda=0.1, keep_prob=0.5)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.