ML Study Hub

Home / Past papers / MLP End Term / this paper

IIT M DIPLOMA ET1 EXAM QPD1 S2 30 Apr 2023 - 30 Apr 2023

MLP End Term36 questions100 marks26 MCQ · 9 MSQ · 1 SADiploma / QPD1
Elapsed 00:00
Q1MCQ2 marks
______________ generates a bunch of normally-distributed clusters of points with specific mean and standard deviations for each cluster.
  1. sklearn.datasets.make_clusters()
  2. sklearn.datasets.make_centers()
  3. sklearn.datasets.make_normal_clusters()
  4. sklearn.datasets.make_blobs()
Q2MCQ2 marks
Why is data preprocessing necessary?
  1. Some columns have values only between 0 and 1
  2. The data is divided into multiple types of files i.e. html, csv, tsv, etc.
  3. The data has only numbers in all the columns.
Q3MCQ2 marks
Which of the following is correct with respect to R2-score?
  1. R2 score is always positive and it may go up to infinity.
  2. R2 score is always positive, but it ranges between 0 and 1 only.
  3. R2 score can be negative. That happens if our model is worse than the meanmodel.
  4. R2 score can be negative. That happens if the mean model is worse than ourmodel.
Q4MCQ2 marks
Which options represent the output of the following code block? question figure Which options represent the output of the following code block?
  1. question figure
  2. question figure
  3. question figure
  4. question figure
Q5MCQ2 marks
Consider the following code block: question figure Consider the following code block: What will be the value of the ‘count’?
  1. 20
  2. 30
  3. 45
  4. 15
Q6MCQ2 marks
Consider the following code block: question figure Consider the following code block:
  1. question figure
  2. question figure
  3. question figure
  4. question figure
  5. question figure
Q7MCQ2 marks
Which of the following is a hyperparameter?
  1. L1-ratio in elasticnet
  2. Pruning parameter in a decision tree
  3. Learning rate in SGDRegressor
  4. All of these
Q8MCQ2 marks
question figure
  1. DecisionTreeClassifier
  2. RandomForestRegressor
  3. LogisticRegressor
  4. SGDRegressor
Q9MCQ2 marks
Consider the following code question figure Consider the following code
  1. question figure
  2. question figure
  3. question figure
  4. question figure
Q10MCQ2 marks
Consider the following code: question figure Consider the following code:
  1. 0.66
  2. 0.72
  3. 0.80
  4. 1.00
Q11MCQ2 marks
Which of the following are correct about sklearn.svm.SVC: question figure Which of the following are correct about sklearn.svm.SVC:
  1. It will print number of support vectors
  2. It will print an array of support vectors
  3. It will print an array of probabilities representing distance from decisionboundary with each data point.
  4. It will print indices of the support vectors from the training set.
Q12MCQ2 marks
question figure
  1. It will print nearest neighbours from the test point
  2. It will print indices of and distances to the neighbouring points (in training set)from test point
  3. It will print indices, distance and nearest training point from the test point
  4. It will throw an error
Q13MCQ3 marks
Which of the following APIs only supports conjoining transformers and estimators in series (i.e. one after another)?
  1. Pipeline
  2. ColumnTransformer
  3. FeatureUnion
  4. All of these
Q14MCQ3 marks
Consider the following ML task/steps for a regression dataset: 1. Read the data from a file (named ‘dataset.csv’). It has 7 columns. The last column is the target variable, all 6 features numerical. 2. Remove rows which have target values missing. 3. Fill the missing values in the features by KNN using 3 nearest neighbours. 4. Split the data into training and test sets. Take randomly the 70% of rows in the training set and the rest of them into the test set. 5. Train a simple linear regression model, with intercept, on the training set. 6. Report R2 score on the test set. Which of the following code snippets correctly accomplishes the above task? Assume necessary imports.
  1. question figure
  2. question figure
  3. question figure
  4. question figure
  5. question figure
  6. question figure
Q15MCQ3 marks
question figure
  1. (10, 3)
  2. (10, 7)
  3. (10, 8)
  4. (10, 10)
  5. (10, 11)
Q16MCQ3 marks
Consider the following statements about SGDClassifier: 1. It can be used to train a model on large dataset that doesn’t fit in main memory 2. It can emulate a KNN model 3. It can emulate a decision tree model 4. It can emulate a perceptron Choose the correction option(s)
  1. 1 and 4
  2. 1 and 2
  3. 2 and 3
  4. 3 and 4
Q17MCQ3 marks
Consider an image classification task: an image can have dogs, birds and trees. An image can have any combination of these three. The classifier is expected to report all these three for every sample. What kind of classification problem is this?
  1. multi-label and multiclass problem.
  2. multi-label and binary class problem.
  3. multiclass problem.
  4. binary class single label problem.
Q18MCQ3 marks
Consider following code snippets, assuming necessary imports. question figure Consider following code snippets, assuming necessary imports.
  1. question figure
  2. question figure
  3. question figure
  4. question figure
Q19MCQ3 marks
Which of the following options is true for the gamma parameter in a non-linear soft margin SVM?
  1. For high values of gamma, the points need to be very close to each other inorder to be considered in the same class
  2. For low values of gamma, the points need to be very close to each other inorder to be considered in the same class
  3. Gamma doesn’t affect the SVM model at all
  4. None of these
Q20MCQ3 marks
Consider the following code: question figure Consider the following code:
  1. dtc1
  2. dtc2
  3. dtc3
  4. dtc4
Q21MCQ3 marks
Following is the code to tune the n_estimators parameter of a Bagging Classifier model. question figure Following is the code to tune the n_estimators parameter of a Bagging Classifier model.
  1. question figure
  2. question figure
  3. question figure
  4. question figure
  5. question figure
Q22MCQ4 marks
Consider the following code. How many DecisionTreeClassifier models will be trained internally? question figure Consider the following code. How many DecisionTreeClassifier models will be trained internally?
  1. 20
  2. 200
  3. 8
  4. 150
  5. 15
  6. 80
Q23MCQ4 marks
Consider two classifiers as shown in the following block of code: question figure Consider two classifiers as shown in the following block of code:
  1. depth(clf1) ≥ depth(clf2)
  2. depth(clf1) ≤ depth(clf2)
  3. depth(clf1) = depth(clf2)
  4. Insufficient Information
Q24MCQ4 marks
Consider the following code: question figure Consider the following code:
  1. d1 < d2 < d3 < d4
  2. d1 ≤ d2 ≤ d3 ≤ d4
  3. d1 > d2 > d3 > d4
  4. d1 ≥ d2 ≥ d3 ≥ d4
Q25MCQ4 marks
Suppose that we have 10000 samples in a dataset. Suppose further we use the K − means algorithm to find clusters in the dataset. Then, the statement that K-Means algorithm always converges with zero inertia (or zero Sums Square Error) for some value of K is
  1. Always True
  2. Always False
  3. True, sometimes
Q26MCQ4 marks
Suppose that we use k-means clustering for a dataset having 100 samples. The initial centroids for k clusters can be initialized in multiple ways. One such as way is shown below question figure Suppose that we use k-means clustering for a dataset having 100 samples. The initial centroids for k clusters can be initialized in multiple ways. One such as way is shown below
  1. 20 centroids are randomly initialized 10 times
  2. 10 centroids are randomly initialized 20 times
  3. 20 samples in the dataset are selected as initialization point such that they areat least 10 units away from each other
  4. 10 samples in the dataset are selected as initialization point such that they areat least 20 units away from each other
Q27MSQ2 marksselect all that apply
We wish to load the wine dataset from sklearn. Which of the following will throw an error?
  1. question figure
  2. question figure
  3. question figure
  4. question figure
Q28MSQ2 marksselect all that apply
Which of the following is correct?
  1. question figure
  2. question figure
  3. question figure
  4. question figure
Q29MSQ2 marksselect all that apply
Which of the following algorithms may get impacted by feature scaling?
  1. LinearRegression
  2. DecisionTree
  3. SVM
  4. BinomialNaiveBayes
Q30MSQ2 marksselect all that apply
Which of the following class(es) is (are) used to instantiate a neural network in Sklearn.
  1. question figure
  2. question figure
  3. question figure
  4. question figure
Q31MSQ3 marksselect all that apply
question figure
  1. question figure
  2. question figure
  3. question figure
  4. question figure
Q32MSQ3 marksselect all that apply
Which of the following ways can help in feature selection?
  1. Drop a Feature with many missing values
  2. Drop a feature containing data with high standard deviation
  3. Use SelectKBest or SelectKPercentile methods
  4. Drop a feature which has high correlation with target variable
Q33MSQ4 marksselect all that apply
Consider the following block of code: question figure Consider the following block of code:
  1. Number of samples at node N = 15. If it is split, it will result in 9 nodes in theleft child and 6 nodes in the right child.
  2. Number of samples at node N = 5. If it is split, it will result in 4 nodes in the leftchild and 2 nodes in the right child.
  3. Number of samples at node N = 7. If it is split, it will result in 4 nodes in the leftchild and 3 nodes in the right child.
  4. Number of samples at node N = 12. If it is split, it will result in 3 nodes in theleft child and 9 nodes in the right child.
Q34MSQ4 marksselect all that apply
The code given below attempts to find the clusters in the dataset, X using the K-means algorithm. question figure The code given below attempts to find the clusters in the dataset, X using the K-means algorithm.
  1. The code attempts to find 2 clusters in the given dataset
  2. The dataset X can be visualized in the Euclidean space
  3. The code raises an error upon execution
  4. The code gets executed without an error upon execution
Q35MSQ4 marksselect all that apply
The following line of code creates a neural network (assume necessary imports) question figure The following line of code creates a neural network (assume necessary imports) Select the correct statements from the following list of statements
  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 5 neurons in the secondhidden layer
  4. The neural network contains 2 hidden layers with 3 neurons in the first hiddenlayer
  5. None of the given options are correct
Q36SA3 marks
Consider the following code block: question figure Consider the following code block:

Answer key

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

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" exam, along with Mermaid knowledge graphs to visualize relationships.



1. Core Topics & Concepts

A. Data Preprocessing

B. Supervised Learning

  1. Classification:

    • Metrics:

      • Confusion Matrix: TP, TN, FP, FN (e.g., confusion_matrix(y_true, y_pred)).
      • F1-Score: Harmonic mean of precision/recall. Formula:
F1=2×precision×recallprecision+recallF1 = 2 \times \frac{\text{precision} \times \text{recall}}{\text{precision} + \text{recall}}
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. Regression:

    • Linear Regression: LinearRegression(fit_intercept=True).
    • Polynomial Features: PolynomialFeatures(degree=2, interaction_only=True) generates interaction terms (e.g., for 3 features → 6 terms: original + 3 interactions).

C. Unsupervised Learning

D. Model Evaluation & Hyperparameter Tuning

E. Special Cases


2. Key Equations

ConceptEquation
R² ScoreR2=1−∑(yi−y^i)2∑(yi−yˉ)2R^2 = 1 - \frac{\sum (y_i - \hat{y}_i)^2}{\sum (y_i - \bar{y})^2}
F1-ScoreF1=2×precision×recallprecision+recallF1 = 2 \times \frac{\text{precision} \times \text{recall}}{\text{precision} + \text{recall}}
Polynomial FeaturesFor degree=2, interaction_only=True: nfeatures=(n2)+nn_{\text{features}} = \binom{n}{2} + n (e.g., 3 features → 6 terms).
K-Means InertiaInertia=∑i=1nmin⁡μj∈C∥xi−μj∥2\text{Inertia} = \sum_{i=1}^{n} \min_{\mu_j \in C} \|x_i - \mu_j\|^2
SGD Update (Perceptron)w=w+η⋅(yi−y^i)⋅xiw = w + \eta \cdot (y_i - \hat{y}_i) \cdot x_i

Graph 2: Unsupervised Learning (K-Means)

Graph 3: Model Evaluation & Hyperparameter Tuning

Graph 4: Decision Trees & Pruning

Graph 5: Data Preprocessing Pipeline


4. Common Pitfalls & Tips

  1. Confusion Matrix:

    • Rows = True labels, Columns = Predicted labels.
    • Example:

      y_true = ["Rainy", "Sunny", "Sunny", "Rainy", "Sunny", "Rainy"]
      y_pred = ["Sunny", "Sunny", "Rainy", "Rainy", "Sunny", "Sunny"]

      Output: [[1, 2], [2, 1]] (Option C).

  1. Polynomial Features:

    • interaction_only=True → Only interaction terms (no squares).
    • For n_features=3, degree=2 → 6 features (original 3 + 3 interactions).
  1. SGDClassifier:

    • loss="perceptron" → Perceptron.
    • loss="log" → Logistic regression.
    • loss="hinge" → Linear SVM.
  1. K-Means:

    • If n_clusters > n_samples, it raises an error.
    • init='random' initializes centroids randomly n_init times.
  1. Hyperparameter Tuning:

    • In GridSearchCV, separate dictionaries in param_grid are treated as separate grids (not combined).
    • Example: param_grid = [{'A': [1,2]}, {'B': [3,4]}] → 2 + 2 = 4 combinations (not 4 total).
  1. Pipelines:

    • Use stepname__param for hyperparameter tuning (e.g., bc__n_estimators).
  1. R² Score:

    • Can be negative if the model is worse than the horizontal line (mean predictor).
  1. Neural Networks in sklearn:

    • MLPClassifier/MLPRegressor (not NNClassifier).
    • hidden_layer_sizes=(3,5) → 2 hidden layers (3 neurons, then 5 neurons).