How Data Science Students Build Their First Neural Network
For data science students · Based on Ko Romeo Deep Learning Neural Network Builder
// TL;DR
This guide helps data science students go from a prediction problem to a working artificial neural network without getting lost in math or jargon. You'll learn how to identify your output type, build and standardise the input layer, add hidden layers, choose activation functions, define the cost function C = ½(ŷ - y)², and train with gradient descent and back propagation. Use it when a course assignment or personal project asks you to design an ANN and explain why it learns the way it does — not just run library code you don't understand.
Why do students struggle with their first neural network?
Most students can run a library call that trains a model, but they can't explain what happened. This framework fixes that by grounding every step in one idea: a neural network learns by adjusting weights on its synapses to minimise a cost function. Nothing else in the network is being learned — only the weights. Once you internalise this, the whole architecture stops being a black box.
The network mimics how the human brain operates. Individual neurons are useless alone — like ants, their power emerges from billions of weighted connections working together across hidden layers. Your job is to build that structure and supply labelled data, then let training discover the rules.
How do you turn an assignment into an architecture?
Start with your prediction goal and identify the output type. Predicting a house price? That's continuous — one output neuron. Predicting whether a customer churns? That's binary — one neuron with a Sigmoid or Threshold function. Predicting a category among several? That's categorical — multiple output neurons as dummy variables. Decide this first, because it sets your output activation function before anything else.
Next, list every independent variable for a single observation. Each becomes one input layer neuron. Critically, standardise them (mean 0, variance 1) or normalise them (0–1 range). If one variable ranges 0–1 and another ranges 0–1,000,000, your weighted sums are skewed and the network can't train. This is the single most common reason a student's network won't converge.
Then add one or more hidden layers. Multiple hidden layers are what make it deep learning. Don't pre-specify what each neuron should detect — that defeats the entire paradigm. Let training discover which input combinations matter.
Which activation functions should students use?
Keep it simple: use the Rectifier function in your hidden layers (it's the most popular) and the Sigmoid function in your output layer when predicting probabilities. That combination covers the majority of coursework problems. Reach for the Threshold function only for strict binary outputs and the Hyperbolic Tangent when negative outputs are meaningful.
How does the network actually learn?
Initialise all synapse weights, then define the cost function C = ½(ŷ - y)². Remember: y is the actual value, ŷ (y-hat) is the prediction. Confusing them collapses the whole learning signal — a classic exam mistake.
Never brute-force the weights. A trivial 25-weight network with 1,000 values each needs 10^75 combinations — longer than the universe has existed. Instead, use gradient descent: start at an arbitrary point on the cost curve, compute the slope, and step downhill. Run one epoch (a full pass through your data), accumulate the cost, then back-propagate the error to update every weight. All rows share the same weights — there is only one network. Repeat epochs until the cost is minimised.
If your dataset is large and training crawls, switch from batch gradient descent to Stochastic Gradient Descent, which updates weights after each row.
What should you do after training?
Interpret the hidden neurons. Near-zero weights mean an input is irrelevant to that neuron; non-zero weights reveal the pattern it detected. Expect the network to find combinations you never anticipated — that's the whole point.
Next step: Pick one small labelled dataset, walk through steps 1–9 by hand on paper before writing code, and make sure you're running Python 3.x, not 2.7. Explaining each step out loud is the fastest way to lock in the concepts for your exam or project defence.
// FREQUENTLY ASKED QUESTIONS
Do I need to know calculus to build a neural network for class?
You need conceptual understanding more than heavy calculus. Know that gradient descent computes the slope of the cost function and steps downhill to minimise error. Understand that the cost function C = ½(ŷ - y)² measures the gap between prediction and reality. Libraries handle the derivatives, but being able to explain why gradient descent beats brute force will impress any examiner.
What's the most common mistake students make on neural network assignments?
Feeding un-standardised input variables. If your features are on wildly different scales, the weighted sums are skewed and the network won't train properly. Always standardise (mean 0, variance 1) or normalise (0–1 range) before training. The second most common mistake is confusing y (actual) with ŷ (predicted) in the cost function.
How many hidden layers should I use for a course project?
Start with one or two hidden layers using Rectifier activation, then evaluate performance and iterate. There's no fixed formula. Remember that having at least one hidden layer is what makes it deep learning rather than shallow — a network with only input and output layers just replicates standard ML algorithms.