project_to_partially_orthonormal_nonnegative.Rd
Iteratively projects a non-negative matrix towards the intersection of non-negative matrices and matrices with orthonormal columns. Allows control over the degree of orthonormality enforced.
project_to_partially_orthonormal_nonnegative(
X,
max_iter = 100,
tol = 1e-06,
constraint = "positive",
ortho_strength = 1,
epsilon = 1e-04
)
A square or rectangular numeric matrix with non-negative entries.
Maximum number of iterations for the alternating projection.
Tolerance for convergence (Frobenius norm of change).
'positive' or 'either' (influences initial data preprocessing).
A value between 0 and 1, controlling the degree of orthonormality enforced. 0 means no orthonormality enforcement (only non-negativity), 1 means full orthonormality.
very small value for stability.
A matrix Y that is non-negative and has columns that are controlled in their orthonormality by ortho_strength.
# Example matrix (non-negative)
X_sample <- matrix(c(
1, 2, 0.1,
0.5, 1, 0.8,
0.2, 0.5, 1
), nrow=3, byrow=TRUE)
# Full orthonormality (ortho_strength = 1)
Y_full_ortho = project_to_partially_orthonormal_nonnegative(
X_sample, ortho_strength = 1, max_iter = 5)
# No orthonormality enforcement (ortho_strength = 0) -
# should just be pmax(X, 0)
Y_no_ortho <- project_to_partially_orthonormal_nonnegative(
X_sample, ortho_strength = 0, max_iter = 5) # Low iter for speed