ML Study Hub

Home / Past papers / MLP End Term / this paper

IIT M FOUNDATION ET1 EXAM QPF2 S1 03 Sep - 03 Sep 2023

MLP End Term34 questions100 marks23 MCQ · 6 SA · 5 MSQFoundation / QPF2
Elapsed 00:00
Q1SA2 marks
What will be the output of the following code: question figure What will be the output of the following code:
Q2SA2 marks
What will be the numerical value in the output array of the following code: question figure What will be the numerical value in the output array of the following code:
Q3MCQ2 marks
question figure
  1. question figure
  2. question figure
  3. question figure
  4. question figure
Q4MCQ2 marks
question figure
  1. The predicted classes for the new data points.
  2. The decision boundary values for the classes.
  3. The posterior probabilities of the classes for the new data points.
  4. The likelihood estimates for the new data points.
Q5MCQ2 marks
question figure
  1. (15,2)
  2. (2,3)
  3. (2,15)
  4. (15,3)
Q6MCQ2 marks
You’re working on a dataset containing customer purchase data, and you want to segment the customers into distinct groups based on their purchasing behavior. Each data point represents a customer and includes features like ”Total Amount Spent” and ”Number of Items Purchased.” Which algorithm is suitable for this scenario?
  1. Linear Regression
  2. Decision Tree
  3. K-means Clustering
  4. Support Vector Machine
Q7MCQ2 marks
You’re working with a dataset of geographical locations and want to group similar locations together based on their distances. The dataset includes latitude and longitude coordinates for each location. Which linkage method would be most appropriate for this scenario?
  1. Complete Linkage
  2. Ward’s Linkage
  3. Single Linkage
  4. Average Linkage
Q8MCQ2 marks
You’re analyzing a dataset of customer transaction histories. Each transaction includes the purchase amount and timestamp. You want to identify groups of customers based on their spending behavior. Which clustering approach would be most appropriate for this scenario?
  1. Distribution-based Clustering
  2. Density-based Clustering
Q9MSQ3 marksselect all that apply
question figure
  1. question figure
  2. question figure
  3. question figure
  4. question figure
Q10MSQ3 marksselect all that apply
question figure
  1. MultinomialNB
  2. RandomForestRegressor
  3. LogisticRegressor
  4. SGDRegressor
Q11MSQ3 marksselect all that apply
Which of the following option(s) are correct regarding regularization?
  1. It is a technique used to minimize the adjusted loss function and avoidunderfitting.
  2. It helps in increasing the bias of the training model.
  3. It determines the rows to be selected as a training dataset.
  4. Elastic net regularization is a combination of L1 and L2 regularization both.
Q12MCQ3 marks
Given the following code snippet that preprocesses a dataset with both continuous and categorical features using sklearn.preprocessing tools, what will be the first row of the X transformed array after preprocessing? question figure Given the following code snippet that preprocesses a dataset with both continuous and categorical features using sklearn.preprocessing tools, what will be the first row of the X transformed array after preprocessing?
  1. question figure
  2. question figure
  3. question figure
  4. question figure
Q13MCQ3 marks
question figure
  1. (20640, 8)
  2. (20640, 5)
  3. (20640, 44)
  4. (20640, 49)
Q14MCQ3 marks
What is the main principle behind a dummy regressor’s prediction strategy?
  1. Predict the mean or median of the target variable for all instances.
  2. Fit a complex mathematical function to the data.
  3. Randomly shuffle the target variable values to make predictions.
  4. Predict the sum of the input features for each instance.
Q15MCQ3 marks
question figure
  1. It converts the numerical values in the data array to categorical labels.
  2. It standardizes the features in the data array to have zero mean and unitvariance.
  3. It applies a logarithmic transformation to the values in the data array.
  4. It removes the mean and scales the features in the data array to a specificrange.
Q16MCQ3 marks
question figure
  1. question figure
  2. question figure
  3. question figure
  4. question figure
Q17MCQ3 marks
question figure
  1. question figure
  2. question figure
  3. question figure
  4. question figure
Q18MCQ3 marks
question figure
  1. question figure
  2. question figure
  3. question figure
  4. question figure
Q19MCQ3 marks
You’re working on a binary classification problem where the dataset is relatively small, and you suspect that a linear decision boundary will work well due to distinct class separation. Additionally, you want to perform logistic regression with L1 regularization for improved feature selection. Which solver is most appropriate for this scenario?
  1. Newton-CG
  2. SGD
  3. LBFGS
  4. Liblinear
Q20MCQ3 marks
question figure
  1. Increasing the number of neurons in hidden layers will always lead to bettermodel performance.
  2. Decreasing the number of neurons in hidden layers reduces the model’scapacity to capture complex patterns.
  3. The number of neurons in hidden layers does not significantly affect themodel’s performance.
  4. Finding the optimal number of neurons is a trial-and-error process and mayrequire experimentation.
Q21MCQ3 marks
You’re designing an ‘MLPClassifier’ for an image recognition task. The dataset consists of grayscale images of animals. You want to introduce non-linearity to the neural network’s architecture. Which element of the neural network architecture would you adjust to incorporate non-linearity in the model?
  1. Number of hidden layers
  2. Number of neurons in input layer
  3. Learning rate
  4. Activation function
Q22MCQ3 marks
You’re working on a binary classification task using the ‘MLPClassifier’ to predict whether a customer will make a purchase based on their browsing behavior.You’re concerned about overfitting due to the complexity of the model. You decide to increase the ‘alpha’ parameter to control overfitting. The following code snippet shows the application of ‘MLPClassifier’: question figure You’re working on a binary classification task using the ‘MLPClassifier’ to predict whether a customer will make a purchase based on their browsing behavior.You’re concerned about overfitting due to the complexity of the model. You decide to increase the ‘alpha’ parameter to control overfitting. The following code snippet shows the application of ‘MLPClassifier’:
  1. Increasing the model’s complexity to fit the training data more closely.
  2. Adding a stronger regularization term to the loss function, discouragingcomplex models.
  3. Making the model more sensitive to outliers and noise in the data.
  4. Adjusting the learning rate to control convergence speed.
Q23SA3 marks
question figure
Q24SA3 marks
Using the confusion matrix given below. What is the precision score for the label (class) 1 ? question figure Using the confusion matrix given below. What is the precision score for the label (class) 1 ?
Q25SA3 marks
question figure
Q26SA3 marks
question figure
Q27MSQ4 marksselect all that apply
Which of the following statements are true?
  1. KNeighborsClassifier with low values of n_neighbors produces complexdecision boundaries.
  2. KNeighborsClassifier with low values of n_neighbors produces smoothdecision boundaries.
  3. In KNeighborsClassifier the scale of the features(columns) can impact thedecision boundaries.
  4. None of these
Q28MSQ2 marksselect all that apply
Fill in the missing parameter value in the following estimator that can be used to classify the data question figure Fill in the missing parameter value in the following estimator that can be used to classify the data
  1. ‘lasso’
  2. ‘linear’,
  3. ‘rbf’,
  4. ‘scale’
Q29MCQ4 marks
question figure
  1. question figure
  2. question figure
Q30MCQ4 marks
question figure
  1. question figure
  2. question figure
  3. question figure
  4. question figure
Q31MCQ4 marks
question figure
  1. question figure
  2. question figure
  3. question figure
  4. question figure
Q32MCQ4 marks
question figure
  1. question figure
  2. question figure
  3. question figure
  4. question figure
Q33MCQ4 marks
question figure
  1. question figure
  2. question figure
  3. question figure
  4. question figure
Q34MCQ4 marks
You’re working with a dataset of customer purchase behavior, including attributes “Total Amount Spent” and “Number of Items Purchased.” You decide to use K-means clustering to segment customers into groups based on these features. The following code snippet demonstrates the K-means clustering process: question figure You’re working with a dataset of customer purchase behavior, including attributes “Total Amount Spent” and “Number of Items Purchased.” You decide to use K-means clustering to segment customers into groups based on these features. The following code snippet demonstrates the K-means clustering process:
  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.

Answer key

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

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 the core topics, concepts, and equations for the Diploma Level: Machine Learning Practice (Computer-Based Exam). The summary is organized by key themes, followed by a Mermaid knowledge graph to visualize relationships.



1. Data Preprocessing

Key Concepts:

z=x−μσz = \frac{x - \mu}{\sigma}
Xscaled=X−XminXmax−XminX_{\text{scaled}} = \frac{X - X_{\text{min}}}{X_{\text{max}} - X_{\text{min}}}
Xscaled=X∣Xmax∣X_{\text{scaled}} = \frac{X}{|X_{\text{max}}|}

Key Equations:

TechniqueFormula
Standard Scalingz=x−μσz = \frac{x - \mu}{\sigma}
Min-Max ScalingXscaled=X−XminXmax−XminX_{\text{scaled}} = \frac{X - X_{\text{min}}}{X_{\text{max}} - X_{\text{min}}}
Max Abs ScalingXscaled=X∣Xmax∣X_{\text{scaled}} = \frac{X}{|X_{\text{max}}|}
Polynomial Featuresdegree=2\text{degree}=2: [1,x1,x2,x1x2,x12,x22][1, x_1, x_2, x_1x_2, x_1^2, x_2^2]

2. Dimensionality Reduction

Key Concepts:


3. Supervised Learning

Key Algorithms:

  1. Linear Models:

    • Linear Regression:

      • Equation: Y=W0X0+W1X1+⋯+WnXn+ϵY = W_0X_0 + W_1X_1 + \dots + W_nX_n + \epsilon.
      • fit_intercept=False: Forces intercept W0=0W_0 = 0 (Q24).
      • Example:

        from sklearn.linear_model import LinearRegression
        reg = LinearRegression(fit_intercept=False)
        reg.fit(X_train, y_train)
        print(reg.coef_)  # Weights [W₁, W₂, ...]
    • Logistic Regression:

      • Solvers:

        • liblinear: Supports L1/L2 regularization (good for small datasets).
        • lbfgs/newton-cg: Fast for large datasets (L2 only).
        • sag/saga: Stochastic gradient descent (supports L1).
      • Regularization:

        • C: Inverse of regularization strength (smaller C = stronger regularization).
        • penalty: 'l1' (Lasso) or 'l2' (Ridge).
      • Example (Q18, Q20):

        from sklearn.linear_model import LogisticRegression
        model = LogisticRegression(class_weight='balanced', C=0.5, solver='liblinear')
      • Attributes:

        • coef_: Feature weights.
        • intercept_: Bias term.
  1. Naive Bayes:

    • GaussianNB: Assumes features follow a normal distribution.

      • predict_proba: Returns posterior probabilities (Q5).
      • Example:

        from sklearn.naive_bayes import GaussianNB
        clf = GaussianNB()
        clf.fit(X, y)
        proba = clf.predict_proba([[2.0, 3.0]])  # Output: [[P(class=0), P(class=1)]]
  1. Support Vector Machines (SVM):

    • Kernels:

      • 'linear': Linear decision boundary.
      • 'rbf': Radial Basis Function (non-linear).
      • 'poly': Polynomial kernel.
    • Example (Q29):

      from sklearn.svm import SVC
      clf = SVC(kernel='rbf')
  1. Decision Trees:

    • Hyperparameters:

      • max_depth: Maximum tree depth (None = unlimited).
      • min_samples_split: Minimum samples to split a node.
      • min_samples_leaf: Minimum samples in a leaf.
      • criterion: 'gini' (Gini impurity) or 'entropy' (information gain).
    • Overfitting:

      • Deeper trees (max_depth=None) are prone to overfitting (Q30).
    • Example:

      from sklearn.tree import DecisionTreeClassifier
      tree = DecisionTreeClassifier(max_depth=3, criterion='gini')
  1. Ensemble Methods:

    • Bagging:

      • BaggingClassifier: Trains base estimators on bootstrap samples.

        • Parameters:

          • n_estimators: Number of base models.
          • max_samples: Fraction of samples per estimator.
          • bootstrap: Whether to sample with replacement.
        • Example (Q31):

          from sklearn.ensemble import BaggingClassifier
          bag_clf = BaggingClassifier(
              base_estimator=KNeighborsClassifier(n_neighbors=5),
              n_estimators=50,
              max_samples=0.5,
              bootstrap=True
          )
    • Boosting:

      • AdaBoostClassifier: Combines weak learners (e.g., decision stumps) with adaptive weights.

        • Parameters:

          • n_estimators: Number of boosting stages.
          • learning_rate: Shrinks contribution of each estimator.
        • Example (Q34):

          from sklearn.ensemble import AdaBoostClassifier
          ada = AdaBoostClassifier(
              base_estimator=DecisionTreeClassifier(max_depth=1),
              n_estimators=100,
              learning_rate=0.1
          )
    • Random Forest:

      • RandomForestClassifier: Ensemble of decision trees with feature subsampling.

        • Parameters:

          • max_features: Number of features to consider for splits (e.g., 'sqrt').
          • bootstrap: Whether to use bootstrap sampling.
        • Example (Q32):

          from sklearn.ensemble import RandomForestClassifier
          rf = RandomForestClassifier(
              n_estimators=100,
              max_features='sqrt',
              bootstrap=True
          )
  1. Neural Networks:

    • MLPClassifier (Multi-Layer Perceptron):

      • Parameters:

        • hidden_layer_sizes: Tuple specifying neurons per layer (e.g., (100, 50)).
        • activation: 'relu', 'tanh', 'logistic'.
        • alpha: L2 regularization strength.
        • solver: 'adam', 'sgd', 'lbfgs'.
      • Example (Q21, Q22, Q23):

        from sklearn.neural_network import MLPClassifier
        mlp = MLPClassifier(
            hidden_layer_sizes=(100,),
            activation='relu',
            alpha=0.01,
            solver='adam'
        )

Key Equations:

AlgorithmKey Equation
Linear RegressionY=W0+W1X1+⋯+WnXn+ϵY = W_0 + W_1X_1 + \dots + W_nX_n + \epsilon
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)}}
SVM (Linear)Decision function: W⋅X+b\text{Decision function: } W \cdot X + b
Decision Tree (Gini)G=1−∑pi2G = 1 - \sum p_i^2 (impurity measure)
AdaBoostF(x)=∑αtht(x)F(x) = \sum \alpha_t h_t(x) (weighted sum of weak learners)

4. Unsupervised Learning

Key Algorithms:

  1. Clustering:

    • K-Means:

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

        • n_clusters: Number of clusters.
        • init: Initialization method ('k-means++').
      • Attributes:

        • labels_: Cluster assignments for each point.
        • cluster_centers_: Coordinates of centroids.
      • Example (Q7, Q35):

        from sklearn.cluster import KMeans
        kmeans = KMeans(n_clusters=3)
        kmeans.fit(X)
        labels = kmeans.labels_  # Cluster assignments
    • Hierarchical Clustering:

      • Linkage Methods (Q8):

        • complete: Maximum distance between clusters.
        • ward: Minimizes variance when merging.
        • single: Minimum distance (can cause chaining).
        • average: Average distance between clusters.
  1. Dimensionality Reduction:

    • PCA: See Section 2.

Key Equations:

AlgorithmKey Equation
K-MeansMinimize ∑i=1k∑x∈Ci∥x−μi∥2\text{Minimize } \sum_{i=1}^{k} \sum_{x \in C_i} \|x - \mu_i\|^2
PCACovariance matrix: Σ=1nXTX\text{Covariance matrix: } \Sigma = \frac{1}{n} X^T X

5. Model Evaluation

Key Metrics:

Penalty=α⋅L1+(1−α)⋅L2\text{Penalty} = \alpha \cdot L1 + (1 - \alpha) \cdot L2

Key Equations:

MetricFormula
PrecisionTPTP+FP\frac{TP}{TP + FP}
RecallTPTP+FN\frac{TP}{TP + FN}
F1-Score2⋅Precision⋅RecallPrecision+Recall2 \cdot \frac{\text{Precision} \cdot \text{Recall}}{\text{Precision} + \text{Recall}}
L1 Regularizationλ∑∣Wi∣\lambda \sum |W_i|
L2 Regularizationλ∑Wi2\lambda \sum W_i^2

6. Incremental Learning

Key Concepts:


7. Text Feature Extraction

Key Techniques:




Graph 1: Data Preprocessing

Graph 2: Supervised Learning

Graph 3: Unsupervised Learning

Graph 4: Model Evaluation & Miscellaneous



Exam Tips

  1. Focus on Equations:

    • Memorize formulas for scaling, regularization, precision/recall, and PCA.
  2. Sklearn Syntax:

    • Know how to initialize and fit transformers/estimators (e.g., StandardScaler(), Pipeline()).
  3. Hyperparameters:

    • Understand the role of C (regularization), n_estimators (ensemble), max_depth (trees), and alpha (neural networks).
  4. Common Pitfalls:

    • LabelEncoder is not for one-hot encoding (use OneHotEncoder).
    • fit_intercept=False forces the intercept to 0 in linear models.
    • K-Means is sensitive to feature scales (always scale data first).