Classification is used when you want to categorize data into different classes or groups. Classification is used when the output is a label instead of a continuous value.
How it Works
Classification models learn decision boundaries that separate one class from another. Using activation functions such as
- Sigmoid: Used in binary classification to map outputs between 0 and 1 as a probability.
- Softmax: Used in multi-class classification to convert scores into probabilities that sum to 1.
The class with the highest probability is selected as the final prediction.
Loss Functions
- Binary Cross-Entropy (Log Loss): Used for binary classification; measures the error between predicted probability and actual class (0 or 1).
- Categorical Cross-Entropy: Used for multi-class classification; compares predicted probability distribution with the true one-hot encoded class.
- Sparse Categorical Cross-Entropy: Similar to categorical cross-entropy but works directly with integer class labels instead of one-hot vectors.
- Hinge Loss: Common in Support Vector Machines (SVM) penalizes predictions that fall on the wrong side of the margin.
Types of Classification Models
- Binary Classification: Handles two classes.
- Multi-Class Classification: Used when there are more than two classes
Classification Algorithms
- Logistic Regression: Linear model used for binary and multi-class classification.
- Support Vector Machine: Finds the best hyperplane to separate classes.
- k-Nearest Neighbors: Classifies based on the closest neighboring points.
- Naive Bayes: Probabilistic classifier based on Bayes᎙ theorem with independence assumptions.
- Decision Tree: Splits data using decision rules to classify samples.
- Random Forest: Ensemble of multiple decision trees for better accuracy and stability.
Applications
- Email Filtering: Classifies emails as spam or not spam.
- Medical Diagnosis: Identifies diseases such as tumor vs no tumor.
- Image Recognition: Detects objects like cats, dogs, vehicles, etc.
- Sentiment Analysis: Classifies reviews as positive, negative or neutral.
- f***d Detection: Flags suspicious transactions in banking systems.
- Customer Segmentation: Groups users based on behavior for targeted marketing.
