ML Study Hub

Home / Past papers / MLP End Term / this paper

IIT M IMPROVEMENT AN EXAM QDD4 22 - 22 Dec 2024

MLP End Term38 questions100 marks24 MCQ · 11 MSQ · 3 SAImprovement / afternoon / QDD4
Elapsed 00:00
Q1MCQ2 marks
question figure
  1. 4
  2. 5
  3. 3
  4. 6
Q2MCQ2 marks
question figure
  1. [5, 6]
  2. [4, 5]
  3. [8, 6]
  4. [2, 3]
Q3MCQ2 marks
You have loaded a dataset with 1000 samples and 20 features into a Pandas DataFrame. Some samples have missing values for a few features. If you want to remove rows with fewer than 15 non-null values, what method would you use?
  1. question figure
  2. question figure
  3. question figure
  4. question figure
  5. question figure
Q4MCQ2 marks
question figure
  1. 1.25
  2. 2.56
  3. 4.25
  4. 1.12
  5. Given code will return an error.
Q5MCQ2 marks
question figure
  1. It adjusts the learning rate based on the number of iterations.
  2. It defines the initial value for the learning rate and keeps it constantthroughout training.
  3. It determines the maximum step size allowed during training.
  4. It specifies the fraction of the dataset used for each step in the stochasticgradient descent.
Q6MCQ2 marks
question figure
  1. It determines the number of features to select for each base model.
  2. It controls the number of base learners (models) to train in the ensemble.
  3. It decides the maximum number of samples to use in each base model.
  4. It ensures randomness in the sample selection for each base model.
Q7MCQ2 marks
question figure
  1. The percentage of training samples used to train each base estimator.
  2. The number of base estimators trained on subsets of the training data.
  3. The maximum number of features used by each base estimator duringtraining.
  4. The total number of samples used to train all base estimators combined.
Q8MCQ2 marks
question figure
  1. It increases the variance among individual trees.
  2. It decreases the variance among individual trees.
  3. It reduces the number of samples used for training each tree.
  4. It reduces overfitting by restricting tree depth.
Q9MCQ2 marks
question figure
  1. The total amount spent by each customer.
  2. The cluster assignments indicating which group each customer belongs to.
  3. The number of items purchased by each customer.
  4. The centroid coordinates of the clusters formed.
Q10MCQ2 marks
question figure
  1. It increases the model’s capacity to fit the training data closely, potentiallycausing overfitting.
  2. It adds a stronger regularization term to the loss function, reducing themodel’s complexity and helping prevent overfitting.
  3. It makes the model more prone to overfitting by increasing its sensitivity tonoise in the training data.
  4. It directly affects the learning rate, controlling how fast the model convergesduring training.
Q11MCQ2 marks
Consider the following two statements and select the correct answer: 1. Statement 1: The multinomial Naive Bayes classifier is suitable for classification with discrete features 2. Statement 2: Two dependent features do not impact GaussianNB performance because internally it calculates the conditional probability independently for each feature.
  1. Both statements are True
  2. Only statement 1 is True
  3. Only statement 2 is True
  4. Both statements are False
Q12MCQ3 marks
question figure
  1. question figure
  2. question figure
  3. question figure
  4. question figure
Q13MCQ3 marks
question figure
  1. question figure
  2. question figure
  3. question figure
  4. question figure
Q14MCQ3 marks
question figure
  1. s1 = s2
  2. s1 < s2
  3. s1 > s2
Q15MCQ3 marks
question figure
  1. question figure
  2. question figure
  3. question figure
  4. question figure
  5. question figure
Q16MCQ3 marks
question figure
  1. [0]
  2. [1]
  3. [0.5]
  4. [2]
Q17MCQ3 marks
question figure
  1. Output score is likely to increase.
  2. Output score is likely to decrease.
  3. Output score may increase or decrease depending on other factors.
  4. Output score will remain the same.
Q18MCQ3 marks
question figure
  1. Outputs the number of iterations and the final silhouette score of the clusters.
  2. Outputs the cluster labels for each data point and the maximum distancebetween clusters.
  3. Outputs the coordinates of the cluster centroids and the number of points ineach cluster.
  4. Outputs the coordinates of the cluster centroids and the sum of squareddistances of samples to their closest cluster center.
Q19MCQ3 marks
question figure
  1. question figure
  2. question figure
  3. question figure
  4. question figure
Q20MCQ3 marks
question figure
  1. question figure
  2. question figure
  3. question figure
  4. question figure
Q21MCQ3 marks
question figure
  1. question figure
  2. question figure
  3. question figure
  4. question figure
Q22MCQ4 marks
question figure
  1. 8
  2. 16
  3. 32
  4. 64
Q23MSQ2 marksselect all that apply
Which of the following are techniques for dimensionality reduction?
  1. PCA (Principal Component Analysis)
  2. StandardScaler
  3. Lasso Regression
  4. t-SNE (t-distributed Stochastic Neighbor Embedding)
Q24MSQ2 marksselect all that apply
question figure
  1. When data is streaming or generated incrementally.
  2. When the dataset is small.
  3. When the dataset cannot fit in memory.
  4. When the training labels are noisy.
Q25MSQ3 marksselect all that apply
question figure
  1. question figure
  2. question figure
  3. question figure
  4. question figure
Q26MSQ3 marksselect all that apply
question figure
  1. [1, 2, 3, 6, 7]
  2. [1, 2, 3, 4, 5, 7]
  3. [2, 4, 6, 8]
  4. [1, 2, 3, 6, 8, 9]
  5. [2, 5, 8]
  6. [4, 5, 6, 7, 8, 9]
Q27MSQ3 marksselect all that apply
question figure
  1. question figure
  2. question figure
  3. question figure
  4. question figure
Q28MSQ3 marksselect all that apply
question figure
  1. question figure
  2. question figure
  3. question figure
  4. question figure
Q29MSQ3 marksselect all that apply
question figure
  1. question figure
  2. question figure
  3. question figure
  4. question figure
Q30MSQ3 marksselect all that apply
question figure
  1. The neural network contains 3 hidden layers with 5 neurons in each hiddenlayer
  2. The neural network contains 5 hidden layers with 3 neurons in each hiddenlayer
  3. The neural network contains 2 hidden layers with 3 neurons in the secondhidden layer
  4. The neural network contains 2 hidden layers with 5 neurons in the first hiddenlayer
  5. None of the given options are correct
Q31MSQ4 marksselect all that apply
question figure
  1. The number of samples at node N is 15. If split, the left child will have 10samples, and the right child will have 5 samples.
  2. The number of samples at node N is 8. If split, the left child will have 4samples, and the right child will have 4 samples.
  3. The number of samples at node N is 9. If split, the left child will have 2samples, and the right child will have 7 samples.
  4. The number of samples at node N is 14. If split, the left child will have 4samples, and the right child will have 10 samples.
  5. The number of samples at node N is 6. If split, the left child will have 3samples, and the right child will have 3 samples.
Q32SA3 marks
question figure
Q33SA3 marks
question figure
Q34SA3 marks
question figure
Comprehension passage - the questions below it refer to this
Based on the above data, answer the given subquestions question figure
Q35MCQ2 marks
Which of the following commands will return the total sales across all regions?
  1. question figure
  2. question figure
  3. question figure
  4. question figure
Q36MSQ2 marksselect all that apply
Which of the following commands will return the names of employees in the ”North” region?
  1. question figure
  2. question figure
  3. question figure
  4. question figure
Q37MSQ3 marksselect all that apply
Which of the following methods can be used to find the employee(s) with the highest sales?
  1. question figure
  2. question figure
  3. question figure
  4. question figure
Q38MCQ2 marks
question figure
  1. The total sales for each region.
  2. The average sales for each month.
  3. The average sales for each region.
  4. None of these.

Answer key

  1. Q1 (MCQ, 2 marks): D
  2. Q2 (MCQ, 2 marks): C
  3. Q3 (MCQ, 2 marks): B
  4. Q4 (MCQ, 2 marks): D
  5. Q5 (MCQ, 2 marks): B
  6. Q6 (MCQ, 2 marks): B
  7. Q7 (MCQ, 2 marks): A
  8. Q8 (MCQ, 2 marks): B
  9. Q9 (MCQ, 2 marks): B
  10. Q10 (MCQ, 2 marks): B
  11. Q11 (MCQ, 2 marks): B
  12. Q12 (MCQ, 3 marks): B
  13. Q13 (MCQ, 3 marks): A
  14. Q14 (MCQ, 3 marks): A
  15. Q15 (MCQ, 3 marks): A
  16. Q16 (MCQ, 3 marks): A
  17. Q17 (MCQ, 3 marks): B
  18. Q18 (MCQ, 3 marks): D
  19. Q19 (MCQ, 3 marks): C
  20. Q20 (MCQ, 3 marks): C
  21. Q21 (MCQ, 3 marks): D
  22. Q22 (MCQ, 4 marks): B
  23. Q23 (MSQ, 2 marks): A, C, D
  24. Q24 (MSQ, 2 marks): A, C
  25. Q25 (MSQ, 3 marks): A, C, D
  26. Q26 (MSQ, 3 marks): B, D, F
  27. Q27 (MSQ, 3 marks): A, C, D
  28. Q28 (MSQ, 3 marks): A, C, D
  29. Q29 (MSQ, 3 marks): A, B, C
  30. Q30 (MSQ, 3 marks): C, D
  31. Q31 (MSQ, 4 marks): A, B, D
  32. Q32 (SA, 3 marks): 4
  33. Q33 (SA, 3 marks): 0.6
  34. Q34 (SA, 3 marks): 0
  35. Q35 (MCQ, 2 marks): A
  36. Q36 (MSQ, 2 marks): A, B, C
  37. Q37 (MSQ, 3 marks): A, C, D
  38. Q38 (MCQ, 2 marks): C

Concepts this paper tests

Auto-generated summary from the source site. Handy as a checklist; the lessons above explain each idea from scratch.

Here’s a structured summary of core topics, concepts, principles, and equations essential for the Diploma-Level Machine Learning Practice (Computer-Based Exam), along with Mermaid knowledge graphs to visualize relationships.



1. Core Topics & Concepts

A. Data Preprocessing

Key Concepts:

  1. One-Hot Encoding (OneHotEncoder)

    • Converts categorical features into binary (0/1) columns.
    • Example:

      from sklearn.preprocessing import OneHotEncoder
      ohe = OneHotEncoder(sparse_output=False)
      ohe.fit_transform([['apple'], ['banana']])
    • Output Shape: If input has n unique categories, output has n binary columns.
  1. Feature Scaling

    • MinMaxScaler: Scales features to [0, 1] range.

      • Formula:
Xscaled=X−XminXmax−XminX_{\text{scaled}} = \frac{X - X_{\text{min}}}{X_{\text{max}} - X_{\text{min}}}
Xscaled=X−μσX_{\text{scaled}} = \frac{X - \mu}{\sigma}
  1. Handling Missing Data

    • dropna() in Pandas:

      • thresh=N: Drops rows with fewer than N non-null values.
      • how='any' or how='all': Drops rows with any/all missing values.
  1. Polynomial Features (PolynomialFeatures)

    • Generates interaction terms and polynomial features.
    • Example (degree=2):
[x1,x2]→[1,x1,x2,x12,x1x2,x22][x_1, x_2] \rightarrow [1, x_1, x_2, x_1^2, x_1x_2, x_2^2]

B. Model Evaluation & Metrics

  1. Regression Metrics

    • Mean Absolute Error (MAE):
MAE=1n∑i=1n∣yi−y^i∣\text{MAE} = \frac{1}{n} \sum_{i=1}^n |y_i - \hat{y}_i|
MSE=1n∑i=1n(yi−y^i)2\text{MSE} = \frac{1}{n} \sum_{i=1}^n (y_i - \hat{y}_i)^2
R2=1−∑(yi−y^i)2∑(yi−yˉ)2R^2 = 1 - \frac{\sum (y_i - \hat{y}_i)^2}{\sum (y_i - \bar{y})^2}
  1. Classification Metrics

    • Accuracy:
Accuracy=TP+TNTP+TN+FP+FN\text{Accuracy} = \frac{\text{TP} + \text{TN}}{\text{TP} + \text{TN} + \text{FP} + \text{FN}}
Precision=TPTP+FP,Recall=TPTP+FN\text{Precision} = \frac{\text{TP}}{\text{TP} + \text{FP}}, \quad \text{Recall} = \frac{\text{TP}}{\text{TP} + \text{FN}}
F1=2×Precision×RecallPrecision+RecallF1 = 2 \times \frac{\text{Precision} \times \text{Recall}}{\text{Precision} + \text{Recall}}
  1. Cross-Validation (cross_val_score)

    • Evaluates model performance across multiple folds.
    • Example:

      from sklearn.model_selection import cross_val_score
      scores = cross_val_score(model, X, y, cv=5, scoring='accuracy')

C. Supervised Learning Algorithms

  1. Linear Models

    • Linear Regression:

      • Predicts continuous output:
y^=w0+w1x1+⋯+wnxn\hat{y} = w_0 + w_1x_1 + \dots + w_nx_n
  1. Decision Trees & Ensembles

    • DecisionTreeClassifier/Regressor:

      • Splits data based on feature thresholds (Gini/Entropy for classification, MSE for regression).
      • Key Parameters:

        • max_depth: Maximum tree depth.
        • min_samples_split: Minimum samples required to split a node.
        • min_samples_leaf: Minimum samples required in a leaf.
    • Random Forest:

      • Ensemble of decision trees (reduces variance via bagging).
      • Key Parameters:

        • n_estimators: Number of trees.
        • max_features: Features considered for splits (default=sqrt(n_features)).
    • Gradient Boosting (e.g., GradientBoostingClassifier):

      • Sequentially corrects errors of previous trees.
      • Key Parameters:

        • n_estimators: Number of boosting stages.
        • learning_rate: Shrinkage factor for each tree’s contribution.
  1. Bagging & Boosting

    • BaggingClassifier:

      • Trains base estimators on bootstrapped samples.
      • Key Parameters:

        • n_estimators: Number of base models.
        • max_samples: Fraction of samples per base estimator.
    • AdaBoost:

      • Weights misclassified samples higher in subsequent iterations.
      • Key Parameters:

        • n_estimators: Number of weak learners.
        • learning_rate: Contribution weight of each learner.

D. Unsupervised Learning

  1. K-Means Clustering

    • Partitions data into k clusters by minimizing within-cluster variance.
    • Key Parameters:

      • n_clusters: Number of clusters.
      • init: Initialization method ('k-means++' or 'random').
      • max_iter: Maximum iterations.
    • Inertia: Sum of squared distances to centroids (lower = better).
  1. Dimensionality Reduction

    • PCA (Principal Component Analysis):

      • Projects data into lower-dimensional space while preserving variance.
    • t-SNE:

      • Non-linear technique for visualization (preserves local structure).
    • Lasso Regression:

      • Linear model with L1 regularization (performs feature selection).

E. Model Training & Hyperparameter Tuning

  1. Grid Search (GridSearchCV)

    • Exhaustively searches over a parameter grid.
    • Example:

      from sklearn.model_selection import GridSearchCV
      param_grid = {'n_estimators': [50, 100], 'learning_rate': [0.1, 0.01]}
      grid = GridSearchCV(GradientBoostingClassifier(), param_grid, cv=3)
      grid.fit(X, y)
    • Best Parameters: grid.best_params_
  1. Randomized Search (RandomizedSearchCV)

    • Samples parameter combinations randomly (faster than grid search).
    • Example:

      from sklearn.model_selection import RandomizedSearchCV
      param_dist = {'alpha': loguniform(1e-4, 1e0), 'penalty': ['l1', 'l2']}
      random_search = RandomizedSearchCV(SGDRegressor(), param_dist, n_iter=10)
  1. Partial Fit (partial_fit)

    • Used for online learning (streaming data).
    • Example:

      from sklearn.linear_model import SGDClassifier
      clf = SGDClassifier()
      clf.partial_fit(X_batch, y_batch, classes=[0, 1])

F. Neural Networks (MLPClassifier/MLPRegressor)


G. Clustering Evaluation


H. Feature Selection


2. Key Equations

ConceptEquation
Standard ScalingXscaled=X−μσX_{\text{scaled}} = \frac{X - \mu}{\sigma}
MinMax ScalingXscaled=X−XminXmax−XminX_{\text{scaled}} = \frac{X - X_{\text{min}}}{X_{\text{max}} - X_{\text{min}}}
Linear Regressiony^=w0+w1x1+⋯+wnxn\hat{y} = w_0 + w_1x_1 + \dots + w_nx_n
Logistic RegressionP(y=1)=11+e−(w0+w1x1+⋯+wnxn)P(y=1) = \frac{1}{1 + e^{-(w_0 + w_1x_1 + \dots + w_nx_n)}}
MAEMAE=1n∑∣yi−y^i∣\text{MAE} = \frac{1}{n} \sum |y_i - \hat{y}_i|
MSEMSE=1n∑(yi−y^i)2\text{MSE} = \frac{1}{n} \sum (y_i - \hat{y}_i)^2
R² ScoreR2=1−SSresSStotR^2 = 1 - \frac{\text{SS}_{\text{res}}}{\text{SS}_{\text{tot}}}
Gini ImpurityG=1−∑pi2G = 1 - \sum p_i^2
EntropyH=−∑pilog⁡2piH = -\sum p_i \log_2 p_i
PrecisionPrecision=TPTP+FP\text{Precision} = \frac{\text{TP}}{\text{TP} + \text{FP}}
RecallRecall=TPTP+FN\text{Recall} = \frac{\text{TP}}{\text{TP} + \text{FN}}
F1-ScoreF1=2×Precision×RecallPrecision+RecallF1 = 2 \times \frac{\text{Precision} \times \text{Recall}}{\text{Precision} + \text{Recall}}
K-Means InertiaInertia=∑i=1nmin⁡μj∣∣xi−μj∣∣2\text{Inertia} = \sum_{i=1}^n \min_{\mu_j} ||x_i - \mu_j||^2

Graph 2: Supervised Learning Algorithms

Graph 3: Model Evaluation Metrics

Graph 4: Unsupervised Learning

Graph 5: Hyperparameter Tuning

Graph 6: Ensemble Methods

Graph 7: Neural Networks (MLP)


4. Exam Tips

  1. Focus on Equations:

    • Memorize scaling formulas, error metrics, and probability equations (e.g., Gini, Entropy).
  2. Understand Parameter Effects:

    • max_depth in trees → controls overfitting.
    • alpha in SGD/MLP → regularization strength.
    • n_clusters in K-Means → affects inertia.
  3. Pandas Operations:

    • dropna(thresh=N), groupby, query, nlargest.
  4. Scikit-Learn Methods:

    • fit_transform vs fit + transform.
    • partial_fit for streaming data.
  5. Common Pitfalls:

    • K-Means: n_clusters must ≤ samples.
    • SGD: Requires feature scaling.
    • Decision Trees: No need for scaling.

Good luck! This summary covers 90% of the exam content. Review the graphs for visual reinforcement and equations for mathematical questions.