No history yet

Neuron Logic

The Neuron as a Logic Gate

At its core, an artificial neuron isn't a miniature brain cell. It's much simpler: a tiny decision-making machine. Think of it less like biology and more like a single, programmable logic gate. It takes in one or more numerical inputs, processes them, and produces a single numerical output. An entire neural network is just a massive web of these simple gates working in concert.

Lesson image

Each neuron is a self-contained unit that performs two key mathematical operations. First, it calculates a weighted sum of its inputs. Second, it passes that sum through an activation function to decide its final output. Let's break down what that really means.

Weights and Biases

Not all information is created equal. In a neural network, weights are the primary tool for assigning importance to incoming data. Each input connected to a neuron has its own weight. A larger weight means the network considers that input more significant, while a smaller weight means it's less influential. A weight of zero effectively ignores the input entirely.

After weighting the inputs, the neuron adds a bias value. The bias acts as a tunable threshold. It allows the neuron to decide how high the weighted sum needs to be before it starts to meaningfully "activate" and pass on a signal. Without a bias, the neuron's only baseline is zero, which limits its flexibility.

Together, the weights and bias form the neuron's internal 'levers'. During the training process, the network systematically adjusts these levers across thousands or millions of neurons until it gets the desired outcome. This process is how the network learns.

The first step inside the neuron is the linear combination of inputs, weights, and the bias. This is often called the weighted sum.

z=(w1x1+w2x2++wnxn)+bz = (w_1x_1 + w_2x_2 + \dots + w_nx_n) + b

The Activation Switch

The weighted sum is a linear calculation. If that's all a neuron did, a huge stack of them would just be one big, complicated linear equation. It could only learn simple, straight-line patterns. But the real world is messy and non-linear.

This is where the activation function comes in. It's the 'secret sauce' that introduces non-linearity. After calculating the weighted sum z, the neuron passes this value through an activation function to produce its final output, a. This function decides whether the neuron should fire and, if so, how strongly.

Common activation functions include:

  • ReLU (Rectified Linear Unit): This is one of the most popular functions. It's simple: if the input is negative, the output is 0. If the input is positive, the output is the input itself. It effectively switches the neuron 'off' for negative values.
  • Sigmoid: This function squashes any input value into a range between 0 and 1. It's useful for models that need to output a probability.
  • Tanh (Hyperbolic Tangent): Similar to sigmoid, but it squashes values into a range between -1 and 1.

By stacking layers of these neurons, each performing a linear transformation followed by a non-linear activation, neural networks can approximate incredibly complex functions. It's this combination of simple, tunable math and non-linear switching that gives them their power.

A neural network isn't a 'brain'. It's a massive, interconnected system of tunable mathematical levers.

Now that you understand how a single neuron works, let's see how they can be organized to learn.

Quiz Questions 1/5

What is the most accurate analogy for a single artificial neuron?

Quiz Questions 2/5

In an artificial neuron, what are the primary roles of weights and the bias?