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

Step Function

The step function is the original activation function โ€” the one Rosenblatt's Perceptron used in 1958. It's rarely used in modern networks, but understanding exactly why it was abandoned explains why every activation function since has been designed around one specific requirement: being differentiable.

Formula

\[ \phi(z) = \begin{cases}1 & z \ge 0\\0 & z < 0\end{cases} \]
PropertyValue
Range\(\{0, 1\}\) โ€” only two possible outputs
Derivative0 everywhere except at \(z=0\), where it's undefined (a discontinuous jump)
ShapeA flat line at 0, jumping instantly to a flat line at 1

Graph

A hard jump from 0 to 1 at z=0 โ€” flat everywhere else, meaning zero gradient almost everywhere.

The Fatal Flaw: Zero Gradient

Backpropagation (see the Backpropagation category) needs \(\frac{\partial \phi}{\partial z}\) at every point to propagate error signals backward through a network. The step function's derivative is 0 almost everywhere โ€” meaning gradient descent gets no information about which direction to adjust weights, since a tiny nudge to \(z\) almost never changes the output at all. This single property makes the step function unusable for training multi-layer networks with gradient-based methods, even though it works fine for the historical single-layer Perceptron (whose learning rule, from Perceptron Learning Algorithm, doesn't rely on calculus-based gradients at all).

Code

import numpy as np

def step(z):
    return np.where(z >= 0, 1, 0)

z = np.array([-2, -0.1, 0, 0.1, 2])
print(step(z))   # [0 0 1 1 1]

Where It's Used Today

Almost nowhere in modern deep learning โ€” its role is now purely historical and educational, marking the starting point that every subsequent activation function (starting with sigmoid, next) improved on by becoming smooth and differentiable.

Common Mistakes

  • Assuming the step function is simply "an older, simpler ReLU" โ€” the two behave completely differently for gradient-based training; ReLU has a well-defined, useful gradient for positive inputs, while the step function's gradient is uselessly zero almost everywhere.

Interview Relevance

Q: "Why can't the step function be used as an activation function in a modern, gradient-trained neural network?" Its derivative is zero everywhere except at a single discontinuous point, so backpropagation receives no usable gradient signal โ€” weight updates would essentially never happen. This is exactly why every practical activation function since has been designed to be smooth (or at least piecewise-differentiable with non-zero gradient somewhere useful).

Practice Question

Why did the original Perceptron Learning Algorithm not need the step function to be differentiable, while a modern multi-layer network trained with backpropagation does?

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

Step Function โ€“ FAQs

Quick answers about learning Step Function in Deep Learning.

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