Neural Networks Basics — ML Technical Interview Questions & Answers

Layers of weighted connections inspired by neurons.

Neural Networks Basics

  • Simple meaning: A neural net is stacked layers. Each neuron: weighted sum of inputs, then a bend (ReLU, sigmoid). Many layers → can learn wiggly maps (images, speech).
  • Picture: hours, attendance in → hidden layer → P(pass) out. Weights start random. Training (backprop) nudges them so errors fall.
  • Deep learning = this idea with many layers. You still need data, a loss, an optimiser (SGD/Adam), and a test set.
  • Trap: “neural nets always beat logistic”. On a tiny marks table, logistic or a forest often wins. Trap: no nonlinearity (then many layers collapse to one linear map).

Technical Interview Tip: Neurons in layers, then a bend. Train with backprop. Still use a test set.

Code Examples for Neural Networks Basics

Neural Networks Basics — working example

# PCA-style intuition: project 2D → 1D by a direction vector
points = [(1.0, 1.0), (2.0, 2.0), (3.0, 2.8)]
# unit direction along y = x
ux, uy = 0.7071, 0.7071
proj = [x * ux + y * uy for x, y in points]
print([round(v, 3) for v in proj])

# Tiny ensemble: average two model votes
votes = [1, 0, 1]
v2 = [1, 1, 1]
ens = [1 if a + b >= 2 else 0 for a, b in zip(v1, v2)]
print(ens)

Neural Networks Basics — dim reduction compresses features; ensembles combine models; deep nets/RL/NLP are specialized families — practice the core math idea first.

How to Explain Neural Networks Basics to an Interviewer

What does a neuron do?

Weighted sum Then activation

Why activation?

Without it, deep stack ≈ one linear model