1.12 Model, Parameters, Hyperparameters
1) Model in Machine Learning
- A model is a mathematical function that learns patterns from data and makes predictions.
- It defines the relationship between input (features) and output (target).
- General form:
Where:
-
x = input features
-
y = predicted output
-
f = model
Example 1: Linear Regression
Model equation:
It predicts a continuous value.
Example 2: Logistic Regression : Predicts probability for classification.
Example 3: Decision Tree : Uses if-else conditions to make predictions.
Model = Mathematical structure used to represent data relationships.
2) Parameters
- Parameters are internal values of the model that are learned from training data.
- They are automatically adjusted during training to reduce error.
Example 1: Linear Regression
Parameters:
-
w (weight or slope)
-
b (bias or intercept)
These are calculated from data.
Example 2: Neural Network
Parameters:
-
Weights between neurons
-
Bias terms
These are updated using backpropagation.
Example 3: Decision Tree
Parameters:
-
Split thresholds
-
Selected features for splitting
Parameters are learned during training.
3) Hyperparameters
- Hyperparameters are external settings chosen before training.
- They control how the model learns but are not learned from data.
Example 1: Decision Tree
Hyperparameters:
-
Maximum depth
-
Minimum samples per leaf
-
Splitting criterion (gini or entropy)
Example 2: Neural Network
Hyperparameters:
-
Learning rate
-
Number of hidden layers
-
Number of neurons
-
Batch size
-
Number of epochs
Example 3: K-Nearest Neighbors (KNN)
Hyperparameter:
-
Value of K
Hyperparameters are tuned manually or using techniques like grid search or cross-validation.
Model = Recipe
-
Parameters = Ingredients quantities adjusted while cooking
-
Hyperparameters = Oven temperature and cooking time