ML Study Hub

Home / Past papers / MLP End Term / this paper

IIT M FOUNDATION DIPLOMA FN EXAM - 01 Sep 2024

MLP End Term37 questions100 marks20 MCQ · 11 SA · 6 MSQFoundation / Diploma / forenoon
Elapsed 00:00
Comprehension passage - the questions below it refer to this
Consider following common data and answer the subquestions: question figure Consider following common data and answer the subquestions:
Q1SA2 marks
What will be the output of the following code snippet? question figure What will be the output of the following code snippet? Enter -1, if you think the above code snippet will generate an error.
Q2SA2 marks
What will be the output of the following code snippet? question figure What will be the output of the following code snippet? Enter -1, if you think the above code snippet will generate an error.
Q3SA2 marks
What will be the output of the following code snippet? question figure What will be the output of the following code snippet? Enter -1, if you think the above code snippet will generate an error.
Q4SA2 marks
How many columns have datatype as ”float64”?
Q5SA2 marks
What will be the output of the following code snippet? question figure What will be the output of the following code snippet? Enter -1, if you think the above code snippet will generate an error.
Q6SA2 marks
Consider following parameter grid for regression with RandomForest: question figure Consider following parameter grid for regression with RandomForest: How many unique combinations of hyperparameters are there in the above parameter grid?
Q7MCQ1 mark
How to make SGDRegressor stop after 1000 epochs?
  1. question figure
  2. question figure
  3. question figure
  4. question figure
Q8MCQ2 marks
question figure
  1. DictVectorizer
  2. HashingVectorizer
  3. FeatureHasher
Q9MCQ2 marks
Which of the following is an example of an ordinal variable?
  1. Blood type (A, B, AB, O)
  2. Satisfaction rating (Very Unsatisfied, Unsatisfied, Neutral, Satisfied, VerySatisfied)
  3. Height of individuals
  4. Gender
Q10MCQ2 marks
question figure
  1. question figure
  2. question figure
  3. question figure
  4. question figure
Q11MCQ2 marks
question figure
  1. cv
  2. reg_rate
  3. alpha
  4. tol
Q12MCQ3 marks
question figure
  1. 1000
  2. 100
  3. 99
  4. 999
Q13MCQ3 marks
question figure
  1. question figure
  2. question figure
  3. question figure
  4. question figure
Q14MCQ3 marks
question figure
  1. It determines whether to include a bias term in the model.
  2. It sets the degree of the polynomial features.
  3. It controls the regularization strength.
  4. It specifies the number of features to consider when fitting the model.
Q15MCQ3 marks
question figure
  1. To specify the maximum number of samples per leaf.
  2. To limit the depth of the tree.
  3. To set the minimum number of samples required to split an internal node.
  4. To control the minimum impurity decrease required for a split.
Q16MCQ3 marks
question figure
  1. It determines the function to measure the quality of a split.
  2. It specifies the number of features to consider when looking for the best split.
  3. It sets the strategy used to choose the split at each node.
  4. It controls whether to use the Gini impurity or entropy.
Q17MCQ3 marks
question figure
  1. question figure
  2. question figure
  3. question figure
  4. question figure
Q18MCQ3 marks
Consider below statements and choose the correct option: Statement1:The bagging technique combines multiple models trained on different subsets of data Statement2:The Boosting technique trains the model Parallelly, focusing on the error made by the other model.
  1. Statement1 is True, Statement2 is True
  2. Statement1 is True, Statement2 is False
  3. Statement1 is False, Statement2 is True
  4. Statement1 is False, Statement2 is False
Q19MCQ3 marks
How does agglomerative clustering handle outliers?
  1. It ignores outliers during the clustering process.
  2. It assigns outliers to the nearest cluster.
  3. It creates separate clusters for outliers.
  4. It removes outliers from the dataset before clustering.
Q20MCQ3 marks
What is agglomerative clustering?
  1. A hierarchical clustering technique that starts with each data point as itscluster and merges the closest clusters iteratively.
  2. A method for partitioning data into a predefined number of clusters.
  3. A clustering algorithm that uses centroids to iteratively assign data points toclusters.
  4. A dimensionality reduction technique that projects data onto a lower-dimensional space.
Q21MCQ3 marks
question figure
  1. The distance between cluster centroids
  2. The number of clusters formed
  3. The within-cluster sum of squared distances
  4. The silhouette coefficient
Q22MCQ4 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 has target values missing. 3. 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. 4. Fill the missing values in the features by KNNImputer using 3 nearest neighbours. 5. Train a LinearRegression model 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
Q23MCQ4 marks
question figure
  1. question figure
  2. question figure
  3. question figure
  4. question figure
Q24MCQ4 marks
question figure
  1. question figure
  2. question figure
  3. question figure
  4. question figure
  5. question figure
Q25MCQ4 marks
question figure
  1. The predictions are based on the majority vote.
  2. The predictions are based on the average of probabilities predicted by eachclassifier.
  3. The predictions are based on the weighted sum of the predictions.
  4. The predictions are based on the classifier with the highest accuracy
Q26MCQ4 marks
question figure
  1. 5 centroids are randomly initialized 10 times
  2. 10 centroids are randomly initialized 5 times
  3. 5 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 5 units away from each other
Q27MSQ2 marksselect all that apply
Data snooping:
  1. Leads to biased estimation on test sets
  2. Increases the risk of false positives
  3. Leads to better estimation on training sets
  4. Reduces the risk of false positives
Q28MSQ2 marksselect all that apply
Which of the following algorithms may get impacted by feature scaling?
  1. LinearRegression
  2. DecisionTree
  3. SVM
  4. NaiveBayes
Q29MSQ3 marksselect all that apply
question figure
  1. The logistic regression model will use equal weights for both the classes in animbalanced dataset.
  2. The model does not use any regularization because the parameter C is set.
  3. The “balanced” mode uses the values of y to automatically adjust weightsinversely proportional to class frequencies in the input data.
  4. The value of C indicates that the model will apply a regularization.
Q30MSQ3 marksselect all that apply
Which of the following statements are true?
  1. KNeighborsClassifier with high values of n_neighbors produces complexdecision boundaries.
  2. KNeighborsClassifier with high values of n_neighbors produces smoothdecision boundaries.
  3. In KNeighborsClassifier the scale of the features(columns) can impact thedecision boundaries.
  4. None of these
Q31MSQ3 marksselect all that apply
Which options are correct for Support Vectors in SVM ?
  1. Support vectors are the data points nearest to the hyperplane
  2. Using these support vectors, we maximize the margin of the classifier.
  3. Using these support vectors, we minimize the margin of the classifier.
  4. None of these
Q32MSQ3 marksselect all that apply
Which of the following are correct for Kmeans clustering algorithm?
  1. It only finds spherical clusters.
  2. The output of the algorithms depends upon initial cluster centroids.
  3. It can automatically detect most appropriate value of k.
  4. None of these.
Q33SA3 marks
question figure
Q34SA3 marks
question figure
Q35SA3 marks
question figure
Comprehension passage - the questions below it refer to this
Based on the above data, answer the given subquestions. question figure
Q36SA2 marks
What will be the output of the following code? question figure What will be the output of the following code?
Q37SA2 marks
What will be the output of the following code? question figure What will be the output of the following code?

Answer key

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

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. Python Libraries & Data Handling

Key Libraries:

Key Pandas Operations:

OperationCode ExampleOutput/Use Case
Shape of DataFramedf.shape(rows, columns)
Count non-null valuesdf.shape[0]*df.shape[1] - df.isna().sum().sum()Total non-missing values
Value countsdf['column'].value_counts()Frequency of unique values
Filter rowsdf.query("Glucose > 100")Subset data based on condition
Select column by indexdf.iloc[:, 4]Extract a column (e.g., Age)
Mean of a columndf['Age'].mean()Average, ignoring NaN by default
Handle missing datadf.dropna() or KNNImputerRemove or impute missing values

B. Data Preprocessing

Key Concepts:

  1. Handling Missing Data:

    • df.dropna(): Remove rows/columns with missing values.
    • SimpleImputer or KNNImputer: Fill missing values (e.g., KNNImputer(n_neighbors=3)).
  2. Feature Scaling:

    • StandardScaler: Standardizes features (mean=0, std=1).
    • MinMaxScaler: Scales features to a range (e.g., [0, 1]).
    • Impacted Algorithms: Linear Regression, SVM, KNN, Neural Networks.
  3. Feature Extraction:

    • DictVectorizer: Converts dictionaries to feature matrices (for structured data).
    • HashingVectorizer: Converts text to fixed-size vectors (not used here).

Equations:

z=x−μσz = \frac{x - \mu}{\sigma}

where μ\mu = mean, σ\sigma = standard deviation.

xscaled=x−xminxmax−xminx_{\text{scaled}} = \frac{x - x_{\text{min}}}{x_{\text{max}} - x_{\text{min}}}

C. Machine Learning Models

1. Linear Models

ModelKey ParametersUse CaseRegularization
Linear Regression-RegressionNone
Ridge Regressionalpha (L2 penalty)Regression with regularizationL2=α∑wi2L2 = \alpha \sum w_i^2
Lasso Regressionalpha (L1 penalty)Feature selectionL1=α∑∣wi∣L1 = \alpha \sum |w_i|
Logistic RegressionC (inverse of alpha), class_weightClassificationCC controls regularization

Key Equations:

Loss=MSE+α⋅Regularization\text{Loss} = \text{MSE} + \alpha \cdot \text{Regularization}
P(y=1)=11+e−(wTx+b)P(y=1) = \frac{1}{1 + e^{-(w^T x + b)}}

2. Tree-Based Models

ModelKey ParametersUse Case
Decision Treemax_depth, min_samples_split, criterion (gini/entropy for classification, mse for regression)Classification/Regression
Random Forestn_estimators, bootstrap, max_featuresEnsemble learning
Gradient Boosting (e.g., XGBoost)learning_rate, n_estimatorsBoosting

Key Concepts:

3. Clustering

AlgorithmKey ParametersUse CaseKey Metrics
K-Meansn_clusters, init (random/k-means++)Partitional clusteringInertia, Silhouette Score
Agglomerative Clusteringn_clusters, linkage (ward, complete, etc.)Hierarchical clusteringDendrogram, Silhouette Score

Key Equations:

Inertia=∑i=1nmin⁡μj∈C∣∣xi−μj∣∣2\text{Inertia} = \sum_{i=1}^n \min_{\mu_j \in C} ||x_i - \mu_j||^2

where μj\mu_j = centroid of cluster jj.


4. Model Evaluation

MetricFormulaUse Case
AccuracyTP+TNTotal\frac{\text{TP} + \text{TN}}{\text{Total}}Classification
PrecisionTPTP+FP\frac{\text{TP}}{\text{TP} + \text{FP}}Classification
RecallTPTP+FN\frac{\text{TP}}{\text{TP} + \text{FN}}Classification
F1-Score2⋅Precision⋅RecallPrecision+Recall2 \cdot \frac{\text{Precision} \cdot \text{Recall}}{\text{Precision} + \text{Recall}}Classification
R² Score1−SSresSStot1 - \frac{\text{SS}_{\text{res}}}{\text{SS}_{\text{tot}}}Regression
Confusion MatrixTable of TP, TN, FP, FNClassification

Key Terms:


D. Hyperparameter Tuning

Key Concepts:

Equation for LOO:


E. Ensemble Methods

MethodKey IdeaKey Parameters
BaggingTrain models on bootstrapped samples, average votesn_estimators, bootstrap
BoostingSequentially correct errors from previous modelslearning_rate, n_estimators
Random ForestEnsemble of decision trees with feature randomnessmax_features, bootstrap

Key Differences:


F. Dimensionality Reduction & Feature Engineering

Key Concepts:


G. Special Topics

  1. Data Snooping:

    • Peeking at test data → biased estimates, increased false positives.
  2. Ordinal vs. Nominal Variables:

    • Ordinal: Ordered categories (e.g., satisfaction ratings).
    • Nominal: Unordered categories (e.g., blood type).
  3. Dummy Classifier:

    • Baseline model (e.g., strategy='most_frequent' always predicts the majority class).
  4. Perceptron:

    • Linear classifier (binary).
    • tol: Tolerance for stopping criteria.
    • shuffle: Whether to shuffle data before each epoch.

Graph 2: Machine Learning Models

Graph 3: Model Evaluation

Graph 4: Ensemble Methods

Graph 5: Clustering

Graph 6: Hyperparameter Tuning


3. Key Equations Summary

TopicEquation
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}}}
Ridge (L2)Loss=MSE+α∑wi2\text{Loss} = \text{MSE} + \alpha \sum w_i^2
Lasso (L1)Loss=MSE+α∑∣wi∣\text{Loss} = \text{MSE} + \alpha \sum |w_i|
Logistic RegressionP(y=1)=11+e−(wTx+b)P(y=1) = \frac{1}{1 + e^{-(w^T x + b)}}
K-Means Inertia∑i=1nmin⁡μj∈C∣∣xi−μj∣∣2\sum_{i=1}^n \min_{\mu_j \in C} ||x_i - \mu_j||^2
PrecisionTPTP+FP\frac{\text{TP}}{\text{TP} + \text{FP}}
RecallTPTP+FN\frac{\text{TP}}{\text{TP} + \text{FN}}
F1-Score2⋅Precision⋅RecallPrecision+Recall2 \cdot \frac{\text{Precision} \cdot \text{Recall}}{\text{Precision} + \text{Recall}}
R² Score1−SSresSStot1 - \frac{\text{SS}_{\text{res}}}{\text{SS}_{\text{tot}}}

4. Exam Tips

  1. Pandas/Numpy: Focus on shape, isna(), value_counts(), query, iloc, and handling NaN.
  2. Sklearn Models:

    • Know default parameters (e.g., SGDRegressor uses max_iter for epochs).
    • Understand alpha in Ridge/Lasso vs. C in Logistic Regression (inverse relationship).
  3. Evaluation Metrics:

    • Confusion matrix → Precision/Recall/F1.
    • Regression → R², MSE.
  4. Clustering:

    • K-Means: Inertia = within-cluster sum of squares.
    • Agglomerative: Hierarchical, uses linkage methods.
  5. Ensemble Methods:

    • Random Forest: bootstrap=True by default.
    • Bagging vs. Boosting: Parallel vs. sequential.
  6. Hyperparameter Tuning:

    • Grid search combinations = product of parameter options.
    • LOO CV trains nn models for nn samples.

Final Note: Focus on code snippets, parameter interpretations, and mathematical formulas for regression/classification metrics. The Mermaid graphs help visualize relationships between concepts. Good luck!