Ravindra BagaleCourses & study guides English Track your progress

42. Activation Functions, Loss, and Gradient Descent (Plain English)

Data Science

42.1 Activation Functions Simply

42.1 Activation functions — simple

Activation नसेल तर layers एक मोठी linear formula होतात. Bends हवेत.

हे का शिकायचं?

Why. Activation नसेल तर stacked layers एक मोठी linear formula बनतात. Activations bends देतात — nets curves शिकू शकतात.

हे काय आहे?

What. शुरुवातीला common: hidden layers साठी ReLU (max(0, z)); शेवटी probabilities साठी sigmoid किंवा softmax.

कसं करायचं?

How.

तीन activations कागदावर try करा

  1. ReLU: negatives → 0; positives जसे आहेत तसे.
  2. Sigmoid: कोणताही number (0, 1) मध्ये squash.
  3. Softmax (multi-class नंतर): vector → probabilities, sum = 1.
import math

def relu(z): return max(0.0, z)
def sigmoid(z): return 1 / (1 + math.exp(-z))

for z in (-2, 0, 2):
 print(z, "ReLU", relu(z), "sigmoid", round(sigmoid(z), 3))

Ravindra Bagale's Tip

Use ReLU as your default choice for hidden layers. For the output layer, choose the activation by the problem type: is the answer a plain number, or a probability (where sigmoid is common)?