Neural Network
This is brain-inspired AI model which uses interconnected nodes
neurons in layers to finds patterns in input data,
then learn from examples to make predictions
It contains an input layer, one or more hidden layers, and an output
layer.
Neuron / y=wx+b
A neuron is the basic unit within a layer. It takes input, performs a
computation, and produces an output. Each neuron has
weight, bias, activation function
A neuron is a single computational unit (node) within a layer, taking
inputs, multiplying by weights, adding a bias, and applying an
activation function
|
input(x) is multipled with weight(w) and added to bais(b)
|
class Neuron:
def __init__(self, num_inputs):
self.weights = initialize_weights(num_inputs)
self.bias = initialize_bias()
self.activation_function = relu
def forward(self, input_data):
# Compute the weighted sum of inputs
weighted_sum = sum(weight * input_value for weight, input_value in zip(self.weights, input_data)) + self.bias
# Apply the activation function
output = self.activation_function(weighted_sum)
return output