Skip to contents

Regression MLP output head (Geron Ch 10, morie.fn grmlr)

Usage

morie_geron_regression_mlp_output(
  a_last,
  W_out,
  b_out,
  activation = "identity"
)

Arguments

a_last

Last hidden activation.

W_out, b_out

Output weights and bias.

activation

"identity", "softplus", "relu" or "sigmoid".

Value

List with prediction, preactivation, out_features.

Examples

morie_geron_regression_mlp_output(matrix(c(1, 2, -1, 0.5), 2,
    byrow = TRUE), matrix(c(1, -1, 0.5, 2), 2, byrow = TRUE),
    c(0.1, 0.2), activation = "softplus")
#> $prediction
#>           [,1]     [,2]
#> [1,] 0.3411539 4.709054
#> [2,] 0.2204174 1.103186
#> 
#> $preactivation
#>      [,1] [,2]
#> [1,] -0.9  4.7
#> [2,] -1.4  0.7
#> 
#> $activation
#> [1] "softplus"
#> 
#> $out_features
#> [1] 2
#> 
#> $estimate
#>           [,1]     [,2]
#> [1,] 0.3411539 4.709054
#> [2,] 0.2204174 1.103186
#> 
#> $n
#> [1] 2
#>