Encyclopedia ( Tech, Gadgets, Science )

Hyperparameters

📌 Definition

Hyperparameters are the external configuration settings of a machine learning model that are set before training begins. They are not learned from the data directly (unlike model parameters such as weights and biases).

Instead, hyperparameters control the learning process and determine how the model is trained.


🔑 Examples of Hyperparameters

  1. Learning-related hyperparameters
    • Learning Rate (η\etaη) → size of each step in Gradient Descent.
    • Batch Size → number of training examples used in one iteration.
    • Number of Epochs → how many times the entire dataset is passed through the model.
  2. Model-related hyperparameters
    • Number of Layers & Neurons in a Neural Network.
    • Activation Functions (ReLU, sigmoid, tanh).
    • Dropout Rate (for regularization).
    • Kernel size / filters in CNNs.
  3. Algorithm-specific hyperparameters
    • K in K-Nearest Neighbors (KNN).
    • Depth of trees in Decision Trees / Random Forests.
    • Regularization strength (λ, C) in Logistic Regression or SVM.

⚖️ Difference Between Parameters and Hyperparameters

AspectParametersHyperparameters
Learned from Data?✅ Yes (during training)❌ No (set before training)
ExamplesWeights, BiasesLearning Rate, Batch Size, # of Layers
Adjusted ByTraining processHuman or automated tuning
ImpactDefines model’s predictionDefines how model is trained

🎯 Why Hyperparameters Matter?

  • They control model performance (accuracy, speed, generalization).
  • Poor choices → overfitting, underfitting, or very slow training.
  • Correct tuning → balanced, efficient, high-performing model.

🔍 Hyperparameter Tuning Methods

  1. Manual Search → trial & error, expert intuition.
  2. Grid Search → try all combinations from a predefined set (exhaustive but costly).
  3. Random Search → randomly pick values from ranges (faster & often effective).
  4. Bayesian Optimization → uses probability to guide search for best values.
  5. AutoML Tools (like Google AutoML, Optuna, Hyperopt) → automate the process.

💡 Analogy:
Training a model is like baking a cake 🍰:

  • Ingredients (flour, sugar) = training data.
  • Final taste = trained model performance.
  • Parameters = how much sugar the cake actually contains after mixing.
  • Hyperparameters = oven temperature, baking time, mixing speed → you set these before baking, and they affect the final outcome.

Also Check them

More Terms