Skip to content

Commit c6f9b4f

Browse files
author
Eric Weine
committed
added option for number of projection iterations
1 parent 681e5c1 commit c6f9b4f

File tree

3 files changed

+25
-5
lines changed

3 files changed

+25
-5
lines changed

R/fit.R

+11-4
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,12 @@
8080
#' remaining columns of \code{Y} onto the solution. Setting this to a smaller
8181
#' value will increase speed but decrease accuracy.
8282
#' }
83+
#'
84+
#' \item{\code{num_projection_ccd_iter}}{Number of co-ordinate descent updates
85+
#' be made to elements of \code{V} if and when a subset of \code{Y} is
86+
#' projected onto \code{U}. Only used if \code{training_frac} is less than
87+
#' \code{1}.
88+
#' }
8389
#'
8490
#' \item{\code{num_ccd_iter}}{Number of co-ordinate descent updates to
8591
#' be made to parameters at each iteration of the algorithm.}
@@ -269,10 +275,10 @@ fit_glmpca_pois <- function(
269275
FF = FF_test,
270276
M = as.matrix(res$fit$LL[update_indices_f,,drop = FALSE] %*% Y_test),
271277
update_indices = update_indices_f - 1,
272-
num_iter = 1000,
273-
line_search = TRUE,
274-
alpha = .01,
275-
beta = .25
278+
num_iter = control$num_projection_ccd_iter,
279+
line_search = control$line_search,
280+
alpha = control$ls_alpha,
281+
beta = control$ls_beta
276282
)
277283

278284
# now, I need to reconstruct FF, and hopefully compute the log-likelihood
@@ -434,6 +440,7 @@ fit_glmpca_pois_control_default <- function()
434440
maxiter = 100,
435441
tol = 1e-4,
436442
training_frac = 1,
443+
num_projection_ccd_iter = 10,
437444
mon.tol = 0.05,
438445
convtype = "objfn",
439446
line_search = TRUE,

inst/scratch/test_projection_method.R

+8-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,14 @@ set.seed(1)
1313
fit2 <- fit_glmpca_pois(
1414
Y = pbmc_facs$counts,
1515
K = 2,
16-
control = list(training_frac = 0.99, maxiter = 5)
16+
control = list(training_frac = 0.25, maxiter = 10, num_projection_ccd_iter = 25)
17+
)
18+
19+
set.seed(1)
20+
fit3 <- fit_glmpca_pois(
21+
Y = pbmc_facs$counts,
22+
K = 2,
23+
control = list(training_frac = 0.25, maxiter = 10, num_projection_ccd_iter = 5)
1724
)
1825
#
1926
# df1 <- data.frame(

man/fit_glmpca_pois.Rd

+6
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)