๐Ÿ”ฅLimited Offer: Get 50% OFFon AI & Full Stack Courses๐Ÿ”ฅ
Back to Deep Learning Notes
Topic #50

Artificial Neuron

The artificial neuron is the mathematical unit every neural network is built from โ€” a small function that takes several numeric inputs, combines them, and produces one output. This note defines it precisely, using the linear algebra and calculus notation from the previous two categories.

The Computation, Step by Step

\[ z = \sum_{i=1}^{n} w_i x_i + b = \mathbf{w}^\top\mathbf{x} + b, \qquad y = \phi(z) \]
SymbolMeaningShape/Type
\(\mathbf{x}\)Input vector โ€” the features fed to this neuron\((n,)\)
\(\mathbf{w}\)Weight vector โ€” learned importance of each input\((n,)\)
\(b\)Bias โ€” a learned offset, shifts the decision independent of the inputsscalar
\(z\)The weighted sum ("pre-activation")scalar
\(\phi\)Activation function โ€” introduces non-linearity (see the Activation Functions category next)function
\(y\)The neuron's final outputscalar

Numerical Example

\[ \mathbf{x} = [2, 3], \quad \mathbf{w} = [0.5, -1], \quad b = 1 \] \[ z = (0.5)(2) + (-1)(3) + 1 = 1 - 3 + 1 = -1 \] \[ y = \phi(-1) \quad \text{e.g. if } \phi = \text{sigmoid}: \ y = \frac{1}{1+e^{1}} \approx 0.269 \]

Diagram โ€” One Neuron

x1 x2 x3 Σwx+b then φ() w1 w2 w3 y

Each input is multiplied by its own weight, summed with a bias, and passed through an activation function to produce the neuron's output.

Code

import numpy as np

def neuron(x, w, b, activation):
    z = np.dot(w, x) + b
    return activation(z)

sigmoid = lambda z: 1 / (1 + np.exp(-z))

x = np.array([2, 3])
w = np.array([0.5, -1])
b = 1
print(neuron(x, w, b, sigmoid))   # approximately 0.269
import torch
import torch.nn as nn

neuron = nn.Linear(in_features=2, out_features=1)   # computes w^T x + b automatically
x = torch.tensor([[2.0, 3.0]])
z = neuron(x)
y = torch.sigmoid(z)
print(y)

Common Mistakes

  • Forgetting the bias term โ€” without \(b\), the neuron's decision boundary is forced through the origin, a real limitation on what it can represent (this becomes concrete in Limitations of Perceptron).
  • Skipping the activation function \(\phi\) โ€” without it, a neuron (and any network built from stacking such neurons) reduces to a plain linear transformation, as shown in Linear Transformations.

Interview Relevance

Q: "Write out the computation a single artificial neuron performs, and name each term." \(y = \phi(\mathbf{w}^\top\mathbf{x}+b)\) โ€” a weighted sum of the inputs \(\mathbf{x}\) using learned weights \(\mathbf{w}\), shifted by a learned bias \(b\), then passed through a non-linear activation function \(\phi\) to produce the output \(y\).

Practice Question

For \(\mathbf{x}=[1,-2,3]\), \(\mathbf{w}=[0.2,0.4,-0.1]\), \(b=0.5\), compute the pre-activation \(z\) by hand.

Want to go beyond the notes?

Join CodingNow 2.0's Deep Learning course โ€” live mentorship, real projects, and 100% placement support.

Enroll Now โ€” Free Demo Available

Artificial Neuron โ€“ FAQs

Quick answers about learning Artificial Neuron in Deep Learning.

This free note from CodingNow 2.0 explains Artificial Neuron in Deep Learning โ€” concept, syntax and worked code examples you can copy, run and revise before interviews.
Yes. Every Deep Learning topic on CodingNow 2.0, including Artificial Neuron, is 100% free with no signup required.
With focused practice, most students grasp Artificial Neuron in 1โ€“3 days from these notes; pairing it with CodingNow 2.0's mentor-led course takes you to job-ready depth faster.
Use the code examples in this note, then ask doubts for free on the CodingNow 2.0 Community (/community) โ€” expert instructors answer within 24 hours.
WhatsApp
Call NowEnroll Now