% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/symNMF.R
\name{symNMF}
\alias{symNMF}
\title{Symmetric Non-negative Matrix Factorization (symNMF)}
\usage{
symNMF(
  Omega,
  K,
  model = c("MSM", "MM"),
  Beta = 2,
  initM = NULL,
  initS = NULL,
  lambda = 0,
  num.iter = 100L,
  thr = 1e-10,
  verbose = FALSE
)
}
\arguments{
\item{Omega}{Symmetric non-negative matrix (N x N)}

\item{K}{Number of components (rank)}

\item{model}{Character, either \code{"MSM"} (default) or \code{"MM"}}

\item{Beta}{Beta parameter for Beta-divergence (default: 2).
2 = Frobenius, 1 = KL, 0 = IS.}

\item{initM}{Initial M matrix (N x K). If NULL, random non-negative initialization.}

\item{initS}{Initial S matrix (K x K). If NULL, random non-negative initialization.
Ignored when \code{model = "MM"}.}

\item{lambda}{Regularization parameter for \eqn{|\det(S)|} penalty (default: 0).
Only used with \code{model = "MSM"}.}

\item{num.iter}{Maximum number of iterations (default: 100)}

\item{thr}{Convergence threshold on relative change (default: 1e-10)}

\item{verbose}{Logical, print iteration info (default: FALSE)}
}
\value{
A list with components:
  \describe{
    \item{M}{Factor matrix (N x K)}
    \item{S}{Coefficient matrix (K x K). Identity matrix when \code{model = "MM"}.}
    \item{RecError}{Vector of reconstruction errors at each iteration}
    \item{RelChange}{Vector of relative changes at each iteration}
    \item{converged}{Logical}
    \item{iter}{Number of iterations performed}
  }
}
\description{
Decomposes a symmetric non-negative matrix \eqn{\Omega \approx M S M^\top}
using multiplicative update (MU) rules with Beta-divergence.
}
\details{
Two models are supported:
\itemize{
  \item \strong{MSM}: \eqn{\Omega \approx M S M^\top} where M is N x K and S is K x K
  \item \strong{MM}: \eqn{\Omega \approx M M^\top} where M is N x K (special case with S = I)
}

The loss function is the Beta-divergence \eqn{D_\beta(\Omega \| \hat{\Omega})}:
\itemize{
  \item \eqn{\beta = 2}: Frobenius (Euclidean) distance
  \item \eqn{\beta = 1}: Kullback-Leibler divergence
  \item \eqn{\beta = 0}: Itakura-Saito divergence
  \item Other values of \eqn{\beta} interpolate/extrapolate these cases
}
}
\examples{
set.seed(42)
M_true <- matrix(c(rep(c(1,0), 5), rep(c(0,1), 5)), 10, 2)
Omega <- M_true \%*\% t(M_true) + matrix(runif(100, 0, 0.1), 10, 10)
Omega <- (Omega + t(Omega)) / 2

# Frobenius (Beta=2, default)
res_fro <- symNMF(Omega, K = 2, Beta = 2)

# KL divergence (Beta=1)
res_kl <- symNMF(Omega, K = 2, Beta = 1)

# Itakura-Saito (Beta=0)
res_is <- symNMF(Omega, K = 2, Beta = 0)
}
\references{
Kuang, D., Park, H., & Ding, C. H. Q. (2012).
Symmetric Nonnegative Matrix Factorization for Graph Clustering.
SDM 2012.

Fevotte, C. & Idier, J. (2011).
Algorithms for Nonnegative Matrix Factorization with the
Beta-Divergence. Neural Computation, 23(9).
}
