Skip to contents

Per-row (axis = 1) or per-column (axis = 0) w *= min(1, r/||w||); a constraint applied after the step, not a penalty. rows_projected is 0-based.

Usage

morie_geron_max_norm_regularization(W, r, axis = 1)

Arguments

W

(out, in) weights.

r

Positive radius.

axis

1 for rows (default), 0 for columns.

Value

List with W_new, norms_before, norms_after, n_projected, rows_projected.

Examples

morie_geron_max_norm_regularization(W = c(1, 2, 3, 4, 5, 6, 7, 8), r = 5L)
#> $W_new
#>         [,1]    [,2]    [,3]    [,4]    [,5]    [,6]    [,7]    [,8]
#> [1,] 0.35007 0.70014 1.05021 1.40028 1.75035 2.10042 2.45049 2.80056
#> 
#> $norms_before
#> [1] 14.28286
#> 
#> $norms_after
#> [1] 5
#> 
#> $n_projected
#> [1] 1
#> 
#> $rows_projected
#> [1] 0
#> 
#> $r
#> [1] 5
#> 
#> $estimate
#>         [,1]    [,2]    [,3]    [,4]    [,5]    [,6]    [,7]    [,8]
#> [1,] 0.35007 0.70014 1.05021 1.40028 1.75035 2.10042 2.45049 2.80056
#> 
#> $n
#> [1] 1
#>