ML Study Hub

Home / Past papers / MLP End Term / this paper

IIT M FOUNDATION DIPLOMA AN EXAM - 22 Dec 2024

MLP End Term38 questions100 marks24 MCQ · 11 MSQ · 3 SAFoundation / Diploma / afternoon
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'], ['apple']])
    • Output Shape: (n_samples, n_categories).
    • Note: If input has mixed types (e.g., `[['apple', 3], ['banana', 1]])**, all columns are treated as categorical by default (unless specified otherwise).

      • Correct Answer for Q2: D (6) (3 categories for fruit + 3 for numbers).
  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.
      • Example: df.dropna(thresh=15) keeps rows with ≥15 non-null values.
  1. Polynomial Features

    • PolynomialFeatures(degree=d): Generates polynomial/combination features up to degree d.

      • Example (degree=2): Input: [[a], [b]] → Output: [[1, a, a²], [1, b, b²]].
      • Correct Answer for Q16: A.

B. Model Evaluation Metrics

Key Concepts:

  1. Mean Absolute Error (MAE)

    • Formula:
MAE=1n∑i=1n∣yi−y^i∣\text{MAE} = \frac{1}{n} \sum_{i=1}^n |y_i - \hat{y}_i|
  1. Accuracy, Precision, Recall, F1, ROC-AUC

    • Cross-Validation Metrics (Q14):

      • Valid for classification: roc_auc, accuracy, precision, recall, f1.
      • Invalid for regression: r2, mean_absolute_error, explained_variance.
      • Correct Answer: A (roc_auc).
  1. R² Score (score method in Linear Regression)

    • Key Insight (Q15):

      • If fit_intercept=True and data is linear, s1 = s2 (intercept doesn’t affect R² if data is centered).
      • Correct Answer: A.

C. Supervised Learning Algorithms

Key Concepts:

  1. Stochastic Gradient Descent (SGD)

    • Parameters (Q6):

      • learning_rate='constant': Fixes learning rate to eta0.
      • eta0: Initial learning rate.
    • Correct Answer: B.
  1. Decision Trees

    • Hyperparameters (Q18):

      • max_depth: Controls tree depth (higher → overfitting, lower → underfitting).
      • Effect of Decreasing max_depth: Accuracy drops (underfitting).
      • Correct Answer: B.
    • Splitting Rules (Q32):

      • Split occurs if:

        • min_samples_split ≤ samples in node.
        • min_samples_leaf ≤ samples in child nodes.
      • Correct Options: A, B, D.
  1. Random Forest

    • max_features (Q9):

      • Higher value → lower variance (trees become more similar).
      • Correct Answer: B.
  1. K-Nearest Neighbors (KNN)

    • Prediction (Q35):

      • Majority vote among n_neighbors.
      • Example: 3 neighbors with labels [0, 1, 1] → predicts 1.
      • Correct Answer: 0 (Note: The provided answer in Q35 seems incorrect; the correct prediction is 1.)
  1. Support Vector Machines (SVM)

    • Prediction vs. True Labels (Q34):

      • Accuracy = Correct Predictions / Total Predictions.
      • Example: 3/5 correct → accuracy = 0.6.
      • Correct Answer: 0.6.

D. Unsupervised Learning

Key Concepts:

  1. K-Means Clustering

    • Parameters (Q30):

      • n_clusters: Number of clusters (must be ≤ samples).
      • init: Initialization method (e.g., k-means++).
      • max_iter: Maximum iterations.
    • Outputs (Q19):

      • cluster_centers_: Coordinates of centroids.
      • inertia_: Sum of squared distances to centroids.
      • Correct Answer: D.
    • Error Handling (Q20):

      • ValueError if n_clusters > n_samples.
      • Correct Answer: C.
  1. Dimensionality Reduction (Q24)

    • Techniques:

      • PCA: Linear projection.
      • t-SNE: Non-linear, preserves local structure.
      • Lasso Regression: Feature selection via L1 regularization.
    • Correct Options: A, C, D.

E. Ensemble Methods

Key Concepts:

  1. Bagging (BaggingClassifier)

    • Parameters (Q7, Q8, Q21):

      • n_estimators: Number of base models.
      • max_samples: Fraction of samples per base model (e.g., 0.5 → 50%).
      • bootstrap: Whether to sample with replacement.
    • Correct Answers:

      • Q7: B (n_estimators = number of base learners).
      • Q8: A (max_samples = fraction of training data).
      • Q21: C (max_samples=0.5 → 50% of data per estimator).
  1. Boosting (AdaBoost, GradientBoosting)

    • Hyperparameter Tuning (Q22, Q29):

      • n_estimators: Number of boosting stages.
      • learning_rate: Shrinkage factor.
      • GridSearchCV: Exhaustively searches parameter combinations.
      • Correct Answers:

        • Q22: D (comprehensive grid for both AdaBoost and DecisionTree).
        • Q29: A, C, D (cross-validation, best params, explicit import needed).

F. Model Training & Hyperparameter Tuning

Key Concepts:

  1. Grid Search vs. Random Search (Q26)

    • RandomizedSearchCV:

      • n_iter: Number of parameter combinations to try.
      • param_distributions: Dictionary of hyperparameter distributions.
    • Correct Options: A, C, D.
  1. Partial Fit (Q25, Q28)

    • Use Cases:

      • Streaming data (cannot fit in memory).
      • Online learning.
    • Correct Answers:

      • Q25: A, C.
      • Q28: A, C, D (partial_fit allows incremental training; classes required for first call).
  1. Stratified K-Fold (Q27)

    • Preserves class distribution in splits.
    • Valid Training Sets (Q27): Must maintain class ratios.

      • Correct Options: B, D, F.

G. Neural Networks

Key Concepts:

  1. MLPClassifier/Regressor (Q11, Q31)

    • alpha: L2 regularization strength (higher → less overfitting).
    • hidden_layer_sizes:

      • Tuple specifies neurons per layer.
      • Example: (5, 3) → 2 hidden layers (5 neurons, then 3 neurons).
    • Correct Answers:

      • Q11: B (higher alpha → stronger regularization).
      • Q31: C, D.

H. Pandas Operations (Q36–Q38)

Key Concepts:

  1. Aggregations:

    • df['Sales'].sum() → Total sales.
    • df.groupby('Region')['Sales'].mean() → Average sales per region.
  2. Filtering:

    • df[df['Region'] == 'North']['Name'] → Names in North region.
  3. Sorting/Selecting:

    • df.nlargest(1, 'Sales') → Row with highest sales.
    • df.loc[df['Sales'].idxmax()] → Same as above.

2. Key Equations

ConceptEquation
MinMax ScalingXscaled=X−XminXmax−XminX_{\text{scaled}} = \frac{X - X_{\text{min}}}{X_{\text{max}} - X_{\text{min}}}
Standard ScalingXscaled=X−μσX_{\text{scaled}} = \frac{X - \mu}{\sigma}
MAEMAE=1n∑i=1n∣yi−y^i∣\text{MAE} = \frac{1}{n} \sum_{i=1}^n |y_i - \hat{y}_i|
MSEMSE=1n∑i=1n(yi−y^i)2\text{MSE} = \frac{1}{n} \sum_{i=1}^n (y_i - \hat{y}_i)^2
R² ScoreR2=1−SSresSStotR^2 = 1 - \frac{\text{SS}_{\text{res}}}{\text{SS}_{\text{tot}}}
K-Means InertiaInertia=∑i=1nmin⁡μj∣∣xi−μj∣∣2\text{Inertia} = \sum_{i=1}^n \min_{\mu_j} ||x_i - \mu_j||^2
SGD Update Ruleθ=θ−η⋅∇J(θ)\theta = \theta - \eta \cdot \nabla J(\theta)
L1/L2 RegularizationJ(θ)=Loss+α⋅PenaltyJ(\theta) = \text{Loss} + \alpha \cdot \text{Penalty}

3. Exam Tips

  1. Focus Areas:

    • Data Preprocessing: Encoding, scaling, missing data.
    • Model Evaluation: Metrics, cross-validation.
    • Algorithms: Decision trees, SVM, KNN, ensemble methods.
    • Hyperparameter Tuning: Grid search, random search.
    • Unsupervised Learning: K-means, PCA, t-SNE.
    • Pandas: Filtering, aggregation, groupby.
  1. Common Pitfalls:

    • OneHotEncoder: Defaults to treating all columns as categorical.
    • K-Means: n_clusters must be ≤ n_samples.
    • SGD: learning_rate='constant' uses fixed eta0.
    • Partial Fit: Requires classes for first call in classification.
  1. Code Snippets to Remember: ```python # OneHotEncoder (sparse=False for dense output) ohe = OneHotEncoder(sparse_output=False) ohe.fit_transform(data)

# MinMaxScaler scaler = MinMaxScaler() scaler.fit_transform(data)

# K-Means kmeans = KMeans(n_clusters=2) kmeans.fit(X) print(kmeans.cluster_centers_, kmeans.inertia_)

# GridSearchCV grid = GridSearchCV(estimator, param_grid, cv=3) grid.fit(X, y) print(grid.best_params_) ```