this class is responsible for creating cell of individual neuron.
example usage
this example demonstrates three ways to instantiate the class.
example1 is just creating a neuron.
example2 is already creating a neuron passing the weights as arguments.
while example3 is creating a neuron with the same weights but correcting the bias.
example usage
this example creates a neuron with weights already defined and displays the value of the weights property.
example usage
this example creates a neuron with weights and bias to display the bias value on the console.
example usage
this example creates a neuron that displays the result of the calculate method as output.
example usage
this example clearly shows how the calculation method takes as an argument an array of inputs and the ReLU activation function.
return
this method returns a numeric array as output calculated by the neuron.
example usage
this example creates a neuron and passes the numerical array weights of the neuron as an argument.
example usage
this example creates a neuron and passes argument 3 as a bias for the neuron.
Detailed information
see detailed examples of each of the references.
# Neuron : Class
const example1 = new Neuron()
const weights = [100, 1, 5]
const example2 = new Neuron(weights)
const bias = 3
const example3 = new Neuron(weights, bias)
example usage
this example demonstrates three ways to instantiate the class.
example1 is just creating a neuron.
example2 is already creating a neuron passing the weights as arguments.
while example3 is creating a neuron with the same weights but correcting the bias.
description
Neuron is a class used for creating individual cells to build a neural network model.
constructor
weights : Array [Number]
bias : Number
# weights : Property
const example = new Neuron([100, 1, 5])
console.log(example.weights)
example usage
this example creates a neuron with weights already defined and displays the value of the weights property.
description
weights is a property that contains all neuron weights grouped in a numerical array.
return
weights : Array [Number]
# bias : Property
const example = new Neuron([100, 1, 5], 3)
console.log(example.bias)
example usage
this example creates a neuron with weights and bias to display the bias value on the console.
description
bias is a property that returns a numerical value used in the neuron.
return
bias : Number
# output : Property
const example = new Neuron()
// calculate...
console.log(example.output)
example usage
this example creates a neuron that displays the result of the calculate method as output.
description
output is a numerical value property that returns the result of the calculation made through the neuron.
return
output : Number
# calculate : Method
const example = new Neuron()
const inputs = [200, 15, 8]
const output = example.calculate(inputs, ReLU)
console.log(output)
example usage
this example clearly shows how the calculation method takes as an argument an array of inputs and the ReLU activation function.
return
this method returns a numeric array as output calculated by the neuron.
description
calculate is a method used to calculate an array of inputs according to the neuron configuration and return an output using an activation function.
parameters
inputs : Array
callback : Function
# setWeights : Method
const example = new Neuron()
const weights = [100, 1, 5]
example.setWeights(weights)
example usage
this example creates a neuron and passes the numerical array weights of the neuron as an argument.
description
setWeights is a method used inserting a numerical array as arguments to define the weights of the neurons.
parameters
weights : Array [Number]
# setBias : Method
const example = new Neuron()
example.setBias(3)
example usage
this example creates a neuron and passes argument 3 as a bias for the neuron.
description
setBias is a method that receives a numeric value to reset the neuron's bias.
parameters
bias : Number