Skip to content

Commit

Permalink
added option for number of projection iterations
Browse files Browse the repository at this point in the history
  • Loading branch information
Eric Weine committed Aug 4, 2024
1 parent 681e5c1 commit c6f9b4f
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 5 deletions.
15 changes: 11 additions & 4 deletions R/fit.R
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,12 @@
#' remaining columns of \code{Y} onto the solution. Setting this to a smaller
#' value will increase speed but decrease accuracy.
#' }
#'
#' \item{\code{num_projection_ccd_iter}}{Number of co-ordinate descent updates
#' be made to elements of \code{V} if and when a subset of \code{Y} is
#' projected onto \code{U}. Only used if \code{training_frac} is less than
#' \code{1}.
#' }
#'
#' \item{\code{num_ccd_iter}}{Number of co-ordinate descent updates to
#' be made to parameters at each iteration of the algorithm.}
Expand Down Expand Up @@ -269,10 +275,10 @@ fit_glmpca_pois <- function(
FF = FF_test,
M = as.matrix(res$fit$LL[update_indices_f,,drop = FALSE] %*% Y_test),
update_indices = update_indices_f - 1,
num_iter = 1000,
line_search = TRUE,
alpha = .01,
beta = .25
num_iter = control$num_projection_ccd_iter,
line_search = control$line_search,
alpha = control$ls_alpha,
beta = control$ls_beta
)

# now, I need to reconstruct FF, and hopefully compute the log-likelihood
Expand Down Expand Up @@ -434,6 +440,7 @@ fit_glmpca_pois_control_default <- function()
maxiter = 100,
tol = 1e-4,
training_frac = 1,
num_projection_ccd_iter = 10,
mon.tol = 0.05,
convtype = "objfn",
line_search = TRUE,
Expand Down
9 changes: 8 additions & 1 deletion inst/scratch/test_projection_method.R
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,14 @@ set.seed(1)
fit2 <- fit_glmpca_pois(
Y = pbmc_facs$counts,
K = 2,
control = list(training_frac = 0.99, maxiter = 5)
control = list(training_frac = 0.25, maxiter = 10, num_projection_ccd_iter = 25)
)

set.seed(1)
fit3 <- fit_glmpca_pois(
Y = pbmc_facs$counts,
K = 2,
control = list(training_frac = 0.25, maxiter = 10, num_projection_ccd_iter = 5)
)
#
# df1 <- data.frame(
Expand Down
6 changes: 6 additions & 0 deletions man/fit_glmpca_pois.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit c6f9b4f

Please sign in to comment.