Skip to content

Instantly share code, notes, and snippets.

@gowrishankarin
Created January 30, 2017 05:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gowrishankarin/d9df1acf40fcb1acbbcf215f9f762897 to your computer and use it in GitHub Desktop.
Save gowrishankarin/d9df1acf40fcb1acbbcf215f9f762897 to your computer and use it in GitHub Desktop.
Multi Layer Perceptron
library((neuralnet)
library(NeuralNetTools)
CAPITAL_LETTER <- c(rep(0, 7), 1)
SMALL_LETTER <- c(0, rep(1, 7))
binaryData <- data.frame(
expand.grid(c(0, 1), c(0, 1), c(0, 1)), CAPITAL_LETTER, SMALL_LETTER
)
colnames(binaryData) <- c("X_Points", "Y_Points", "Velocity", "CAPITAL_LETTER", "SMALL_LETTER")
mod <- neuralnet(
CAPITAL_LETTER + SMALL_LETTER ~ X_Points + Y_Points + Velocity,
data=binaryData,
hidden=c(3, 6, 4),
rep= 10,
err.fct='ce',
linear.output=FALSE
)
par(mar = numeric(4), family = 'serif')
plot(mod, alpha = 0.6)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment