Skip to content
tishad.net
SearchCtrl K

Lessons / Part 8. Machine learning on small data in plain terms

49 A small neural network in plain terms

One hidden layer, five random starts and the weight count beside the row count, so a lucky seed is not mistaken for a result.

What people usually ask

Train a deep neural network on my 40 runs.

What comes back

Four hidden layers, a few thousand weights fitted to 40 rows, and one R2 of 0.97 from a single seed.

Ask this instead

I have cryst.csv: 40 cooling crystallizer runs, columns cool_rate_K_min, seed_pct, rpm and d50_um.
1. Pipeline: StandardScaler then MLPRegressor(hidden_layer_sizes=(8,), max_iter=2000).
2. Print the number of weights and biases in the network beside the number of rows.
3. Fit it five times with random_state 0 to 4, each under the same KFold(5, shuffle=True, random_state=0). Print the five cross validated R2 values, their mean and spread, and the same for LinearRegression on the same folds.
4. If a ConvergenceWarning appears, print it and explain in one line what it means and what max_iter changes.
5. Say in one line whether the best of the five is a random start that got lucky or a setting worth keeping, judged by the spread.
Do not add a second hidden layer unless the spread justifies it, and say what the justification was. Do not drop rows. Do not pick the seed with the best score and report that one alone.

Attach: The run table as CSV.

Why it works: The weight count beside the row count and five starts under the same folds show how much of the score is the model and how much is the seed.

Drafted with Fable 5.1 from my notes; chosen and edited by me.