Artificial Intelligence & Machine Learning: Core Algorithms, Metrics & Deep Learning
With artificial intelligence driving the modern tech industry, the NSCT tests foundational machine learning concepts within its 5% AI/ML domain.
Questions avoid heavy mathematical derivations, focusing instead on model selection, performance evaluation metrics, bias-variance tradeoffs, and neural network primitives.
1. Machine Learning Paradigms
- Supervised Learning: Model trains on labeled data $(X, y)$.
- Classification (Discrete targets): Logistic Regression, Decision Trees, SVM, Naive Bayes.
- Regression (Continuous targets): Linear Regression, Polynomial Regression, Random Forest Regressor.
- Unsupervised Learning: Model identifies patterns in unlabeled data $(X)$.
- Clustering: K-Means, DBSCAN, Hierarchical Clustering.
- Dimensionality Reduction: Principal Component Analysis (PCA), t-SNE.
- Reinforcement Learning: Agent learns through trial and error using Rewards and Penalties interacting with an Environment (Q-Learning, Policy Gradients).
2. Evaluation Metrics Demystified
Understanding the Confusion Matrix is guaranteed to earn marks in NSCT:
| Predicted Positive | Predicted Negative | |
|---|---|---|
| Actual Positive | True Positive (TP) | False Negative (FN) |
| Actual Negative | False Positive (FP) | True Negative (TN) |
- Accuracy: $rac{TP + TN}{TP + TN + FP + FN}$ (Misleading for imbalanced datasets, e.g., fraud detection).
- Precision: $rac{TP}{TP + FP}$ (When model predicts positive, how often is it right? Critical when FP is costly).
- Recall (Sensitivity): $rac{TP}{TP + FN}$ (What percentage of actual positives did model capture? Critical in medical diagnosis where FN is disastrous).
- F1-Score: Harmonic mean of Precision and Recall: $2 imes rac{ ext{Precision} imes ext{Recall}}{ ext{Precision} + ext{Recall}}$.
3. The Bias-Variance Tradeoff & Overfitting
- High Bias (Underfitting): Model is too simplistic (e.g., fitting a linear line to quadratic data). High training error, high validation error.
- High Variance (Overfitting): Model memorizes training noise and fails to generalize to unseen test data. Very low training error, high validation error.
How to Prevent Overfitting:
- Regularization: $L_1$ Regularization (Lasso, leads to sparse feature weights) and $L_2$ Regularization (Ridge, penalizes large squared weights).
- Cross-Validation: $k$-fold cross validation.
- Dropout: Randomly deactivating a percentage of neurons during training in deep neural networks.
- Early Stopping: Halting training when validation loss begins to diverge upward.
4. Deep Learning Primitives
- Activation Functions:
- Sigmoid: Squashes values to $(0, 1)$. Vanishing gradient problem in deep networks.
- ReLU (Rectified Linear Unit): $f(x) = \max(0, x)$. Standard for hidden layers.
- Softmax: Converts logit vectors into a normalized probability distribution summing to 1.0 (used in multi-class classification output layer).
- Convolutional Neural Networks (CNNs): Designed for spatial/image grid data. Uses Convolutional filters and Pooling layers (Max/Average pooling).
- Recurrent Neural Networks (RNNs & LSTMs): Designed for sequential data (NLP, time-series) with memory feedback loops.
Content structured in accordance with Higher Education Commission (HEC) Computing National Curriculum, PSEB TechLift competency standards, and the 120-minute Virtual University assessment model.