{"id":3539,"date":"2025-11-25T11:12:57","date_gmt":"2025-11-25T10:12:57","guid":{"rendered":"https:\/\/neuraldesigner.com\/learning\/training-strategy\/"},"modified":"2026-11-05T13:06:03","modified_gmt":"2026-11-05T12:06:03","slug":"training-strategy","status":"publish","type":"learning","link":"https:\/\/www.neuraldesigner.com\/learning\/tutorials\/training-strategy\/","title":{"rendered":"Machine learning tutorial: Training strategy"},"content":{"rendered":"<style id=\"nd-tutorial-series-css\">.ndts{max-width:1000px;margin:0 auto 26px;padding:18px 20px;border:1px solid #d8e2ef;border-radius:14px;background:#f7fafc;font-family:\"Outfit\",\"Roboto\",Arial,sans-serif}.ndts-meta{color:#2d799f;font-size:14px;font-weight:800;letter-spacing:.06em;text-transform:uppercase}.ndts-intro{margin:8px 0 14px;color:#405361;line-height:1.5}.ndts-progress{display:grid;grid-template-columns:repeat(7,minmax(0,1fr));gap:6px;margin:0;padding:0;list-style:none}.ndts-progress a{display:flex;align-items:center;justify-content:center;min-height:38px;padding:6px;border:1px solid #cbd9e2;border-radius:7px;background:#fff;color:#285c78!important;text-decoration:none!important;font-size:13px;font-weight:700;text-align:center}.ndts-progress a[aria-current=\"step\"]{border-color:#2d799f;background:#2d799f;color:#fff!important}.ndts-controls{display:flex;justify-content:space-between;align-items:center;gap:10px;margin-top:14px;flex-wrap:wrap}.ndts-controls a{color:#1261a0!important;font-weight:700;text-decoration:none!important}.ndts-bottom{max-width:1000px;margin:26px auto;padding:18px 20px;border-top:1px solid #d8e2ef;font-family:\"Outfit\",\"Roboto\",Arial,sans-serif}.ndts-finish{margin:0 0 18px;padding:22px;border:1px solid #d8e2ef;border-radius:12px;background:#f6f9fc}.ndts-btn{display:inline-block;margin:6px 8px 0 0;padding:11px 15px;border-radius:7px;background:#1261a0;color:#fff!important;text-decoration:none!important;font-weight:700}@media(max-width:760px){.ndts-progress{grid-template-columns:repeat(2,minmax(0,1fr))}}<\/style>\r\n\r\n<nav class=\"ndts\" aria-label=\"Machine learning tutorial progress\">\r\n<div class=\"ndts-meta\">Machine learning tutorial \u00b7 Chapter 4 of 7<\/div>\r\n<p class=\"ndts-intro\">You can read this chapter independently. If this is your first visit, open the overview or start with Chapter 1. <a href=\"https:\/\/www.neuraldesigner.com\/learning\/machine-learning-tutorial\/\">Tutorial overview<\/a>.<\/p>\r\n\r\n<ol class=\"ndts-progress\">\r\n \t<li><a href=\"https:\/\/www.neuraldesigner.com\/learning\/tutorials\/neural-networks-applications\/\" data-tutorial-nav=\"chapter-1\">1. Model types<\/a><\/li>\r\n \t<li><a href=\"https:\/\/www.neuraldesigner.com\/learning\/tutorials\/data-set\/\" data-tutorial-nav=\"chapter-2\">2. Data set<\/a><\/li>\r\n \t<li><a href=\"https:\/\/www.neuraldesigner.com\/learning\/tutorials\/neural-network\/\" data-tutorial-nav=\"chapter-3\">3. Neural network<\/a><\/li>\r\n \t<li><a href=\"https:\/\/www.neuraldesigner.com\/learning\/tutorials\/training-strategy\/\" aria-current=\"step\" data-tutorial-nav=\"chapter-4\">4. Training strategy<\/a><\/li>\r\n \t<li><a href=\"https:\/\/www.neuraldesigner.com\/learning\/tutorials\/model-selection\/\" data-tutorial-nav=\"chapter-5\">5. Model selection<\/a><\/li>\r\n \t<li><a href=\"https:\/\/www.neuraldesigner.com\/learning\/tutorials\/testing-analysis\/\" data-tutorial-nav=\"chapter-6\">6. Testing analysis<\/a><\/li>\r\n \t<li><a href=\"https:\/\/www.neuraldesigner.com\/learning\/tutorials\/model-deployment\/\" data-tutorial-nav=\"chapter-7\">7. Model deployment<\/a><\/li>\r\n<\/ol>\r\n<div class=\"ndts-controls\"><a href=\"https:\/\/www.neuraldesigner.com\/learning\/tutorials\/neural-network\/\" data-tutorial-nav=\"previous\">\u2190 Neural network<\/a><a href=\"https:\/\/www.neuraldesigner.com\/learning\/machine-learning-tutorial\/\">Overview<\/a><a href=\"https:\/\/www.neuraldesigner.com\/learning\/tutorials\/model-selection\/\" data-tutorial-nav=\"next\">Model selection \u2192<\/a><\/div>\r\n<\/nav><style>\r\n.nd-math-block{display:block;max-width:100%;overflow-x:auto;margin:1rem 0;padding:.45rem 0;text-align:center}.nd-math-inline{display:inline-block;max-width:100%;overflow-x:auto;vertical-align:middle}.nd-math-block math,.nd-math-inline math{font-size:1.04em}table .nd-math-block{margin:.25rem 0;padding:.2rem 0}<br \/>\r\n<\/style> <style>.ndg{width:100vw;margin-left:calc(50% - 50vw);background:#eeeeee;padding:22px 24px 12px;font-family:\"Outfit\",\"Roboto\",Arial,sans-serif;color:#1b2635}.ndg *{box-sizing:border-box}.ndg a{text-decoration:none}.ndg-wrap{width:min(100%,1000px);margin:0 auto}.ndg-lead{font-size:19px;line-height:1.6;color:#3a4a5a;font-weight:300;margin:0 0 24px}.ndg-lead a{color:#2d799f;font-weight:600}.ndg-herofig{text-align:center;margin:8px 0 22px}.ndg-herofig img{display:inline-block;width:64px;height:64px}.ndg-eyebrow{margin:0 0 14px;text-align:center;color:#2d799f;font-size:13px;font-weight:800;letter-spacing:.14em;text-transform:uppercase}.ndg-toc{list-style:none;counter-reset:s;display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:12px;margin:0 0 48px;padding:0}.ndg-toc li{counter-increment:s}.ndg-toc a{display:flex;align-items:center;gap:12px;height:100%;padding:13px 16px;background:#f2f2f2;border-radius:12px;color:#12354b!important;font-size:14.5px;font-weight:600;line-height:1.25;box-shadow:-8px -8px 16px rgba(255,255,255,.9),8px 8px 16px rgba(30,83,116,.10)}.ndg-toc a:hover{color:#2d799f!important}.ndg-toc a:before{content:counter(s);display:flex;align-items:center;justify-content:center;width:26px;height:26px;flex:0 0 26px;border-radius:50%;background:#56a1c8;color:#fff;font-size:13px;font-weight:800}.ndg-step{display:grid;grid-template-columns:64px 1fr;gap:26px;margin:0 0 34px;padding:34px 38px;background:#f2f2f2;border-radius:22px;box-shadow:-14px -14px 28px rgba(255,255,255,.92),14px 14px 28px rgba(30,83,116,.12);scroll-margin-top:90px}.ndg-step__no{display:flex;align-items:center;justify-content:center;width:64px;height:64px;border-radius:50%;background:linear-gradient(135deg,#56a1c8 0%,#245e80 100%);color:#fff;font-size:25px;font-weight:800;flex:0 0 64px}.ndg-step__body{min-width:0}.ndg-step__body .mjx-chtml.MJXc-display{overflow-x:auto;overflow-y:hidden;max-width:100%;padding:2px 0 8px}.ndg-step__body .mjx-chtml.MathJax_CHTML{font-size:18px!important}.ndg-step__body h2{margin:8px 0 16px;color:#001233;font-size:25px;font-weight:700;line-height:1.2}.ndg-step__body h3{margin:28px 0 12px;color:#12354b;font-size:19px;font-weight:600;scroll-margin-top:90px}.ndg-anchor-alias{display:block;height:0;position:relative;top:-90px;visibility:hidden}.ndg-step__body p{margin:0 0 16px;font-size:17px;line-height:1.62;color:#33424f}.ndg-step__body a{color:#2d799f;font-weight:500}.ndg-step__body ul{margin:0 0 16px;padding-left:22px}.ndg-step__body li{margin:7px 0;font-size:16px;line-height:1.55;color:#33424f}.ndg-step__body img:not([src$=\".svg\"]):not([data-src$=\".svg\"]){display:block!important;width:auto!important;max-width:min(580px,100%)!important;height:auto!important;margin:22px auto!important;border-radius:12px!important;box-shadow:0 12px 28px rgba(0,18,51,.12)!important}.ndg-step__body img[src$=\".svg\"],.ndg-step__body img[data-src$=\".svg\"]{display:block;margin:18px auto;max-width:min(520px,100%);height:auto}.ndg-note{margin:18px 0;padding:15px 18px;border-left:4px solid #56a1c8;background:rgba(86,161,200,.08);border-radius:0 10px 10px 0;color:#33424f;font-size:16px;line-height:1.55}.ndg-table-wrap{max-width:100%;overflow-x:auto;margin:18px 0 22px}.ndg-table{width:100%;min-width:620px;border-collapse:separate;border-spacing:0;background:#fff;border:1px solid #c8d7df;border-radius:12px;overflow:hidden}.ndg-table th,.ndg-table td{padding:12px 14px;border-bottom:1px solid #dce5ea;text-align:left;vertical-align:top;font-size:15px;line-height:1.45;color:#33424f}.ndg-table th{background:#e8f1f6;color:#12354b;font-weight:700}.ndg-table tr:last-child td{border-bottom:0}.ndg-nav{display:flex;justify-content:space-between;gap:16px;margin:12px 0 8px;flex-wrap:wrap}.ndg-nav a{display:inline-flex;align-items:center;padding:13px 24px;border-radius:10px;background:#f2f2f2;color:#2d799f!important;font-weight:800;font-size:15px;box-shadow:-8px -8px 16px rgba(255,255,255,.92),8px 8px 16px rgba(30,83,116,.10)}.ndg-nav a:hover{color:#1f5f80!important}@media(max-width:820px){.ndg-toc{grid-template-columns:1fr}.ndg-step{grid-template-columns:1fr;gap:16px;padding:26px 22px}.ndg-step__no{width:52px;height:52px;flex:0 0 52px;font-size:22px}.ndg-step__body h2{font-size:22px}}@media(max-width:640px){.ndg{padding:12px 14px}.ndg-table th,.ndg-table td{padding:10px 12px}}<\/style>\r\n<div class=\"ndg\">\r\n<div class=\"ndg-wrap\">\r\n<div class=\"ndg-lead\">\r\n\r\nTutorial index:\r\n<ul>\r\n \t<li><a href=\"https:\/\/www.neuraldesigner.com\/learning\/tutorials\/neural-networks-applications\/\">1. Model types<\/a><\/li>\r\n \t<li><a href=\"https:\/\/www.neuraldesigner.com\/learning\/tutorials\/data-set\/\">2. Data set<\/a><\/li>\r\n \t<li><a href=\"https:\/\/www.neuraldesigner.com\/learning\/tutorials\/neural-network\/\">3. Neural network<\/a><\/li>\r\n \t<li><a href=\"https:\/\/www.neuraldesigner.com\/learning\/tutorials\/training-strategy\/\">4. Training strategy<\/a><\/li>\r\n \t<li><a href=\"https:\/\/www.neuraldesigner.com\/learning\/tutorials\/model-selection\/\">5. Model selection<\/a><\/li>\r\n \t<li><a href=\"https:\/\/www.neuraldesigner.com\/learning\/tutorials\/testing-analysis\/\">6. Testing analysis<\/a><\/li>\r\n \t<li><a href=\"https:\/\/www.neuraldesigner.com\/learning\/tutorials\/model-deployment\/\">7. Model deployment<\/a><\/li>\r\n<\/ul>\r\n<h2>4. Training strategy<\/h2>\r\nThe training strategy determines how a neural network learns from a data set. It combines a loss, which measures the model error, with an optimization algorithm, which updates the model parameters.\r\n\r\nOpenNN selects suitable defaults from the neural network task. You can also configure the loss, optimizer, stopping criteria, batch processing, and validation behavior.\r\n\r\n<\/div>\r\n<div class=\"ndg-herofig\"><img decoding=\"async\" src=\"https:\/\/www.neuraldesigner.com\/images\/training_strategy.svg\" alt=\"Training strategy\" width=\"64\" height=\"64\" \/><\/div>\r\n<p class=\"ndg-eyebrow\">Contents<\/p>\r\n\r\n<ul class=\"ndg-toc\">\r\n \t<li><a href=\"#Loss\">Loss<\/a><\/li>\r\n \t<li><a href=\"#OptimizationAlgorithms\">Optimization algorithms<\/a><\/li>\r\n \t<li><a href=\"#TrainingControl\">Training control and defaults<\/a><\/li>\r\n<\/ul>\r\n<div id=\"Loss\" class=\"ndg-step\">\r\n<div class=\"ndg-step__no\">1<\/div>\r\n<div class=\"ndg-step__body\">\r\n\r\n&nbsp;\r\n<h2>Loss<\/h2>\r\nThe loss defines what the neural network must learn. It combines an error term with an optional regularization term:\r\n\r\n&nbsp;\r\n\r\nloss=error+regularization&nbsp;\r\n<h3 id=\"ErrorTerm\">Error term<\/h3>\r\nThe error measures the difference between the\u00a0<span style=\"box-sizing: border-box; margin: 0px; padding: 0px;\"><a href=\"https:\/\/www.neuraldesigner.com\/learning\/tutorials\/neural-network\/\" target=\"_blank\" rel=\"noopener\">neural network&#8217;s outputs<\/a><\/span>\u00a0and the targets in the <a href=\"https:\/\/www.neuraldesigner.com\/learning\/tutorials\/data-set\/\">data set<\/a>.\r\n\r\nThe training error is calculated on the <a href=\"https:\/\/www.neuraldesigner.com\/learning\/tutorials\/data-set\/#TrainingSamples\">training samples<\/a>. The validation error monitors generalization on the <a href=\"https:\/\/www.neuraldesigner.com\/learning\/tutorials\/data-set\/#SelectionSamples\">validation samples<\/a>. The <a href=\"https:\/\/www.neuraldesigner.com\/learning\/tutorials\/data-set\/#TestingSamples\">testing samples<\/a> are reserved for the final evaluation and do not update the model.\r\n\r\nOpenNN provides the following general-purpose error methods:\r\n<ul>\r\n \t<li><a href=\"#MeanSquaredError\">Mean squared error<\/a>.<\/li>\r\n \t<li><a href=\"#MeanAbsoluteError\">Mean absolute error<\/a>.<\/li>\r\n \t<li><a href=\"#NormalizedSquaredError\">Normalized squared error<\/a>.<\/li>\r\n \t<li><a href=\"#WeightedSquaredError\">Weighted squared error<\/a>.<\/li>\r\n \t<li><a href=\"#CrossEntropyError\">Cross-entropy error<\/a>.<\/li>\r\n \t<li><a href=\"#CrossEntropyError3d\">3D cross-entropy error<\/a>.<\/li>\r\n \t<li><a href=\"#MinkowskiError\">Minkowski error<\/a>.<\/li>\r\n<\/ul>\r\n<h3 id=\"MeanSquaredError\">Mean squared error (MSE)<\/h3>\r\nThe mean squared error penalizes large differences between outputs and targets. It is the default error for approximation and forecasting.\r\n\r\n&nbsp;\r\n\r\nMSE=12N\u2211i=1N\u2016yi\u2212ti\u20162&nbsp;\r\n<h3 id=\"MeanAbsoluteError\">Mean absolute error (MAE)<\/h3>\r\nThe mean absolute error (MAE) is less sensitive to large individual errors than squared losses. It is the default reconstruction loss for anomaly detection in Neural Designer.\r\n\r\n&nbsp;\r\n\r\nMAE=1M\u2211j=1M|yj\u2212tj|&nbsp;\r\n<h3 id=\"NormalizedSquaredError\">Normalized squared error (NSE)<\/h3>\r\nThe normalized squared error divides the squared error by the target variance. A value close to one indicates predictions around the target mean, while zero indicates a perfect prediction.\r\n\r\n&nbsp;\r\n\r\nNSE=\u2211\u2016y\u2212t\u20162\u2211\u2016t\u2212t\u00af\u20162&nbsp;\r\n<h3 id=\"WeightedSquaredError\">Weighted squared error (WSE)<\/h3>\r\nThe weighted squared error is designed for imbalanced binary classification. OpenNN calculates class weights from the positive and negative training samples and gives both classes a balanced contribution.\r\n\r\n&nbsp;\r\n\r\nWSE\u221d12\u2211i=1Nwti(yi\u2212ti)2&nbsp;\r\n<h3 id=\"CrossEntropyError\">Cross-entropy error<\/h3>\r\nCross-entropy measures probabilistic classification. OpenNN uses binary cross-entropy for one output and categorical cross-entropy for multiple outputs. Multiclass models require a softmax output.\r\n\r\n&nbsp;\r\n\r\nBCE=\u22121N\u2211[tlog(y)+(1\u2212t)log(1\u2212y)]&nbsp;\r\n<h3 id=\"CrossEntropyError3d\">3D cross-entropy error<\/h3>\r\nThe 3D cross-entropy error trains language models and other token sequences. It averages categorical cross-entropy over active tokens and also reports token accuracy and perplexity.\r\n<h3 id=\"MinkowskiError\">Minkowski error (ME)<\/h3>\r\nThe Minkowski error uses a power between one and two to reduce the influence of large residuals. Its default power is 1.5. This loss currently runs on CPU.\r\n\r\n&nbsp;\r\n\r\nME=1pN\u2211i=1N|yi\u2212ti|p&nbsp;\r\n<h3 id=\"RegularizationTerm\">Regularization term<\/h3>\r\nRegularization penalizes large parameters to control model complexity. It is optional, and no regularization is applied by default.\r\n<ul>\r\n \t<li><a href=\"#L1Regularization\">L1 regularization<\/a>.<\/li>\r\n \t<li><a href=\"#L2Regularization\">L2 regularization<\/a>.<\/li>\r\n<\/ul>\r\n<h3 id=\"L1Regularization\">L1 regularization<\/h3>\r\nL1 regularization adds the sum of the absolute parameter values to the loss.\r\n\r\n&nbsp;\r\n\r\nR1=\u03bb\u2211|\u03b8|&nbsp;\r\n<h3 id=\"L2Regularization\">L2 regularization<\/h3>\r\nL2 regularization adds the sum of the squared parameter values to the loss.\r\n\r\n&nbsp;\r\n\r\nR2=\u03bb\u2211\u03b82&nbsp;\r\n<h3 id=\"LossFunction\">Loss function<\/h3>\r\nThe loss forms a surface over the neural network parameters. Training searches this surface for parameter values that minimize the selected objective.\r\n\r\n<img decoding=\"async\" src=\"https:\/\/www.neuraldesigner.com\/images\/loss_function.svg\" alt=\"Loss function\" width=\"500\" \/>\r\n\r\n<\/div>\r\n<\/div>\r\n<div id=\"OptimizationAlgorithms\" class=\"ndg-step\">\r\n<div class=\"ndg-step__no\">2<\/div>\r\n<div class=\"ndg-step__body\">\r\n\r\n&nbsp;\r\n<h2>Optimization algorithms<\/h2>\r\nThe optimization algorithm updates the neural network parameters to reduce the loss. OpenNN currently provides four algorithms:\r\n<ul>\r\n \t<li><a href=\"#AdaptiveMomentEstimation\">Adaptive moment estimation (Adam)<\/a>.<\/li>\r\n \t<li><a href=\"#StochasticGradientDescent\">Stochastic gradient descent (SGD)<\/a>.<\/li>\r\n \t<li><a href=\"#QuasiNewtonMethod\">Quasi-Newton method<\/a>.<\/li>\r\n \t<li><a href=\"#LevenbergMarquardtAlgorithm\">Levenberg-Marquardt algorithm<\/a>.<\/li>\r\n<\/ul>\r\n<div class=\"ndg-table-wrap\">\r\n<table class=\"ndg-table\">\r\n<thead>\r\n<tr>\r\n<th>Algorithm<\/th>\r\n<th>Training mode<\/th>\r\n<th>Hardware<\/th>\r\n<th>Best suited for<\/th>\r\n<\/tr>\r\n<\/thead>\r\n<tbody>\r\n<tr>\r\n<td>Adam<\/td>\r\n<td>Mini-batch<\/td>\r\n<td>CPU and GPU<\/td>\r\n<td>Large, image, text, and sequence models<\/td>\r\n<\/tr>\r\n<tr>\r\n<td>SGD<\/td>\r\n<td>Mini-batch<\/td>\r\n<td>CPU and GPU<\/td>\r\n<td>Controlled learning schedules and large data sets<\/td>\r\n<\/tr>\r\n<tr>\r\n<td>Quasi-Newton<\/td>\r\n<td>Full-batch<\/td>\r\n<td>CPU<\/td>\r\n<td>Tabular and moderate-size problems<\/td>\r\n<\/tr>\r\n<tr>\r\n<td>Levenberg-Marquardt<\/td>\r\n<td>Full-batch<\/td>\r\n<td>CPU<\/td>\r\n<td>Small sequential Dense regression models<\/td>\r\n<\/tr>\r\n<\/tbody>\r\n<\/table>\r\n<\/div>\r\n<h3 id=\"AdaptiveMomentEstimation\">Adaptive moment estimation (Adam)<\/h3>\r\n&nbsp;\r\n\r\nAdam combines exponential averages of the gradient and squared gradient with bias correction. Its main parameters are the learning rate, beta 1, and beta 2.\r\n\r\n&nbsp;\r\n\r\n\u03b8t=\u03b8t\u22121\u2212\u03b1m^tv^t+\u03b5&nbsp;\r\n\r\nAdam is the default optimizer for approximation, forecasting, anomaly detection, image classification, text classification, and language modeling.\r\n<h3 id=\"StochasticGradientDescent\">Stochastic gradient descent (SGD)<\/h3>\r\n&nbsp;\r\n\r\nSGD updates the parameters after every mini-batch. OpenNN supports learning-rate decay, momentum, and Nesterov momentum.\r\n\r\n&nbsp;\r\n\r\n\u03b7t=\u03b701+td,\u03b8t=\u03b8t\u22121\u2212\u03b7tgt&nbsp;\r\n<h3 id=\"QuasiNewtonMethod\">Quasi-Newton method (QNM)<\/h3>\r\nThe quasi-Newton method builds a BFGS approximation of the inverse Hessian from successive gradients. An Armijo line search selects the step size.\r\n\r\n&nbsp;\r\n\r\n\u03b8t+1=\u03b8t\u2212\u03b1tHtgt&nbsp;\r\n\r\nQuasi-Newton uses all training samples in every epoch and runs on the CPU. It is the default optimizer for binary and multiclass classification.\r\n<h3 id=\"LevenbergMarquardtAlgorithm\">Levenberg-Marquardt algorithm (LM)<\/h3>\r\nLevenberg-Marquardt combines the speed of Gauss-Newton with an adaptive damping parameter. It solves the following system for every parameter update:\r\n\r\n&nbsp;\r\n\r\n(JTJ+\u03bbI)\u0394\u03b8=\u2212JTe&nbsp;\r\n\r\nIt runs on CPU and is intended for sum-of-squares problems with sequential Dense trainable layers. Softmax outputs, non-Dense trainable layers, and weighted, cross-entropy, or Minkowski errors are not supported.\r\n<h3 id=\"PerformanceConsiderations\">Performance considerations<\/h3>\r\nUse Levenberg-Marquardt for small Dense regression models and Quasi-Newton for moderate full-batch problems. Use Adam or SGD for GPU training, large data sets, and convolutional, attention, recurrent, image, or text networks.\r\n\r\nThe\u00a0<span style=\"box-sizing: border-box; margin: 0px; padding: 0px;\"><a href=\"https:\/\/www.neuraldesigner.com\/blog\/5_algorithms_to_train_a_neural_network\/\" target=\"_blank\" rel=\"noopener\">Neural Designer blog&#8217;s neural network optimizer guide<\/a>\u00a0in<a href=\"https:\/\/www.neuraldesigner.com\/blog\/\" target=\"_blank\" rel=\"noopener\">clude<\/a>s<\/span>\u00a0a broader comparison of optimization methods.\r\n\r\n<\/div>\r\n<\/div>\r\n<div id=\"TrainingControl\" class=\"ndg-step\">\r\n<div class=\"ndg-step__no\">3<\/div>\r\n<div class=\"ndg-step__body\">\r\n<h2>Training control and defaults<\/h2>\r\nThe same stopping, validation, and execution controls are shared by the OpenNN optimizers.\r\n\r\n<img decoding=\"async\" src=\"https:\/\/www.neuraldesigner.com\/images\/training_process.svg\" alt=\"Training process\" width=\"425\" \/>\r\n<div class=\"ndg-table-wrap\">\r\n<table class=\"ndg-table\">\r\n<thead>\r\n<tr>\r\n<th>Control<\/th>\r\n<th>Purpose<\/th>\r\n<\/tr>\r\n<\/thead>\r\n<tbody>\r\n<tr>\r\n<td>Batch size<\/td>\r\n<td>Sets the samples processed together. A value of zero selects the largest batch that fits the available memory.<\/td>\r\n<\/tr>\r\n<tr>\r\n<td>Sample shuffling<\/td>\r\n<td>Randomizes training batches at every epoch.<\/td>\r\n<\/tr>\r\n<tr>\r\n<td>Loss goal<\/td>\r\n<td>Stops training when the requested training error is reached.<\/td>\r\n<\/tr>\r\n<tr>\r\n<td>Maximum epochs<\/td>\r\n<td>Limits the number of complete passes through the training data.<\/td>\r\n<\/tr>\r\n<tr>\r\n<td>Maximum time<\/td>\r\n<td>Limits the elapsed training time.<\/td>\r\n<\/tr>\r\n<tr>\r\n<td>Validation failures<\/td>\r\n<td>Stops after the validation error fails to improve a specified number of times.<\/td>\r\n<\/tr>\r\n<tr>\r\n<td>Validation period<\/td>\r\n<td>Controls how often the validation subset is evaluated.<\/td>\r\n<\/tr>\r\n<tr>\r\n<td>Restore best<\/td>\r\n<td>Restores the parameters and states from the best validation epoch.<\/td>\r\n<\/tr>\r\n<tr>\r\n<td>Gradient clipping<\/td>\r\n<td>Limits the gradient norm to stabilize Adam and SGD.<\/td>\r\n<\/tr>\r\n<\/tbody>\r\n<\/table>\r\n<\/div>\r\n<h3 id=\"StoppingCriteria\">Stopping criteria<\/h3>\r\nTraining can stop after reaching the loss goal, the maximum number of epochs, the maximum time, or the maximum validation failures. Minimum loss decrease is also available for the full-batch Quasi-Newton and Levenberg-Marquardt algorithms.\r\n<h3 id=\"Validation\">Validation and best model<\/h3>\r\nValidation samples monitor generalization without updating the parameters. When validation is available, OpenNN stores the best parameters and network states and restores them after training by default.\r\n\r\nThe testing subset is not used to choose parameters or stop training. It is reserved for the subsequent <a href=\"https:\/\/www.neuraldesigner.com\/learning\/tutorials\/testing-analysis\/\">testing analysis<\/a>.\r\n<h3 id=\"TaskDefaults\">Task defaults<\/h3>\r\nOpenNN initializes the loss and optimizer from the neural network task:\r\n<div class=\"ndg-table-wrap\">\r\n<table class=\"ndg-table\">\r\n<thead>\r\n<tr>\r\n<th>Task<\/th>\r\n<th>Default loss<\/th>\r\n<th>Default optimizer<\/th>\r\n<\/tr>\r\n<\/thead>\r\n<tbody>\r\n<tr>\r\n<td>Approximation<\/td>\r\n<td>Mean squared error<\/td>\r\n<td>Adam<\/td>\r\n<\/tr>\r\n<tr>\r\n<td>Forecasting<\/td>\r\n<td>Mean squared error<\/td>\r\n<td>Adam<\/td>\r\n<\/tr>\r\n<tr>\r\n<td>Anomaly detection<\/td>\r\n<td>Mean absolute error<\/td>\r\n<td>Adam<\/td>\r\n<\/tr>\r\n<tr>\r\n<td>Binary classification<\/td>\r\n<td>Weighted squared error<\/td>\r\n<td>Quasi-Newton<\/td>\r\n<\/tr>\r\n<tr>\r\n<td>Multiclass classification<\/td>\r\n<td>Cross-entropy<\/td>\r\n<td>Quasi-Newton<\/td>\r\n<\/tr>\r\n<tr>\r\n<td>Image classification<\/td>\r\n<td>Cross-entropy<\/td>\r\n<td>Adam<\/td>\r\n<\/tr>\r\n<tr>\r\n<td>Text classification<\/td>\r\n<td>Cross-entropy<\/td>\r\n<td>Adam<\/td>\r\n<\/tr>\r\n<tr>\r\n<td>Language modeling<\/td>\r\n<td>3D cross-entropy<\/td>\r\n<td>Adam<\/td>\r\n<\/tr>\r\n<\/tbody>\r\n<\/table>\r\n<\/div>\r\n<h3 id=\"HardwareAndBatches\">Hardware and batches<\/h3>\r\nAdam and SGD train on CPU or GPU and support CUDA graph execution. OpenNN can size batches from available CPU or GPU memory, shuffle samples, and prefetch batches during training. Quasi-Newton and Levenberg-Marquardt are full-batch CPU algorithms.\r\n<h3 id=\"TrainingResults\">Training results<\/h3>\r\nThe training result stores the training and validation histories, stopping condition, elapsed and measured training time, final loss, and the epoch restored as the best model.\r\n\r\n<\/div>\r\n<\/div>\r\n<\/div>\r\n<\/div>\r\n<nav class=\"ndts-bottom\" aria-label=\"Tutorial chapter navigation\">\r\n<div class=\"ndts-controls\"><a href=\"https:\/\/www.neuraldesigner.com\/learning\/tutorials\/neural-network\/\" data-tutorial-nav=\"previous\">\u2190 Neural network<\/a><a href=\"https:\/\/www.neuraldesigner.com\/learning\/machine-learning-tutorial\/\">All chapters<\/a><a href=\"https:\/\/www.neuraldesigner.com\/learning\/tutorials\/model-selection\/\" data-tutorial-nav=\"next\">Model selection \u2192<\/a><\/div>\r\n<\/nav><!-- nd-seo:start context -->\r\n\r\nRelated reading: <a href=\"https:\/\/www.neuraldesigner.com\/blog\/5_algorithms_to_train_a_neural_network\/\">Neural network optimizers<\/a>.\r\n\r\n<!-- nd-seo:end context -->","protected":false},"author":122,"featured_media":1428,"template":"","categories":[30],"tags":[36],"class_list":["post-3539","learning","type-learning","status-publish","has-post-thumbnail","hentry","category-tutorials","tag-tutorials"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v26.4 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Machine Learning Tutorial: Training Strategy - Neural Designer<\/title>\n<meta name=\"description\" content=\"Learn how loss functions, optimization algorithms and stopping criteria form an effective neural network training strategy.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.neuraldesigner.com\/learning\/tutorials\/training-strategy\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Neural networks tutorial: Training strategy\" \/>\n<meta property=\"og:description\" content=\"This tutorial shows the main training strategies used by neural networks to learn.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.neuraldesigner.com\/learning\/tutorials\/training-strategy\/\" \/>\n<meta property=\"og:site_name\" content=\"Neural Designer\" \/>\n<meta property=\"article:modified_time\" content=\"2026-11-05T12:06:03+00:00\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:title\" content=\"Neural networks tutorial: Training strategy\" \/>\n<meta name=\"twitter:description\" content=\"This tutorial shows the main training strategies used by neural networks to learn.\" \/>\n<meta name=\"twitter:site\" content=\"@NeuralDesigner\" \/>\n<meta name=\"twitter:label1\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data1\" content=\"6 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.neuraldesigner.com\/learning\/tutorials\/training-strategy\/\",\"url\":\"https:\/\/www.neuraldesigner.com\/learning\/tutorials\/training-strategy\/\",\"name\":\"Machine Learning Tutorial: Training Strategy - Neural Designer\",\"isPartOf\":{\"@id\":\"https:\/\/www.neuraldesigner.com\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/www.neuraldesigner.com\/learning\/tutorials\/training-strategy\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/www.neuraldesigner.com\/learning\/tutorials\/training-strategy\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.neuraldesigner.com\/wp-content\/uploads\/2023\/06\/training_process.svg\",\"datePublished\":\"2025-11-25T10:12:57+00:00\",\"dateModified\":\"2026-11-05T12:06:03+00:00\",\"description\":\"Learn how loss functions, optimization algorithms and stopping criteria form an effective neural network training strategy.\",\"breadcrumb\":{\"@id\":\"https:\/\/www.neuraldesigner.com\/learning\/tutorials\/training-strategy\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.neuraldesigner.com\/learning\/tutorials\/training-strategy\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.neuraldesigner.com\/learning\/tutorials\/training-strategy\/#primaryimage\",\"url\":\"https:\/\/www.neuraldesigner.com\/wp-content\/uploads\/2023\/06\/training_process.svg\",\"contentUrl\":\"https:\/\/www.neuraldesigner.com\/wp-content\/uploads\/2023\/06\/training_process.svg\",\"width\":13341,\"height\":8113,\"caption\":\"Neural network training process diagram\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.neuraldesigner.com\/learning\/tutorials\/training-strategy\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.neuraldesigner.com\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Learning\",\"item\":\"https:\/\/www.neuraldesigner.com\/learning\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Machine learning tutorial: Training strategy\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.neuraldesigner.com\/#website\",\"url\":\"https:\/\/www.neuraldesigner.com\/\",\"name\":\"Neural Designer\",\"description\":\"No-code AI Platform\",\"publisher\":{\"@id\":\"https:\/\/www.neuraldesigner.com\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.neuraldesigner.com\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/www.neuraldesigner.com\/#organization\",\"name\":\"Neural Designer\",\"url\":\"https:\/\/www.neuraldesigner.com\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.neuraldesigner.com\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/www.neuraldesigner.com\/wp-content\/uploads\/2023\/05\/logo-neural-1.png\",\"contentUrl\":\"https:\/\/www.neuraldesigner.com\/wp-content\/uploads\/2023\/05\/logo-neural-1.png\",\"width\":1024,\"height\":223,\"caption\":\"Neural Designer\"},\"image\":{\"@id\":\"https:\/\/www.neuraldesigner.com\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/x.com\/NeuralDesigner\",\"https:\/\/es.linkedin.com\/showcase\/neuraldesigner\/\"]}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Machine Learning Tutorial: Training Strategy - Neural Designer","description":"Learn how loss functions, optimization algorithms and stopping criteria form an effective neural network training strategy.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.neuraldesigner.com\/learning\/tutorials\/training-strategy\/","og_locale":"en_US","og_type":"article","og_title":"Neural networks tutorial: Training strategy","og_description":"This tutorial shows the main training strategies used by neural networks to learn.","og_url":"https:\/\/www.neuraldesigner.com\/learning\/tutorials\/training-strategy\/","og_site_name":"Neural Designer","article_modified_time":"2026-11-05T12:06:03+00:00","twitter_card":"summary_large_image","twitter_title":"Neural networks tutorial: Training strategy","twitter_description":"This tutorial shows the main training strategies used by neural networks to learn.","twitter_site":"@NeuralDesigner","twitter_misc":{"Est. reading time":"6 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.neuraldesigner.com\/learning\/tutorials\/training-strategy\/","url":"https:\/\/www.neuraldesigner.com\/learning\/tutorials\/training-strategy\/","name":"Machine Learning Tutorial: Training Strategy - Neural Designer","isPartOf":{"@id":"https:\/\/www.neuraldesigner.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.neuraldesigner.com\/learning\/tutorials\/training-strategy\/#primaryimage"},"image":{"@id":"https:\/\/www.neuraldesigner.com\/learning\/tutorials\/training-strategy\/#primaryimage"},"thumbnailUrl":"https:\/\/www.neuraldesigner.com\/wp-content\/uploads\/2023\/06\/training_process.svg","datePublished":"2025-11-25T10:12:57+00:00","dateModified":"2026-11-05T12:06:03+00:00","description":"Learn how loss functions, optimization algorithms and stopping criteria form an effective neural network training strategy.","breadcrumb":{"@id":"https:\/\/www.neuraldesigner.com\/learning\/tutorials\/training-strategy\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.neuraldesigner.com\/learning\/tutorials\/training-strategy\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.neuraldesigner.com\/learning\/tutorials\/training-strategy\/#primaryimage","url":"https:\/\/www.neuraldesigner.com\/wp-content\/uploads\/2023\/06\/training_process.svg","contentUrl":"https:\/\/www.neuraldesigner.com\/wp-content\/uploads\/2023\/06\/training_process.svg","width":13341,"height":8113,"caption":"Neural network training process diagram"},{"@type":"BreadcrumbList","@id":"https:\/\/www.neuraldesigner.com\/learning\/tutorials\/training-strategy\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.neuraldesigner.com\/"},{"@type":"ListItem","position":2,"name":"Learning","item":"https:\/\/www.neuraldesigner.com\/learning\/"},{"@type":"ListItem","position":3,"name":"Machine learning tutorial: Training strategy"}]},{"@type":"WebSite","@id":"https:\/\/www.neuraldesigner.com\/#website","url":"https:\/\/www.neuraldesigner.com\/","name":"Neural Designer","description":"No-code AI Platform","publisher":{"@id":"https:\/\/www.neuraldesigner.com\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.neuraldesigner.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.neuraldesigner.com\/#organization","name":"Neural Designer","url":"https:\/\/www.neuraldesigner.com\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.neuraldesigner.com\/#\/schema\/logo\/image\/","url":"https:\/\/www.neuraldesigner.com\/wp-content\/uploads\/2023\/05\/logo-neural-1.png","contentUrl":"https:\/\/www.neuraldesigner.com\/wp-content\/uploads\/2023\/05\/logo-neural-1.png","width":1024,"height":223,"caption":"Neural Designer"},"image":{"@id":"https:\/\/www.neuraldesigner.com\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/x.com\/NeuralDesigner","https:\/\/es.linkedin.com\/showcase\/neuraldesigner\/"]}]}},"_links":{"self":[{"href":"https:\/\/www.neuraldesigner.com\/api\/wp\/v2\/learning\/3539","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.neuraldesigner.com\/api\/wp\/v2\/learning"}],"about":[{"href":"https:\/\/www.neuraldesigner.com\/api\/wp\/v2\/types\/learning"}],"author":[{"embeddable":true,"href":"https:\/\/www.neuraldesigner.com\/api\/wp\/v2\/users\/122"}],"version-history":[{"count":13,"href":"https:\/\/www.neuraldesigner.com\/api\/wp\/v2\/learning\/3539\/revisions"}],"predecessor-version":[{"id":24615,"href":"https:\/\/www.neuraldesigner.com\/api\/wp\/v2\/learning\/3539\/revisions\/24615"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.neuraldesigner.com\/api\/wp\/v2\/media\/1428"}],"wp:attachment":[{"href":"https:\/\/www.neuraldesigner.com\/api\/wp\/v2\/media?parent=3539"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.neuraldesigner.com\/api\/wp\/v2\/categories?post=3539"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.neuraldesigner.com\/api\/wp\/v2\/tags?post=3539"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}