Part A: Short Answer Questions
Course - Machine Learning Algorithms (21CSC555J)
Assessment Tier - Part-A University Question Bank
Mark Weightage - 2 Marks per Question
Question 1 (2 Marks)
Question Statement
Describe the independent and dependent variable with example? (2 Marks)
Solution 1 (2 Marks)
- Independent Variable (): The input, predictor, or explanatory feature manipulated or observed to measure its effect. It is assumed to be exogenous and error-free.
- Dependent Variable (): The outcome, response, or target variable whose variation is modeled and predicted as a function of .
- Mathematical Model: .
- Example: In house price prediction, the living area in square feet () is the independent variable, while the selling price in dollars () is the dependent variable.
Question 2 (2 Marks)
Question Statement
Define the logistic regression with mathematical notation? (2 Marks)
Solution 2 (2 Marks)
Logistic Regression is a supervised classification algorithm that models the posterior probability of a binary categorical outcome via the Sigmoid (logistic) function:
where:
- is the weight vector, is the bias term.
- represents the log-odds (logit).
- Output satisfies Kolmogorov's probability axioms.
Question 3 (2 Marks)
Question Statement
Define Variance and Bias? (2 Marks)
Solution 3 (2 Marks)
Given an estimator trained on dataset predicting true target :
- Bias: The systematic error caused by overly simplistic assumptions in the model, measuring how far the average prediction deviates from the true target: (High bias leads to Underfitting).
- Variance: The sensitivity of the model to fluctuations in the training dataset, measuring how much predictions scatter around their mean across different training draws: (High variance leads to Overfitting).
Question 4 (2 Marks)
Question Statement
Explain the ROC curve with neat diagram? (2 Marks)
Solution 4 (2 Marks)
The Receiver Operating Characteristic (ROC) curve evaluates classifier performance across all decision thresholds :
- Y-Axis: True Positive Rate ().
- X-Axis: False Positive Rate ().
- Area Under the Curve (AUC): Measures threshold-independent ranking capability. An represents a flawless classifier, while represents random coin-toss guessing.
Question 5 (2 Marks)
Question Statement
How to find the Optimised threshold for output probability? (2 Marks)
Solution 5 (2 Marks)
The default classification threshold is often suboptimal under class imbalance or asymmetric misclassification costs. The optimized threshold is determined via:
- Youden's Statistic (ROC Optimization): Maximizes the vertical distance from the chance diagonal:
- Precision-Recall Optimization: Maximizes the harmonic mean: .
- Cost-Sensitive Utility Matrix: Minimizes expected business cost:
Question 6 (2 Marks)
Question Statement
Define Gini Index with mathematical notation? (2 Marks)
Solution 6 (2 Marks)
The Gini Impurity (Index) measures the probability that a randomly chosen element from a dataset would be incorrectly labelled if it were randomly labelled according to the class distribution in the subset:
where:
- is the total number of classes.
- is the relative frequency of class in set .
- Bounds: For binary classification, . A pure node has , while a maximally impure node ( split) has .
Question 7 (2 Marks)
Question Statement
Signify the importance of non-linear machine learning models used in supervised classification. (2 Marks)
Solution 7 (2 Marks)
- Failure of Linear Separability: Real-world datasets (e.g., XOR patterns, concentric distributions, gene expression profiles) cannot be separated by an affine hyperplane (). Linear models suffer from severe high bias (underfitting) on such data.
- Expressive Capacity: Non-linear models (Decision Trees, Kernel Support Vector Machines, Random Forests, Multi-Layer Perceptrons) learn complex, curved, multi-modal decision boundaries without requiring manual polynomial feature expansion, capturing intricate feature interactions automatically.
Question 8 (2 Marks)
Question Statement
Differentiate bagging and boosting technique in machine learning model. (2 Marks)
Solution 8 (2 Marks)
| Dimension | Bagging (Bootstrap Aggregating) | Boosting |
|---|---|---|
| Model Building | Base learners are trained in parallel and independently. | Base learners are trained sequentially and adaptively. |
| Target Error | Primarily reduces Variance (stabilizes overfitted models). | Primarily reduces Bias (strengthens weak learners). |
| Sample Weighting | Equal, unweighted random bootstrap sampling (). | Misclassified samples receive increased weights iteratively. |
| Example | Random Forest, Bagged Decision Trees | AdaBoost, Gradient Boosting, XGBoost |
Question 9 (2 Marks)
Question Statement
Write the assumptions of Naïve Bayes classifier? (2 Marks)
Solution 9 (2 Marks)
- Class-Conditional Independence Assumption (Core Mandate): Every pair of features is mutually independent given the class label :
- Equal Feature Influence: All attributes contribute equally and independently to the final posterior probability in log-space.
Question 10 (2 Marks)
Question Statement
List the distance measures used in machine learning model. (2 Marks)
Solution 10 (2 Marks)
For two vectors :
- Euclidean Distance ( Norm): (straight-line distance).
- Manhattan Distance ( Norm): (grid / taxicab distance).
- Minkowski Distance ( Norm): .
- Cosine Distance: (measures angular orientation, invariant to magnitude).
Question 11 (2 Marks)
Question Statement
Write the short notes on classification with example? (2 Marks)
Solution 11 (2 Marks)
- Definition: Classification is a supervised learning task where an algorithm learns a mapping function from input feature vectors to discrete categorical target labels .
- Types: Binary (two classes, e.g., Spam vs. Ham), Multi-Class (more than two mutually exclusive classes, e.g., Disease Subtypes), and Multi-Label (classes can co-occur).
- Example: Credit card fraud detection, where transactions are classified into discrete outcomes: or .
Question 12 (2 Marks)
Question Statement
What cost function is used for evaluating the loss of the logistic regression model? (2 Marks)
Solution 12 (2 Marks)
The cost function used in Logistic Regression is the Binary Cross-Entropy Loss (Log Loss), derived via Maximum Likelihood Estimation (MLE):
where and .
- Why not Mean Squared Error (MSE)? When combined with the non-linear sigmoid function, MSE generates a non-convex surface plagued by multiple suboptimal local minima. Cross-entropy guarantees a strictly convex surface with a unique global minimum.
Question 13 (2 Marks)
Question Statement
What is Overfitting and Underfitting? (2 Marks)
Solution 13 (2 Marks)
- Underfitting (High Bias, Low Variance): The model is overly simplistic and incapable of capturing the underlying data structure. It exhibits high training error and high validation error ().
- Overfitting (Low Bias, High Variance): The model is overly complex and memorizes noise, outliers, and idiosyncratic artifacts of the training set. It exhibits near-zero training error but high validation error ().
Question 14 (2 Marks)
Question Statement
State the Kappa Statistics to measure the model performance. (2 Marks)
Solution 14 (2 Marks)
Cohen's Kappa () measures inter-rater or model-to-ground-truth agreement for categorical items, correcting for agreement that occurs purely by chance:
where:
- : Observed accuracy (proportion of agreed instances, ).
- : Expected hypothetical probability of chance agreement based on marginal totals.
- Interpretation: indicates chance agreement; indicates substantial agreement; indicates near-perfect agreement. It is vastly superior to raw accuracy on imbalanced datasets.
Question 15 (2 Marks)
Question Statement
Define Up Sampling and Down Sampling? (2 Marks)
Solution 15 (2 Marks)
Data-level resampling techniques to rectify class imbalance:
- Up-Sampling (Over-sampling): Increases the number of minority class instances to match the majority class. Techniques include random duplication or synthetic feature interpolation using SMOTE (Synthetic Minority Over-sampling Technique).
- Down-Sampling (Under-sampling): Decreases the number of majority class instances by randomly or deterministically removing instances (e.g., NearMiss, Tomek Links) to match the minority count.
Question 16 (2 Marks)
Question Statement
How decision tree handles the overfitting? (2 Marks)
Solution 16 (2 Marks)
Decision trees control overfitting via two mechanisms:
- Pre-Pruning (Early Stopping): Stops tree growth during training if constraint thresholds are reached (e.g., setting
max_depth,min_samples_split,min_samples_leaf, ormax_leaf_nodes). - Post-Pruning (Cost-Complexity Pruning): Grows the tree to full depth, then collapses non-critical branches bottom-up using a complexity penalty:
Question 17 (2 Marks)
Question Statement
What is ensemble learning and write the types? (2 Marks)
Solution 17 (2 Marks)
- Ensemble Learning: An algorithmic meta-paradigm that combines predictions from multiple diverse base models (weak learners) to produce a unified model with superior predictive accuracy and generalization.
- Primary Types:
- Bagging (Bootstrap Aggregation): Parallel independent training (e.g., Random Forest).
- Boosting: Sequential adaptive error correction (e.g., AdaBoost, XGBoost, LightGBM).
- Stacking (Stacked Generalization): Training a meta-model on predictions of diverse base classifiers.
- Voting: Aggregating outputs via hard (majority) or soft (average probability) voting.
Question 18 (2 Marks)
Question Statement
Signify the advantages of random forest technique. (2 Marks)
Solution 18 (2 Marks)
- Immunity to Overfitting: Adding more trees monotonically stabilizes variance without increasing generalization error.
- Decorrelation of Trees: Random feature subspacing () ensures individual trees do not split on the same dominant features, driving variance down.
- Built-in Out-of-Bag (OOB) Validation: Provides an unbiased internal error estimate without requiring a separate validation holdout split.
- Automatic Feature Importance: Quantifies variable contribution via Mean Decrease in Impurity (MDI).
Question 19 (2 Marks)
Question Statement
Define KNN model with example? (2 Marks)
Solution 19 (2 Marks)
- Definition: K-Nearest Neighbors (KNN) is an instance-based, non-parametric lazy learning algorithm. It stores all training instances in memory and classifies a new sample based on the majority class among its closest neighbors in feature space:
- Example: Classifying a fruit by weight () and color score (). If its closest neighbors are , it is classified as an Apple.
Question 20 (2 Marks)
Question Statement
What are the types of naïve bayes classifier? (2 Marks)
Solution 20 (2 Marks)
- Gaussian Naïve Bayes: Assumes real-valued continuous features follow a normal Gaussian distribution:
- Multinomial Naïve Bayes: Models discrete word count frequencies / term occurrence counts in text documents.
- Bernoulli Naïve Bayes: Models binary boolean feature vectors () representing the presence or absence of words.
Question 21 (2 Marks)
Question Statement
Difference between Supervised and Unsupervised Learning with examples? (2 Marks)
Solution 21 (2 Marks)
| Dimension | Supervised Learning | Unsupervised Learning |
|---|---|---|
| Training Data | Labelled pairs: | Unlabelled feature vectors: |
| Objective | Learn mapping to predict unseen targets | Discover intrinsic patterns, clusters, or latent manifold structures |
| Feedback | Explicit loss evaluation against ground truth | Internal heuristic criteria (inertia, reconstruction error) |
| Examples | Linear Regression, SVM, Random Forest, Logistic Regression | K-Means Clustering, PCA, Isolation Forest, Autoencoders |
Question 22 (2 Marks)
Question Statement
Define Recall and Precision (2 Marks)
Solution 22 (2 Marks)
From a binary confusion matrix:
- Precision: The proportion of predicted positive instances that were truly positive (measures accuracy of positive alerts):
- Recall (Sensitivity / True Positive Rate): The proportion of actual positive instances that were successfully identified (measures coverage of the positive class):
Question 23 (2 Marks)
Question Statement
What is Data imbalance and how it affects the model performance? (2 Marks)
Solution 23 (2 Marks)
- Definition: A severe disparity in class frequencies where the majority class vastly outnumbers the minority class (e.g., healthy, diseased).
- Adverse Impacts:
- Accuracy Paradox: A trivial classifier predicting the majority class for all instances achieves accuracy while detecting of minority targets.
- Decision Boundary Drift: Cost functions treat all errors equally, causing decision boundaries to collapse toward the minority class.
Question 24 (2 Marks)
Question Statement
Difference between the adaboost and gradient boosting (2 Marks)
Solution 24 (2 Marks)
| Feature | AdaBoost (Adaptive Boosting) | Gradient Boosting (GBM / XGBoost) |
|---|---|---|
| Error Handling | Adjusts sample weights; difficult misclassified points receive higher weights. | Fits base learners directly to the negative gradient (pseudo-residuals) of the loss. |
| Loss Flexibility | Restricted primarily to Exponential Loss (). | Generalizes to arbitrary differentiable loss functions (MSE, Huber, Log-Loss). |
| Base Estimator | Typically shallow single-split decision stumps (depth 1). | Deeper regression trees (typically depth 3 to 6). |
Question 25 (2 Marks)
Question Statement
Define Bayes Theorem (2 Marks)
Solution 25 (2 Marks)
Bayes' Theorem mathematically inverts conditional probabilities to update prior belief upon observing evidence:
where:
- : Posterior probability (hypothesis given evidence ).
- : Likelihood of observing evidence given hypothesis .
- : Prior probability of hypothesis .
- : Marginal probability of evidence (normalization constant).
Question 26 (2 Marks)
Question Statement
What are the various steps involved in building a machine learning model? (2 Marks)
Solution 26 (2 Marks)
- Problem Formulation: Define business objectives, prediction target, and evaluation metric.
- Data Ingestion & Cleaning: Handle missing values, outliers, and duplicates.
- Exploratory Data Analysis (EDA): Assess distributions, skewness, and correlations.
- Feature Engineering & Preprocessing: Encode categorical variables, scale numerical features, train/test split.
- Model Selection & Training: Fit candidate baseline and ensemble models.
- Hyperparameter Optimization & Validation: Tune parameters via stratified cross-validation.
- Model Evaluation & Deployment: Audit on out-of-sample test set; deploy via API with continuous monitoring.
Examiner's Note
Ensure all definitions provide exact mathematical formulas (Sigmoid, Cross-Entropy, Cohen's Kappa, Gini Index, Bayes' Theorem) to secure full rubric points.