Skip to content

Commit c2460a1

Browse files
fixing documentation
1 parent 9c7bfcc commit c2460a1

File tree

4 files changed

+71
-46
lines changed

4 files changed

+71
-46
lines changed

selectiveInference/NAMESPACE

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,5 +43,6 @@ importFrom("stats", dnorm, lsfit, pexp, pnorm, predict,
4343
qnorm, rnorm, sd, uniroot, dchisq, model.matrix, pchisq)
4444
importFrom("stats", "coef", "df", "lm", "pf")
4545
importFrom("stats", "glm", "residuals", "vcov")
46+
importFrom("stats", "rbinom", "rexp")
4647
importFrom("Rcpp", "sourceCpp")
4748

selectiveInference/man/debiasingMatrix.Rd

Lines changed: 23 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,18 @@ debiasingMatrix(Xinfo,
1616
nsample,
1717
rows,
1818
verbose=FALSE,
19-
mu=NULL,
19+
bound=NULL,
2020
linesearch=TRUE,
2121
scaling_factor=1.5,
2222
max_active=NULL,
2323
max_try=10,
2424
warn_kkt=FALSE,
2525
max_iter=100,
26+
kkt_stop=TRUE,
27+
parameter_stop=TRUE,
28+
objective_stop=TRUE,
2629
kkt_tol=1.e-4,
30+
parameter_tol=1.e-4,
2731
objective_tol=1.e-8)
2832
}
2933
\arguments{
@@ -38,15 +42,15 @@ matrix of interest is t(X) %*% X / nrow(X).
3842
}
3943
\item{nsample}{
4044
Number of samples used in forming the cross-covariance matrix.
41-
Used for default value of the bound parameter mu.
45+
Used for default value of the bound parameter.
4246
}
4347
\item{rows}{
4448
Which rows of the approximate inverse to compute.
4549
}
4650
\item{verbose}{
4751
Print out progress as rows are being computed.
4852
}
49-
\item{mu}{
53+
\item{bound}{
5054
Initial bound parameter for each row. Will be changed
5155
if linesearch is TRUE.
5256
}
@@ -72,10 +76,25 @@ descent algorithm.
7276
How many full iterations to run of the coordinate descent for each
7377
value of the bound parameter.
7478
}
79+
\item{kkt_stop}{
80+
If TRUE, check to stop coordinate descent when KKT conditions are approximately satisfied.
81+
}
82+
\item{parameter_stop}{
83+
If TRUE, check to stop coordinate descent based on relative convergence of parameter vector,
84+
checked at geometrically spaced iterations 2^k.
85+
}
86+
\item{objective_stop}{
87+
If TRUE, check to stop coordinate descent based on relative decrease of objective value,
88+
checked at geometrically spaced iterations 2^k.
89+
}
7590
\item{kkt_tol}{
7691
Tolerance value for assessing whether KKT conditions for solving the
7792
dual problem and feasibility of the original problem.
7893
}
94+
\item{parameter_tol}{
95+
Tolerance value for assessing convergence of the problem using relative
96+
convergence of the parameter.
97+
}
7998
\item{objective_tol}{
8099
Tolerance value for assessing convergence of the problem using relative
81100
decrease of the objective.
@@ -86,7 +105,7 @@ This function computes an approximate inverse
86105
as described in Javanmard and Montanari (2013), specifically
87106
display (4). The problem is solved by considering a dual
88107
problem which has an objective similar to a LASSO problem and is solvable
89-
by coordinate descent. For some values of mu the original
108+
by coordinate descent. For some values of bound the original
90109
problem may not be feasible, in which case the dual problem has no solution.
91110
An attempt to detect this is made by stopping when the active set grows quite
92111
large, determined by max_active.

selectiveInference/src/quadratic_program.c

Lines changed: 23 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -385,10 +385,12 @@ int solve_qp(double *nndef_ptr, /* A non-negative definite matrix */
385385
}
386386
}
387387

388-
// Check based on norm -- from Adel's debiasing code
389388

390-
if (param_stop) {
391-
if (iter == 2 * iter_old) {
389+
if (iter == 2 * iter_old) { // Geometric iterations from Adel's code
390+
391+
// Check based on norm
392+
393+
if (param_stop) {
392394
iter_old = iter;
393395
norm_diff = 0;
394396
norm_last = 0;
@@ -407,6 +409,24 @@ int solve_qp(double *nndef_ptr, /* A non-negative definite matrix */
407409
break;
408410
}
409411
}
412+
413+
// Check relative decrease of objective
414+
415+
if (objective_stop) {
416+
new_value = objective_qp(nndef_ptr,
417+
linear_func_ptr,
418+
ever_active_ptr,
419+
nactive_ptr,
420+
nfeature,
421+
bound,
422+
theta);
423+
424+
if ((fabs(old_value - new_value) < objective_tol * fabs(new_value)) && (iter > 0)) {
425+
break;
426+
}
427+
old_value = new_value;
428+
}
429+
410430
}
411431

412432
// Check size of active set
@@ -415,23 +435,6 @@ int solve_qp(double *nndef_ptr, /* A non-negative definite matrix */
415435
break;
416436
}
417437

418-
// Check relative decrease of objective
419-
420-
if (objective_stop) {
421-
new_value = objective_qp(nndef_ptr,
422-
linear_func_ptr,
423-
ever_active_ptr,
424-
nactive_ptr,
425-
nfeature,
426-
bound,
427-
theta);
428-
429-
if ((fabs(old_value - new_value) < objective_tol * fabs(new_value)) && (iter > 0)) {
430-
break;
431-
}
432-
old_value = new_value;
433-
}
434-
435438
}
436439
return(iter);
437440
}

selectiveInference/src/quadratic_program_wide.c

Lines changed: 24 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -534,10 +534,11 @@ int solve_wide(double *X_ptr, /* Sqrt of non-neg def matrix -- X^TX
534534
}
535535
}
536536

537-
// Check based on norm -- from Adel's debiasing code
537+
if (iter == 2 * iter_old) { // Geometric iterations from Adel's code
538538

539-
if (param_stop) {
540-
if (iter == 2 * iter_old) {
539+
// Check based on norm
540+
541+
if (param_stop) {
541542
iter_old = iter;
542543
norm_diff = 0;
543544
norm_last = 0;
@@ -556,32 +557,33 @@ int solve_wide(double *X_ptr, /* Sqrt of non-neg def matrix -- X^TX
556557
break;
557558
}
558559
}
560+
561+
// Check relative decrease of objective
562+
563+
if (objective_stop) {
564+
new_value = objective_wide(X_theta_ptr,
565+
linear_func_ptr,
566+
ever_active_ptr,
567+
nactive_ptr,
568+
ncase,
569+
nfeature,
570+
bound_ptr,
571+
ridge_term,
572+
theta_ptr);
573+
574+
if ((fabs(old_value - new_value) < objective_tol * fabs(new_value)) && (iter > 0)) {
575+
break;
576+
}
577+
old_value = new_value;
578+
}
559579
}
580+
560581
// Check size of active set
561582

562583
if (*nactive_ptr >= max_active) {
563584
break;
564585
}
565586

566-
// Check relative decrease of objective
567-
568-
if (objective_stop) {
569-
new_value = objective_wide(X_theta_ptr,
570-
linear_func_ptr,
571-
ever_active_ptr,
572-
nactive_ptr,
573-
ncase,
574-
nfeature,
575-
bound_ptr,
576-
ridge_term,
577-
theta_ptr);
578-
579-
if ((fabs(old_value - new_value) < objective_tol * fabs(new_value)) && (iter > 0)) {
580-
break;
581-
}
582-
old_value = new_value;
583-
}
584-
585587
}
586588
return(iter);
587589
}

0 commit comments

Comments
 (0)