📘 Lesson  ·  Lesson 90

Activation Functions

Activation Functions

What is an Activation Function?

💡 At a Glance

An activation function decides whether a neuron "fires". It adds non-linearity so neural networks can learn complex patterns.

Common Functions

FunctionOutput RangeUse
Sigmoid0 to 1binary output / probabilities
Tanh-1 to 1hidden layers (zero-centered)
ReLU0 to infinitymost common in deep networks

In Code

Python
import numpy as np
def relu(x): return np.maximum(0, x)
def sigmoid(x): return 1 / (1 + np.exp(-x))

print(relu(-3), relu(5))      # 0 5
print(round(sigmoid(0), 2))   # 0.5
0 5 0.5

Summary

  • Activation functions add non-linearity to neural networks.
  • ReLU is most common; Sigmoid for probabilities; Tanh is zero-centered.

Activation Function क्या है?

💡 एक नज़र में

Activation function तय करती है कि neuron "fire" करे या नहीं। यह non-linearity जोड़ती है ताकि neural networks जटिल patterns सीख सकें।

Common Functions

FunctionOutput RangeUse
Sigmoid0 से 1binary output / probabilities
Tanh-1 से 1hidden layers (zero-centered)
ReLU0 से अनंतdeep networks में सबसे common

Code में

Python
import numpy as np
def relu(x): return np.maximum(0, x)
def sigmoid(x): return 1 / (1 + np.exp(-x))

print(relu(-3), relu(5))      # 0 5
print(round(sigmoid(0), 2))   # 0.5
0 5 0.5

सारांश

  • Activation functions neural networks में non-linearity जोड़ती हैं।
  • ReLU सबसे common; Sigmoid probabilities के लिए; Tanh zero-centered।
← Back to Python Tutorial
🔗

Share this topic with a friend

यह topic किसी दोस्त को भेजें

Found it useful? Send it to a classmate learning the same thing.

अच्छा लगा? जो दोस्त यही सीख रहा है, उसे भेज दीजिए।

\n