Supervised Learning: Feature Representation & Problem Formulation
Supervised Learning: Feature Representation & Problem Formulation
πΉ What is Supervised Learning?
Supervised learning involves learning a mapping:
Where:
- → input (features)
- → output (target/label)
π Given labeled data:
πΉFeature Representation
πΉ Definition
Feature representation is the process of converting raw data into a structured numerical format that a machine learning algorithm can use.
πΉ Feature Vector
Each data point is represented as:
Where:
- = number of features
π Called a feature vector
πΉTypes of Features
π¦ 1. Numerical Features
- Continuous values
- Example: height, weight
π© 2. Categorical Features
- Discrete categories
- Example: color = {red, blue, green}
π Often converted using:
- One-hot encoding
π¨ 3. Ordinal Features
- Ordered categories
- Example: low < medium < high
π₯ 4. Binary Features
- 0 or 1
- Example: spam/not spam
πΉ Feature Transformation
π Why needed?
Raw data is often not directly usable.
Common transformations:
- Normalization (scale values)
- Standardization (mean = 0, variance = 1)
- Encoding categorical variables
- Log transformation
πΉ Feature Engineering
π Creating new features from existing data
Examples:
- Age → age group
- Date → day, month, year
- Text → word counts (bag-of-words)
πΉFeature Selection
π Choosing important features
Why?
- Reduce complexity
- Improve performance
- Avoid overfitting
πΉ Feature Space
All feature vectors form:
π Called feature space
π Insight:
- Each example = point in feature space
- Learning = finding patterns in this space
πΉ Problem Formulation (Core Concept)
πΉ Goal
Learn a function:
That predicts output for new data.
πΉ Types of Supervised Problems
π¦ 1. Classification
- Output is discrete
-
Example:
- Spam / Not spam
- Disease / No disease
π© 2. Regression
- Output is continuous
-
Example:
- House price
- Temperature
πΉHypothesis Space
Set of all possible models:
π Example:
- Linear models
- Decision trees
- Neural networks
πΉLoss Function
Measures error between:
- True value
- Predicted value
Common Loss Functions:
π For Regression:
π For Classification:
- 0–1 loss
- Cross-entropy loss
πΉ Training vs Testing
- Training set → learn model
- Test set → evaluate performance
πΉ Overfitting vs Underfitting
π Overfitting
- Model memorizes data
- Poor generalization
π Underfitting
- Model too simple
- Cannot capture patterns
πΉ Generalization
π Ability to perform well on unseen data
πΉExample
π Problem: House Price Prediction
Step 1: Features
- Area
- Number of rooms
- Location
π Feature vector:
Step 2: Output
Step 3: Model
Step 4: Loss
Step 5: Learn parameters ( training )
- Using MLE or gradient descent
Step 6: testing
- Evaluate the performance
π Summary (Quick Revision)
Feature Representation:
- Converts raw data → numerical form
-
Includes:
- Feature vectors
- Encoding
- Transformation
Problem Formulation:
-
Define:
-
Input
-
Output
-
Model
- Testing (Evaluate Performance)
-
Input
Comments
Post a Comment