📘 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
| Function | Output Range | Use |
|---|---|---|
| Sigmoid | 0 to 1 | binary output / probabilities |
| Tanh | -1 to 1 | hidden layers (zero-centered) |
| ReLU | 0 to infinity | most 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
| Function | Output Range | Use |
|---|---|---|
| Sigmoid | 0 से 1 | binary output / probabilities |
| Tanh | -1 से 1 | hidden layers (zero-centered) |
| ReLU | 0 से अनंत | 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।