% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/gedi_class.R
\name{CreateGEDIObject}
\alias{CreateGEDIObject}
\title{Create GEDI Object}
\usage{
CreateGEDIObject(
  Samples,
  M = NULL,
  Y = NULL,
  X = NULL,
  colData = NULL,
  C = NULL,
  H = NULL,
  K = 40,
  mode = "Bsphere",
  adjustD = TRUE,
  orthoZ = TRUE,
  Z_shrinkage = 1,
  A_shrinkage = 1,
  Qi_shrinkage = 1,
  Rk_shrinkage = 1,
  oi_shrinkage = 1,
  o_shrinkage = 1,
  si_shrinkage = 1,
  fixed_si = NA,
  rsvd_p = 10,
  rsvd_sdist = "normal",
  verbose = 1,
  num_threads = 1
)
}
\arguments{
\item{Samples}{Factor or character vector indicating sample of origin for each cell}

\item{M}{Raw count matrix (sparse or dense), or list of two matrices for paired data.
C++ will compute Yi = log(M+1) internally - no Yi copy stored in R!}

\item{Y}{Log-transformed expression matrix (optional if M provided)}

\item{X}{Binary indicator matrix (optional if M or Y provided)}

\item{colData}{Optional data.frame with cell metadata}

\item{C}{Gene-level prior matrix (genes x pathways)}

\item{H}{Sample-level covariate matrix (covariates x samples)}

\item{K}{Number of latent factors (default: 10)}

\item{mode}{Normalization mode: "Bl2" or "Bsphere" (default: "Bl2")}

\item{adjustD}{Whether to adjust D based on B row norms (default: TRUE)}

\item{orthoZ}{Whether Z columns should be orthogonal (default: TRUE)}

\item{Z_shrinkage, A_shrinkage, Qi_shrinkage, Rk_shrinkage, oi_shrinkage, o_shrinkage, si_shrinkage}{Regularization strengths (default: 1)}

\item{fixed_si}{Fix cell library sizes at this value, or NA to optimize (default: NA)}

\item{rsvd_p}{Oversampling parameter for randomized SVD (default: 10)}

\item{rsvd_sdist}{Random distribution for rSVD: "normal", "unif", or "rademacher"
(default: "normal")}

\item{verbose}{Verbosity level: 0 (silent), 1 (info), 2 (debug) (default: 1)}

\item{num_threads}{Number of OpenMP threads (default: 0 = auto)}
}
\value{
GEDI R6 object with memory-efficient architecture
}
\description{
Creates and configures a GEDI (Gene Expression Data Integration) model object.
This implementation uses Option 2 memory optimization: C++ computes Yi from M,
eliminating duplicate Yi storage in R.
}
\examples{
\donttest{
# Load example data
pbmc_small <- SeuratObject::pbmc_small

# Basic usage - memory efficient!
model <- CreateGEDIObject(
  Samples = pbmc_small@meta.data$orig.ident,
  M = pbmc_small@assays$RNA@counts, # Only M stored in R; Yi computed in C++
  K = 10,
  num_threads = 1
)

# Train the model
model$train(iterations = 50)

# Access results via active bindings
Z <- model$Z
params <- model$params

# Access projections (computed on demand, cached)
zdb <- model$projections$ZDB
db <- model$projections$DB

# Access imputed expression
Y_imputed <- model$imputed$Y() # No M needed!
Y_var <- model$imputed$variance(pbmc_small@assays$RNA@counts) # M required
}

}
