Hidden Layer Influence example with Simple Python
import numpy as np
def sigmoid(x):
return 1 / (1 + np.exp(-x))
# Input
X = np.array([1, 0])
# Hidden layer
W_hidden = np.array([[0.5, 0.4], [0.3, 0.7]])
b_hidden = np.array([-0.3, -0.1])
z_hidden = np.dot(X, W_hidden) + b_hidden
a_hidden = sigmoid(z_hidden)
# Output layer
W_output = np.array([0.6, 0.9])
b_output = -0.2
z_output = np.dot(a_hidden, W_output) + b_output
a_output = sigmoid(z_output)
print(f"Prediction (Happiness Probability): {a_output:.2f}")
Summary
| Layer | Role |
|---|---|
| Input | Takes raw data |
| Hidden | Learns non-obvious patterns (feature builders) |
| Output | Combines those patterns into a final prediction |
The hidden layer is where “understanding” happens.
