Data ScienceDeep learning and computer vision

Build a neural network baseline before adding more layers

PK
Pankit Kumar
Sr. Data Scientist at Parexel (a Goldman Sachs–backed company) · 20 September 2026 · 2 min read
Technically reviewed by Ishaan Sharma
In this article (5 sections)

More layers increase a neural network’s capacity, tuning surface and operating cost. They do not guarantee better future performance. A useful experiment starts with a linear reference, adds one small hidden layer, then accepts a deeper candidate only when validation evidence justifies the change.

One split, three capacities

The inspectable neural lab creates 600 noisy two-moon observations and fixes stratified partitions of 360 training, 120 validation and 120 test rows. Scaling is fitted on training only. Three models see the same data:

ModelNeural parameters recordedValidation accuracyTest accuracy
Logistic regressionn/a87.5%87.5%
One hidden layer, 8 units3394.2%96.7%
Two hidden layers, 32 and 16 units64192.5%92.5%

The one-layer network clears the linear reference. The deeper candidate adds 608 parameters and loses 1.7 percentage points on validation. It should not be selected merely because “deep” sounds more capable.

python
from deep_learning_cases import neural_baseline_case

result = neural_baseline_case()
one = result["models"]["one_hidden_layer"]
deep = result["models"]["two_hidden_layers"]
assert result["train_rows"] + result["validation_rows"] + result["test_rows"] == 600
assert one["validation_accuracy"] > deep["validation_accuracy"]
print(one["parameters"], deep["parameters"])

The code prints 33 641. These deterministic fixture results demonstrate the decision process; they are not estimates for another dataset or learner project.

Define the baseline ladder

Start with a trivial class-frequency predictor, then a regularized linear model, then a small neural network. Keep preprocessing, split, primary metric and threshold constant. This ladder shows whether nonlinearity adds value and whether another hidden layer adds value beyond that.

Use validation to choose architecture, regularization and learning settings. The table records test accuracy for audit, but it must not reverse the validation decision. Repeatedly choosing from test results consumes the holdout.

Accuracy is suitable only when its error trade-off fits the decision. For class imbalance or asymmetric costs, predeclare precision, recall, log loss, calibration or a cost function. Report slices and uncertainty when conclusions are close.

Complexity has operating costs

Count trainable parameters, fit time, artifact size and inference latency. More capacity can require more data and makes failure analysis harder. A model that wins by a negligible amount may still lose the deployment decision if it is unstable or expensive.

The Data Science course connects architecture experiments to evaluation, reproducibility and deployment evidence.

Exercise

Repeat the comparison over five declared seeds and report the validation distribution. Keep the test closed. State an improvement margin that a deeper model must exceed before the experiment begins.

Continue learning

This article is part of the Deep learning and computer vision sequence. Use the neighbouring tasks when you need the prerequisite or the next application.

Reference: scikit-learn supervised neural networks.

PK
Pankit Kumar
Lead Instructor, NeuraPath Academy

Pankit Kumar has 10 years in Data Science & AI, building and shipping production systems in regulated pharma and clinical environments. He is a freelance trainer at Boston Institute of Analytics, AnalytixLabs and Scaler, and has taught this material to thousands of working professionals.

This article is part of our Data Science programme — 6 months. From data foundations to machine learning, deep learning and deployment.

Explore Data Science
Counselling is free · no obligation

Not sure which programme fits?

Tell us your background and we will map it to the right entry point — including saying so when a cheaper programme is the better fit. A counsellor replies within one working day.