Skip to contents

Hastie, Tibshirani and Friedman (2009), The Elements of Statistical Learning, 2nd ed., Springer, Section 2.8.3, book p. 36 (PDF p. 55): f_theta(x) = sum_m beta_m sigma(alpha_m' x + b_m) (2.45), where sigma(x) = 1/(1 + e^-x) is the activation function.

Usage

Nnet1lay(X, alpha, b, beta = NULL, y = NULL)

Arguments

X

N-by-p design.

alpha

p-by-M matrix whose columns are the directions alpha_m.

b

M-vector of bias terms.

beta

optional M-vector of output weights.

y

optional N-vector; refits beta by least squares.

Value

list: estimate, fitted, hidden, beta, rss, n, p, M, method.

Details

With alpha and b fixed this is a linear basis expansion, so given y the output weights beta follow in closed form by least squares on the hidden activations; alpha and b are inputs rather than being invented.

Examples

Nnet1lay(cbind(c(0, 0)), cbind(c(1)), 0, beta = 2)$fitted
#> [1] 1 1