Skip to content

    Neural Networks

    AI · Intermediate

    Definition

    A neural network is layers of connected neurons that multiply inputs by weights, add a bias and apply an activation.

    Neural networks power image recognition, speech and language models.

    Diagram

    Input (x1, x2)Hidden (h1, h2, h3)Output (ŷ)

    Flowchart

    Input layerWeighted sum + biasActivation (ReLU)Hidden layersOutput layerBackpropagate error

    Example: One neuron

    x = [1.0, 2.0]; w = [0.5, -0.25]; b = 0.1
    z = sum(a*b_ for a, b_ in zip(x, w)) + b
    print(max(0, z))

    Output: 0.1

    Key points

    • Activations add non-linearity
    • Backpropagation computes gradients
    • Deep = many hidden layers

    Interview questions

    Why do we need activation functions?

    Without them, stacked layers collapse into one linear function.

    More AI topics