Learn R Programming

learNN (version 0.1.0)

learn_gd: Learn Gradient Descent

Description

Learn Gradient Descent

Usage

learn_gd(X, y, alphas, hiddenSize)

Arguments

X
input data
y
output data
alphas
vector of alphas to use
hiddenSize
size of the hidden layer

References

http://qua.st/handcoding-gradient-descent/

Examples

Run this code
# input dataset
X = matrix(c(0,0,1,
             0,1,1,
             1,0,1,
             1,1,1), nrow=4, byrow=TRUE)

# output dataset
y = matrix(c(0,
             1,
             1,
             0), nrow=4)

# set parameters
alphas = c(0.1, 1, 10)
hiddenSize = 32
# also try using:
# alphas = c(0.001,0.01,0.1,1,10,100,1000)

# run gradient descent function
learn_gd(X, y, alphas, hiddenSize)

Run the code above in your browser using DataLab