neural_net: Simple neural net

Description Usage Arguments Value Author(s) Examples

View source: R/functions.R

Description

Compute a simple neural net

Usage

1
neural_net(y, X, init.val = rep(0, dim(X)[2] + 1))

Arguments

y

the binary response variable

Value

estimated weights

Author(s)

Rob Molinari

Examples

1
2
3
4
5
6
7
set.seed(1)
gender <- sample(c(0,1), size = 100, replace = TRUE) # x1 (input)
age <- round(runif(100, 18, 80)) # x2 (input)
xb <- 3.5*gender + 0.2*age - 9 # w1*x1 + w2*xw + b
p <- 1/(1 + exp(-xb))
y <- rbinom(n = 100, size = 1, prob = p) # output
neural_net(y, cbind(gender, age))

robertomolinari/simplenet documentation built on Dec. 22, 2021, 5:13 p.m.