ebpmf_identity: Smoothed Poisson Topic Model

View source: R/ebpmf_identity.R

ebpmf_identityR Documentation

Smoothed Poisson Topic Model

Description

This function fits Poisson Topic Model with smooth Loading or Factors

Usage

ebpmf_identity(
  X,
  K,
  lib_size = NULL,
  init = "fasttopics",
  maxiter = 50,
  maxiter_init = 100,
  tol = 0.001,
  ebpm.fn = c(ebpm::ebpm_point_gamma, smashrgen::ebps),
  fix_F = FALSE,
  smooth_F = TRUE,
  smooth_control = list(),
  printevery = 10,
  verbose = TRUE,
  adj_LF_scale = TRUE,
  convergence_criteria = "mKLabs"
)

Arguments

X

count matrix

K

number of factors/ranks

init

initialization methods, default is 'fasttopics'; or provide init as a list with L_init, and F_init.

maxiter, maxiter_init

maximum iterations

tol

stop criteria

ebpm.fn

specify functions to use for solving the poisson subproblems

fix_F

if TRUE, F will not be updated and will be fixed at the input value in init.

smooth_F

whether smooth l or f, must match the functions in ebpm.fn

smooth_control

a list. ebpmf_identity_smooth_control_default() gives default settings.

adj_LF_scale

adjust scale of LF after each iteration for numerical stability

convergence_criteria

'mKLabs', or 'ELBO'

Value

EL,EF: posterior of loadings and factors

Examples

set.seed(123)
n = 120
p = 256
K= 3
L = matrix(0, nrow=n, ncol=K)
FF = matrix(0, nrow=K, ncol=p)
L[1:(n/3),1] = 1
L[((n/3)+1):(2*n/3),2] = 1
L[((2*n/3)+1):n,3] = 1
L = L + matrix(runif(n*K,0,0.5),nrow=n)
FF[1,1:(p/3)] = 1+10
FF[2,((p/3)+1):(2*p/3)] = 1+10
FF[3,((2*p/3)+1):p] = 1+10
lambda = L %*% FF
X = matrix(rpois(n=length(lambda),lambda),nrow=n)
image(X)

DongyueXie/stm documentation built on June 18, 2024, 11:01 a.m.