Skip to content

Commit eda1482

Browse files
fixing to make check pass
1 parent 9adbe9b commit eda1482

File tree

2 files changed

+33
-16
lines changed

2 files changed

+33
-16
lines changed

selectiveInference/R/funs.randomized.R

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -317,12 +317,32 @@ randomizedLassoInf = function(X,
317317
condition_subgrad=TRUE,
318318
level=0.9,
319319
nsample=10000,
320-
burnin=2000) {
320+
burnin=2000,
321+
max_iter=100, # how many iterations for each optimization problem
322+
kkt_tol=1.e-4, # tolerance for the KKT conditions
323+
parameter_tol=1.e-8, # tolerance for relative convergence of parameter
324+
objective_tol=1.e-8, # tolerance for relative decrease in objective
325+
objective_stop=FALSE,
326+
kkt_stop=TRUE,
327+
param_stop=TRUE)
328+
{
321329

322330
n = nrow(X)
323331
p = ncol(X)
324332

325-
lasso_soln = randomizedLasso(X, y, lam, noise_scale=noise_scale, ridge_term=ridge_term)
333+
lasso_soln = randomizedLasso(X,
334+
y,
335+
lam,
336+
noise_scale=noise_scale,
337+
ridge_term=ridge_term,
338+
max_iter=max_iter,
339+
kkt_tol=kkt_tol,
340+
parameter_tol=parameter_tol,
341+
objective_tol=objective_tol,
342+
objective_stop=objective_stop,
343+
kkt_stop=kkt_stop,
344+
param_stop=param_stop)
345+
326346
active_set = lasso_soln$active_set
327347
inactive_set = lasso_soln$inactive_set
328348
nactive = length(active_set)

selectiveInference/man/randomizedLassoInf.Rd

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -68,20 +68,16 @@ In forming selective confidence intervals and p-values should we condition
6868
on the inactive coordinates of the subgradient as well?
6969
Default is TRUE.
7070
}
71-
\item{level}
72-
{
71+
\item{level}{
7372
Level for confidence intervals.
7473
}
75-
\item{nsample}
76-
{
74+
\item{nsample}{
7775
Number of samples of optimization variables to sample.
7876
}
79-
\item{burnin}
80-
{
77+
\item{burnin}{
8178
How many samples of optimization variable to discard (should be less than nsample).
8279
}
83-
\item{max_iter}
84-
{
80+
\item{max_iter}{
8581
How many rounds of updates used of coordinate descent in solving randomized
8682
LASSO.
8783
}
@@ -99,10 +95,10 @@ of objective value.
9995
\item{kkt_stop}{
10096
Should we use KKT check to determine when to stop?
10197
}
102-
\item{parameter_tol}{
98+
\item{parameter_stop}{
10399
Should we use convergence of parameters to determine when to stop?
104100
}
105-
\item{objective_tol}{
101+
\item{objective_stop}{
106102
Should we use convergence of objective value to determine when to stop?
107103
}
108104
}
@@ -145,13 +141,14 @@ arxiv:1609.05609
145141
set.seed(43)
146142
n = 50
147143
p = 10
148-
sigma = 1
144+
sigma = 0.2
145+
lam = 0.5
149146

150-
x = matrix(rnorm(n*p),n,p)
151-
x = scale(x,TRUE,TRUE)
147+
X = matrix(rnorm(n*p), n, p)
148+
X = scale(X, TRUE, TRUE)
152149

153150
beta = c(3,2,rep(0,p-2))
154-
y = x\%*\%beta + sigma*rnorm(n)
151+
y = X\%*\%beta + sigma*rnorm(n)
155152

156153
result = randomizedLassoInf(X, y, lam)
157154

0 commit comments

Comments
 (0)