ADVERTISEMENT
Google AdSense Slot (headerLeaderboard)

Set your Publisher ID in src/config/ads.ts to display live ads.

Artificial Intelligence Tutorial• 7 min read

Artificial Neural Networks & Deep Learning

Input layers, hidden layers, weights, biases, and the Artificial Neuron

Neural networks are computational models inspired by biological brain structures, organized in layers of interconnected artificial neurons (perceptrons).

How a Single Artificial Neuron Calculates Output

A neuron takes a vector of inputs X = [x1, x2, ..., xn], multiplies each input by an adjustable weight W = [w1, w2, ..., wn], adds a scalar bias b, and passes the linear sum through a non-linear activation function σ.

The linear combination is z = Σ(xi * wi) + b = X · W + b.

Without non-linear activation functions, stacking 100 neural layers would still mathematically collapse into a single linear regression equation.

Simulating a Perceptron with NumPy Vectorization
import numpy as np

def sigmoid(z):
    return 1.0 / (1.0 + np.exp(-z))

# 3 input features, 1 bias
inputs = np.array([0.75, 0.42, 0.91])
weights = np.array([0.2, -0.5, 0.8])
bias = -0.15

# Forward pass calculation
linear_sum = np.dot(inputs, weights) + bias
output = sigmoid(linear_sum)

print(f"Linear z: {linear_sum:.4f}")
print(f"Neuron Activation (Probability): {output:.4f}")
NumPy computes dot products in optimized C, enabling millions of neuron calculations per second.
Pro Tip

The bias term shifts the activation function curve along the axis, allowing the neuron to activate even when all input values are zero.

ADVERTISEMENT
Google AdSense Slot (inContentBanner)

Set your Publisher ID in src/config/ads.ts to display live ads.

Test Yourself With Exercise

+15 XP

What is the primary mathematical reason deep neural networks require non-linear activation functions?