Perceptron-class {deep} | R Documentation |
The Perceptron neuron class, that implements the logic of the perceptron model.
Description
The Perceptron neuron class, that implements the logic of the perceptron model.
Arguments
inputs |
The actual data to be fed to the neuron, this input's dimentions vary with the chosen weights dimentions. |
ins |
The list of vectors of inputs to the first layer in the network |
outs |
The list of vectors of outputs of the last layer in the network |
epochs |
How many rounds of training to run |
tax |
This is the learning rate, aka eta |
maxErr |
A contition to early stop the training process |
Value
The computed value using the Perceptron model.
Vector of computed values of the same size of the last layer
Fields
ws
The matrix of weights that multiply the input vector, it can be a vector, a matrix or an array.
bias
The bias value.
Examples
# Create a dataset
dataset <- iris
dataset$Petal.Length <- NULL
dataset$Petal.Width <- NULL
dataset <- dataset[dataset$Species != "versicolor",]
dataset$Code <- as.integer(dataset$Species == "virginica")
dataset <- dataset[sample(20),]
# Create the neuron
neuron <- perceptron(c(1,1), 1)
# Train the neuron, takes a while
neuron$train(dataset[,c(1,2), drop=FALSE], dataset[,'Code', drop=FALSE], epochs = 10)
# Check the output
neuron$output(c(1,2))
# See accuracy
dataset$Calc <- sapply(1:nrow(dataset), function(x) neuron$output(dataset[x,c(1,2)]))
length(which(dataset$Code==dataset$Calc))/nrow(dataset)
[Package deep version 0.1.0 Index]