Halloween DealsAmazon USHalloween week deals: useful picks before month-endAmazon US: current deals, useful picks and tech finds.Check DealsSlow PC?RecommendedPC slow today? Run a repair scan before it gets worseResolve common Windows issues and optimize system performance.Scan NowHalloween DealsAmazon USOctober picks are moving - compare before checkoutAmazon US: current deals, useful picks and tech finds.See Picks×
FREEDOM251

Freedom251 › Blog › Machine Learning

What to Do When Regularization Makes a Model Underfit

By Freedom251 Team · · 8 min read

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

When both training and validation performance are poor, your model may be underfitting because its regularization is too strong—but a penalty is only one possible cause. First separate underfitting from overfitting with the same metric on training and validation data. Then relax the penalty in controlled steps, verify the parameter’s direction for your estimator, and keep preprocessing and model selection inside a leakage-safe validation design.

If weakening regularization does not improve validation results, stop tuning the penalty. Investigate features, labels, scaling, optimization, model capacity, and whether your split represents the data the model will see in production.

As an Amazon Associate I earn from qualifying purchases.

Confirm that the problem is underfitting

A single score cannot tell you whether regularization is responsible. Record at least the training score and a validation score produced with the same metric and prediction procedure. Scikit-learn’s guidance is direct: “If the training score and the validation score are both low, the estimator will be underfitting.” A high training score combined with a much lower validation score points instead to overfitting.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Training result Validation result More likely explanation First response
Low Low Underfitting, poor features, optimization failure, noisy labels, or an unsuitable model family Check the pipeline, then test weaker regularization and greater capacity
High Low Overfitting, leakage in the training process, or a validation split that differs from deployment Audit the split and leakage; consider stronger regularization or a simpler model
Low High Usually a split, metric, or implementation problem Verify scoring, preprocessing, labels, and that the two evaluations use the intended samples
Both unstable Both unstable Small sample size, outliers, grouped observations, or high variance across folds Inspect fold-by-fold results and use a split that matches deployment

“Low” is relative to a meaningful baseline and the business requirement. For classification, use a metric suited to class balance and error costs; for regression, select a metric that reflects the consequence of prediction errors. Compare against a simple baseline such as a majority-class or constant predictor before changing hyperparameters.

#1 Best Overall
Sale
Hands-On Machine Learning with Scikit-Learn, Keras, and TensorFlow: Concepts, Tools, and Techniques to Build Intelligent Systems
  • Use scikit-learn to track an example ML project end to end
  • Explore several models, including support vector machines, decision trees, random forests, and ensemble methods
  • Exploit unsupervised learning techniques such as dimensionality reduction, clustering, and anomaly detection
  • Dive into neural net architectures, including convolutional nets, recurrent nets, generative adversarial networks, autoencoders, diffusion models, and transformers
  • Use TensorFlow and Keras to build and train neural nets for computer vision, natural language processing, generative models, and deep reinforcement learning

Measure the gap, not just the scores

Write down the training score, the validation score, their difference, and the spread across cross-validation folds or random seeds. A small gap with two poor scores is consistent with high bias. A large positive training-minus-validation gap is evidence that the model is fitting the training data more readily than unseen data. Neither pattern proves that regularization is the cause, so treat it as a hypothesis to test.

Use a validation design that you can trust

Choose a validation set or cross-validation scheme before tuning. Reserve a separate test set for the final, one-time estimate of performance. Repeatedly selecting settings against the test set turns it into another validation set and makes the final score optimistic.

Match the split to deployment

  • Use stratification when class proportions must be preserved.
  • Keep all observations from the same person, device, customer, or experiment in one partition when grouping is part of the prediction problem.
  • Use chronological splits for forecasting or any setting in which future records must not influence training on the past.
  • Ensure duplicate or near-duplicate records cannot appear on both sides of the split.

Preprocessing must be fitted only on each training fold. Put imputation, scaling, encoding, feature selection, and the estimator in one pipeline so validation and test information cannot influence fitted transformations.

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
from sklearn.pipeline import make_pipeline
from sklearn.preprocessing import StandardScaler
from sklearn.svm import SVC
from sklearn.model_selection import cross_validate, StratifiedKFold

model = make_pipeline(StandardScaler(), SVC(C=1.0))
cv = StratifiedKFold(n_splits=5, shuffle=True, random_state=42)
result = cross_validate(model, X, y, cv=cv, scoring="roc_auc",
                        return_train_score=True)
print(result["train_score"].mean())
print(result["test_score"].mean())

Here, the cross-validation “test” scores are validation-fold scores, not the untouched final test set. Use the name that is least confusing in your own code.

Plot curves before choosing a new penalty

Validation curves

A validation curve evaluates one hyperparameter over a range of values while holding the rest of the experiment constant. Plot training and validation scores against that parameter. If validation performance improves as the penalty is relaxed and then levels off or declines, the curve identifies a useful region. If both curves remain low, changing that parameter alone is unlikely to solve the problem.

Search on a logarithmic scale rather than making tiny, arbitrary changes. A typical experiment might evaluate several orders of magnitude, but the exact range depends on the estimator, feature scale, sample size, and metric. Use the estimator’s documentation and inspect the fitted model rather than assuming a universal scale.

Learning curves

A learning curve varies the number of training examples. It helps answer a different question: whether more data could reduce the observed error. If training and validation scores converge at a low level as the sample grows, the model or features have high bias. If validation keeps improving while training remains better, additional data may help reduce variance. Keep the validation procedure fixed while generating the curve.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Curves also expose misleading conclusions from one split. Wide variation between folds or random seeds means that a small apparent improvement may not be reliable.

Relax regularization in the correct direction

“More regularization” is not represented by the same direction for every API. Verify the parameter definition in the documentation for the estimator and library version you installed.

Estimator or penalty Parameter relationship To weaken regularization Important qualification
Scikit-learn SVM C controls the trade-off; smaller C means stronger regularization Increase C SVMs are not scale invariant, so feature scaling is important
Scikit-learn logistic regression Larger C means less regularization Increase C Supported penalties and solver combinations depend on the installed release
Lasso alpha multiplies the L1 penalty Decrease alpha Very small values can increase variance and make optimization more difficult
Neural networks Dropout, weight decay, and early stopping use framework-specific controls Adjust the relevant control only after checking that framework’s documentation There is no universal numeric change that is safe across frameworks and versions

Do not assume that a parameter named “regularization strength” has the same direction as C or alpha. Some libraries expose the penalty directly; others expose its inverse or a convention-specific weight.

SVM example

For a scikit-learn support-vector classifier, compare increasing values of C while retaining the scaler in the pipeline. A larger C permits the optimizer to place more emphasis on training errors and therefore represents weaker regularization in this API. Evaluate each candidate with the same folds and metric.

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Logistic-regression example

Scikit-learn documents C as inversely related to regularization strength for logistic regression. Increase it gradually when testing whether an overly strong penalty is suppressing useful coefficients. Check that the selected solver supports the requested L1, L2, or Elastic Net penalty; defaults and supported combinations can change between releases.

Lasso and Elastic Net

Lasso uses an L1 penalty multiplied by alpha. Lowering alpha weakens that penalty. LassoCV and LassoLarsCV provide documented cross-validation approaches for selecting alpha rather than hand-picking one value.

L1 regularization can drive coefficients exactly to zero, producing a sparse model. L2 regularization shrinks coefficients toward zero without generally making them exactly zero. Elastic Net combines L1 and L2 behavior. When interpretability or feature selection matters, compare not only validation score but also the number and identity of nonzero coefficients.

Run a controlled troubleshooting sequence

  1. Freeze the evaluation protocol. Choose the metric, split strategy, random seeds, and preprocessing pipeline. Record the baseline training and validation results.
  2. Audit the data path. Check labels, target alignment, missing-value handling, feature construction, categorical encoding, and duplicate records. Confirm that the metric implementation matches the task.
  3. Confirm optimization completed. Inspect convergence warnings, iteration limits, solver status, and training logs. A model that stopped early or failed to converge can look underfit even with an appropriate penalty.
  4. Verify scale-sensitive estimators. Standardize or otherwise scale numeric inputs inside the pipeline when the estimator requires it. SVMs in particular are not scale invariant; features measured in very different units can distort the fit.
  5. Run a validation curve. Evaluate a logarithmic range of weaker and stronger settings. Keep every other choice fixed and retain fold-level results.
  6. Compare the best candidates. Consider validation score, training-to-validation gap, fold or seed stability, training cost, and model simplicity. For linear models, record coefficient sparsity when it affects use of the model.
  7. Test capacity or representation. If the best penalty still leaves both scores low, compare a richer model or add justified features. Treat this as a new controlled experiment, not as permission to remove all regularization.
  8. Lock the choice and test once. Refit the selected pipeline on the allowed training data, then evaluate it on the untouched test set. Report the test metric with the split definition and relevant uncertainty or fold history.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Check causes that look like excessive regularization

Weak or lossy features

A heavily compressed representation can impose bias that no penalty adjustment fixes. Inspect whether features contain the information available at prediction time, whether units and transformations are correct, and whether important interactions or nonlinear relationships are missing. Add complexity only when it represents a defensible signal.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Incorrect labels or noisy targets

Misaligned targets, inconsistent class definitions, and measurement noise place a ceiling on achievable validation performance. Sample several records manually, verify joins and timestamps, and measure label consistency where possible.

Scaling and preprocessing mistakes

Fit transformations on training data only. Applying a scaler or imputer to the full dataset before cross-validation leaks information; omitting required scaling can make an estimator behave as though its effective penalty were inappropriate.

Optimization and numerical problems

Convergence warnings, saturated activations, unsuitable learning rates, excessive iteration limits, and poorly conditioned features can all produce a weak training fit. Resolve these issues before interpreting a penalty curve.

Insufficient model capacity

A linear decision boundary cannot represent every relationship, regardless of how weakly it is regularized. Compare a more flexible model family or add carefully designed nonlinear features, then monitor whether the training-to-validation gap grows.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

How to decide when to stop weakening the penalty

Stop when validation performance stops improving, becomes less stable across folds or seeds, or begins to separate sharply from the training score. The best setting is not the one with the highest training score; it is the setting that delivers the best reliable validation result under the deployment-relevant split.

Prefer the simpler or more interpretable setting when scores are practically indistinguishable, especially if it produces a smaller model, fewer nonzero coefficients, faster inference, or easier auditing. A tiny validation gain that disappears across folds is not a reason to accept substantially greater variance.

Neural-network-specific caution

The same diagnosis applies to neural networks: compare training and validation curves, verify that optimization reached a useful state, and determine whether the network has enough capacity. However, dropout rates, weight decay, and early-stopping patience are framework- and version-specific. Do not apply a universal numeric prescription. Change one control at a time, consult the documentation for the framework and release you use, and keep the validation protocol fixed.

What a defensible report includes

  • The task, target definition, metric, and deployment-relevant split.
  • Training and validation scores for the baseline and selected setting.
  • The exact estimator, penalty, parameter values, preprocessing steps, and software version.
  • Fold- or seed-level variability, not only one average.
  • The reason the chosen setting is preferred, including any sparsity, interpretability, latency, or capacity trade-off.
  • A single final result on data that was not used to select the model.

If relaxing regularization improves both training and validation scores, the original penalty was plausibly too strong. If only training improves, you have moved toward overfitting. If neither improves, the evidence points away from regularization as the main bottleneck and toward data, representation, optimization, metric, split, or model-family problems.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Machine Learningmodel validationregularizationscikit-learnunderfitting

Leave a Reply

Your email address will not be published. Required fields are marked *

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Recommended PC Tool
Recommended PC Tool
Crashes, No Sound, or Screen Glitches?Free driver scan
PC Slower Than It Used to Be?Free scan - under a minute

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.