Hyperparameter in Machine Learning: Definition, Typen & Tuning-Methoden

Hyperparameters in Machine Learning: Definition, Types & Tuning Methods

Hyperparameters control how a machine learning model is trained – before training even begins. Unlike model parameters, such as weights or bias terms in neural networks, they are not learned from the training data. Data scientists define them beforehand to control the learning strategy, architecture, and regularization. The choice of the right hyperparameters significantly determines how accurately and stably a model performs on new data.

What are Hyperparameters?

Hyperparameters are configuration parameters defined before an ML model's training begins. They set the conditions under which the model learns. Model parameters, on the other hand – such as weights in neural networks – emerge only during training from the data. Hyperparameters remain unchanged throughout this process; they are control variables, not learning outcomes.

What types of hyperparameters are there?

Depending on the model type, several groups can be distinguished:

Architecture Hyperparameters concern the structural design of a model, for example, the number of layers in a neural network or the number of neurons per layer.

Optimization Hyperparameters control the learning process itself. The learning rate determines how much weights are adjusted at each training step. The batch size determines how many examples are processed per iteration.

Regularization Hyperparameters control model capacity. Dropout rates counteract overfitting. L1 and L2 regularization add penalty terms for large weight values. Too little regularization causes the model to overreact to training data; too much regularization ignores relevant relationships.

Feature-Related Hyperparameters concern the number and selection of input features that define the data basis for training.

Practical Examples and Use Cases

The range of hyperparameters varies significantly depending on the algorithm. In neural networks, the learning rate is a central hyperparameter. In Support Vector Machines, the kernel size plays a comparable role. For XGBoost, learning_rate, n_estimators (also num_boost_rounds), max_depth, min_child_weight and subsample are among the particularly relevant adjustable parameters. These examples show that hyperparameters take on different functions depending on the algorithm.

How does hyperparameter tuning work?

Hyperparameter tuning – also known as hyperparameter optimization – refers to the process of systematically identifying suitable hyperparameter values. The approach is experimental: In iterative steps, different combinations are tested and evaluated based on an objective function, for example, by minimizing the loss function. The results are typically verified using cross-validation to ensure generalizability to new datasets.

Several methods are available for tuning:

     
  • Grid Search: Every possible hyperparameter combination is systematically tested.
  •  
  • Randomized Search: Instead of discrete values, statistical distributions are used to sample and test combinations.
  •  
  • Bayesian Optimization: The selection of the next test combination is done sequentially using a model-based approach.
  •  
  • AutoML: Automated approaches take over the tuning process without manual intervention.

Well-chosen hyperparameters help balance the trade-off between underfitting (bias) and overfitting (variance).

Conclusion

Hyperparameters are not minor factors in the ML process – they determine the conditions under which a model learns and how well it generalizes to unseen data. Structured hyperparameter tuning can specifically improve model performance and stability. Methods like Grid Search, Randomized Search, or Bayesian Optimization offer systematic, albeit varying in complexity, approaches for this.