Stochastic Gradient Descent Calculator

Configure datasets, learning rates, batches, momentum, regularisation, and stopping rules while visualising stochastic gradient descent updates through interactive charts and detailed tables with clarity.

Calculation Results

Not trained
Enter a dataset or load a sample. Then configure training and start the calculation.

Model Parameters

Predict New Data

Loss Convergence

Learning Rate Schedule

Parameter Trajectory

Prediction Analysis

Epoch History

Each row summarises one completed epoch.

Dataset and Training Options

Use comma, tab, or semicolon separators. The final column is the target.

Recent Calculations

Formula Used

θt+1 = θt − ηt ∇LBt)
MSE = (1/n) Σ(ŷi − yi
Log loss = −(1/n) Σ[yilog(pi) + (1−yi)log(1−pi)]
L2 penalty = λΣwj²; L1 penalty = λΣ|wj|

Each batch estimates the gradient using selected observations. The learning schedule changes each update size. Regularisation discourages unnecessarily large parameter values during model fitting.

How to Use

  1. Paste numeric rows or load a sample dataset.
  2. Keep the target value in the final column.
  3. Select regression or binary classification.
  4. Choose the loss, optimiser, and learning schedule.
  5. Set epochs, batch size, regularisation, and validation controls.
  6. Start training and inspect convergence charts.
  7. Export the results or print a PDF report.

Example Data

Feature 1Feature 2TargetPurpose
1.22.05.1Regression row
2.11.46.3Regression row
0.31.10Classification row
2.82.61Classification row

Frequently Asked Questions

What does stochastic gradient descent calculate?

It estimates model parameters through repeated batch updates. Each update follows a calculated loss gradient. Smaller batches produce noisier but frequent optimisation steps.

Which batch size should I choose?

Small batches increase update frequency and gradient noise. Large batches create smoother but fewer updates. Compare several values using identical random seeds.

Why should features be scaled?

Scaling places features on more comparable numerical ranges. This usually improves stable gradient movement. Unscaled features may require very small learning rates.

What causes a diverging loss?

The learning rate may be excessively large. Extreme features can also create unstable gradients. Enable scaling or gradient clipping before retrying.

How does momentum change SGD?

Momentum remembers part of earlier parameter movement. It can reduce oscillation across narrow valleys. Excessive momentum may overshoot a useful solution.

What does regularisation do?

Regularisation adds a penalty to the training objective. L1 can encourage sparse parameter values. L2 smoothly discourages very large parameter magnitudes.

When does early stopping activate?

It watches validation loss for meaningful improvement. Training stops after the selected patience expires. Best parameters can be restored automatically afterward.

Can this calculator handle classification?

Yes, it supports binary logistic classification. Targets must use zero and one values. The threshold converts probabilities into predicted classes.

Are results identical across repeated runs?

They are reproducible when settings and seeds match. Imported row order must also remain unchanged. Browser calculations may show tiny rounding differences.

Related Calculators

Gradient Descent CalculatorMomentum Optimiser CalculatorAdam Optimiser CalculatorLearning Rate Decay CalculatorK-Nearest Neighbours CalculatorKNN Majority Vote CalculatorQ-Learning Update CalculatorMulti-Armed Bandit CalculatorModel Calibration CalculatorBrier Score Calculator

Important Note: All the Calculators listed in this site are for educational purpose only and we do not guarentee the accuracy of results. Please do consult with other sources as well.