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

Perceptron

The Perceptron, introduced by Frank Rosenblatt in 1958, added the one thing the McCulloch-Pitts neuron lacked: a way to learn its weights and threshold automatically from labeled examples. It's the first trainable artificial neuron, and the direct ancestor of every neural network layer in this hub.

The Model

\[ z = \sum_{i=1}^n w_ix_i + b, \qquad y = \begin{cases}1 & z \ge 0 \\ 0 & z < 0\end{cases} \]

Structurally, this is exactly the artificial neuron from earlier in this category, using a specific activation function called the step function (formally covered in the Activation Functions category). What makes it a Perceptron rather than just a McCulloch-Pitts neuron is that \(\mathbf{w}\) and \(b\) are no longer fixed by hand โ€” they're learned via the Perceptron Learning Algorithm, covered in the next note.

Geometric Interpretation โ€” A Linear Decision Boundary

The equation \(\mathbf{w}^\top\mathbf{x}+b = 0\) defines a straight line (in 2-D) or a hyperplane (in higher dimensions) that splits the input space into two regions โ€” one predicted class 1, the other class 0. A Perceptron can only correctly classify data where a single straight line can separate the two classes โ€” data that is linearly separable.

decision boundary: w·x + b = 0

A single straight line perfectly separates these two classes โ€” this is exactly the kind of problem a Perceptron can solve.

Numerical Example

With learned weights \(\mathbf{w}=[1,1]\), \(b=-1.5\): for input \([1,1]\), \(z = 1+1-1.5=0.5 \ge 0 \Rightarrow y=1\). For input \([0,0]\), \(z=0+0-1.5=-1.5<0 \Rightarrow y=0\). This particular weight/bias combination happens to implement logical AND โ€” the same function the earlier McCulloch-Pitts example needed hand-tuning for, but here in principle learnable from labeled examples.

Code

import numpy as np

def perceptron(x, w, b):
    z = np.dot(w, x) + b
    return 1 if z >= 0 else 0

w = np.array([1, 1])
b = -1.5
for x in [[0,0],[0,1],[1,0],[1,1]]:
    print(x, "->", perceptron(np.array(x), w, b))
# implements logical AND

Common Mistakes

  • Assuming a Perceptron can learn any pattern given enough training โ€” it fundamentally cannot represent non-linearly-separable functions (like XOR), regardless of how it's trained; see Limitations of Perceptron for the full explanation.
  • Confusing the historical single-layer Perceptron with the modern "Perceptron" naming sometimes loosely applied to any single neuron with any activation function โ€” the original, strict definition uses the step function specifically.

Interview Relevance

Q: "What kind of problems can a single Perceptron solve?" Only binary classification problems where the two classes are linearly separable โ€” where a single straight line (or hyperplane, in higher dimensions) can perfectly divide them. It cannot solve problems requiring a non-linear decision boundary, like XOR.

Practice Question

Using \(\mathbf{w}=[1,1]\) and \(b=-0.5\), verify by hand which of the 4 binary input pairs this Perceptron classifies as 1. What logical function does it implement?

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

Perceptron โ€“ FAQs

Quick answers about learning Perceptron in Deep Learning.

This free note from CodingNow 2.0 explains Perceptron 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 Perceptron, is 100% free with no signup required.
With focused practice, most students grasp Perceptron 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