Skip to contents

Use W() and H() inside nmf_layer() or svd_layer() to set factor-specific regularization, constraints, and targets. Parameters not set inherit from the layer defaults.

Usage

W(
  L1 = NULL,
  L2 = NULL,
  L21 = NULL,
  angular = NULL,
  upper_bound = NULL,
  nonneg = NULL,
  graph = NULL,
  graph_lambda = NULL,
  target = NULL,
  target_lambda = NULL
)

H(
  L1 = NULL,
  L2 = NULL,
  L21 = NULL,
  angular = NULL,
  upper_bound = NULL,
  nonneg = NULL,
  graph = NULL,
  graph_lambda = NULL,
  target = NULL,
  target_lambda = NULL
)

Arguments

L1

L1 (lasso) penalty. Default 0.

L2

L2 (ridge) penalty. Default 0.

L21

Group sparsity penalty. Default 0.

angular

Orthogonality penalty. Default 0.

upper_bound

Box constraint upper bound (0 = none). Default 0.

nonneg

Non-negativity constraint. Default TRUE for NMF, FALSE for SVD.

graph

Sparse graph Laplacian matrix (or NULL).

graph_lambda

Graph regularization strength. Default 0.

target

Target matrix for regularization (k x n for H, k x m for W). See compute_target for constructing targets from labels.

target_lambda

Target regularization strength. Default 0.

Value

An fn_factor_config object.

Examples

# Per-factor config for W with L1 sparsity
w_cfg <- W(L1 = 0.1, nonneg = TRUE)
h_cfg <- H(L2 = 0.01)