ML Study Hub

Home / Past papers / MLP End Term / this paper

IIT M IMPROVEMENT FN EXAM QDD2 22 Dec - 22 Dec 2024

MLP End Term37 questions100 marks21 MCQ · 12 MSQ · 4 SAImprovement / forenoon / QDD2
Elapsed 00:00
Comprehension passage - the questions below it refer to this
Based on the above data, answer the given subquestions. question figure
Q1MCQ1 mark
Which of the following commands will return the average age of employees?
  1. question figure
  2. question figure
  3. question figure
  4. question figure
Q2MSQ3 marksselect all that apply
Which of the following commands will return the number of employees in the 'HR ’ department?
  1. question figure
  2. question figure
  3. question figure
  4. question figure
  5. question figure
Q3MSQ3 marksselect all that apply
Which of the following methods can be used to filter employees with a salary greater than 50,000?
  1. question figure
  2. question figure
  3. question figure
  4. question figure
Q4MCQ1 mark
What does the following code return? question figure What does the following code return?
  1. The row with the employee who has the lowest performance score.
  2. The row with the employee who has the highest performance score.
  3. The row with the highest salary.
  4. None of these.
Q5MCQ4 marks
Which of the following code snippets will plot the learning curve for training over 100 epochs? Assume that all necessary imports, parameter settings, and initializations are correctly done, and the variable names suggest the data they hold or point to.
  1. question figure
  2. question figure
  3. question figure
  4. question figure
  5. question figure
Q6MCQ4 marks
question figure
  1. 8
  2. 16
  3. 32
  4. 100
Q7MCQ3 marks
Consider the following code: question figure Consider the following code:
  1. question figure
  2. question figure
  3. question figure
Q8MCQ3 marks
question figure
  1. question figure
  2. question figure
  3. question figure
  4. question figure
Q9MCQ3 marks
question figure
  1. question figure
  2. question figure
  3. question figure
  4. question figure
Q10MCQ3 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.
Q11MCQ3 marks
question figure
  1. The number of base estimators to be trained.
  2. The size of each sample batch for testing.
  3. The maximum number of features used for training.
  4. The number of samples to draw from X to train each base estimator
Q12MCQ3 marks
question figure
  1. Performs hierarchical clustering and outputs cluster distances.
  2. Outputs the silhouette score for the data points.
  3. Groups data points into 2 clusters and outputs the labels of the clusters foreach data point.
  4. Reduces the dimensionality of the dataset to 2 dimensions.
Q13MCQ3 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.
Q14MCQ2 marks
What will be the output of the following code? question figure What will be the output of the following code?
  1. 4
  2. 5
  3. 3
  4. 6
Q15MCQ2 marks
What will be the output of the following code? question figure What will be the output of the following code?
  1. [5, 6]
  2. [4, 5]
  3. [3, 4]
  4. [2, 3]
Q16MCQ2 marks
You have loaded a dataset with 500 samples and 50 features into a Pandas DataFrame. Some samples have missing values for a few features. If you want to remove rows with more than 5 missing values, what method would you use?
  1. question figure
  2. question figure
  3. question figure
  4. question figure
  5. question figure
Q17MCQ2 marks
question figure
  1. Statement 1 False, Statement 2 False
  2. Statement 1 True, Statement 2 False
  3. Statement 1 False, Statement 2 True
  4. Both statements are True
Q18MCQ2 marks
question figure
  1. question figure
  2. question figure
  3. question figure
  4. question figure
Q19MCQ2 marks
What will be the output of the code? question figure
  1. 1.25
  2. 2.56
  3. 4.25
  4. 3.25
  5. Given code will return an error.
Q20MCQ2 marks
question figure
  1. It adjusts the learning rate based on the number of iterations.
  2. It specifies the learning rate to decrease as the model converges.
  3. It specifies the fraction of the dataset used for each step in the stochasticgradient descent.
  4. It defines the initial value for the learning rate and keeps it constantthroughout training.
Q21MCQ2 marks
Which of the following is NOT a hyperparameter in machine learning?
  1. Learning rate in gradient descent
  2. Bias in a linear regression model
  3. Number of clusters in k-means
  4. Minimum leaf size in decision trees
Q22MCQ2 marks
question figure
  1. question figure
  2. question figure
  3. question figure
  4. question figure
  5. question figure
  6. question figure
Q23MCQ2 marks
question figure
  1. It decreases the variance among individual trees.
  2. It increases 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.
Q24MSQ4 marksselect all that apply
Consider the following code: question figure Consider the following code:
  1. [47, 31, 18, 95, 77]
  2. [31, 41, 85, 31]
  3. [47, 31, 18]
  4. [47, 31, 85, 77]
  5. [31, 41, 18, 95, 85, 77]
  6. [18, 95, 85, 77]
Q25MSQ4 marksselect all that apply
question figure
  1. question figure
  2. question figure
  3. question figure
  4. question figure
Q26MSQ4 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
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. GaussianNB
  2. LogisticRegression
  3. SGDClassifier
  4. RandomForestClassifier
Q29MSQ3 marksselect all that apply
question figure
  1. question figure
  2. question figure
  3. question figure
  4. question figure
Q30MSQ3 marksselect all that apply
What parameters of the k-means clustering algorithm should be tuned to optimize the model performance?
  1. question figure
  2. question figure
  3. question figure
  4. question figure
Q31MSQ3 marksselect all that apply
Consider the following options for evaluating the optimal number of clusters in k-means. Which approaches are valid?
  1. Using an Elbow Curve.
  2. Computing Silhouette Scores.
  3. Cross-validation with multiple folds.
  4. All of these
Q32MSQ3 marksselect all that apply
Which of the following statements are correct about the Silhouette Coefficient?
  1. It measures how well each sample is clustered.
  2. A higher score indicates better-defined clusters.
  3. It requires ground truth labels (target variable) to compute.
  4. It can be used to evaluate the quality of any clustering algorithm.
Q33MSQ2 marksselect all that apply
question figure
  1. question figure
  2. question figure
  3. question figure
  4. question figure
  5. question figure
Q34SA3 marks
question figure
Q35SA3 marks
What will be the output of the following code snippet? question figure What will be the output of the following code snippet?
Q36SA3 marks
question figure
Q37SA2 marks
question figure

Answer key

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

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 essential 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 between topics.



1. Core Topics and Concepts

A. Data Preprocessing

  1. Handling Missing Data

    • df.dropna(thresh=N): Drops rows with fewer than N non-NaN values.
    • df.fillna(value): Fills missing values with a specified value.
    • Example: df.dropna(thresh=45) drops rows with >5 missing values (for 50 features).
  1. Feature Scaling

    • StandardScaler: Standardizes features to have mean=0 and variance=1.

      • Formula: z=x−μσz = \frac{x - \mu}{\sigma}
      • scaler.mean_ returns the mean of each feature before scaling.
    • MinMaxScaler: Scales features to a range (default: [0, 1]).

      • Formula: xscaled=x−xmin⁡xmax⁡−xmin⁡x_{\text{scaled}} = \frac{x - x_{\min}}{x_{\max} - x_{\min}}
      • scaler.data_max_ returns the max value of each feature.
  1. Encoding Categorical Data

    • OneHotEncoder: Converts categorical features into binary vectors.

      • Example: ['cat', 'dog'] → [[1, 0], [0, 1]].
      • Output shape: (n_samples, n_categories).
    • PolynomialFeatures: Generates polynomial/combination features.

      • Example: degree=2 for [a, b] → [1, a, b, a², ab, b²].
      • Output shape: (n_samples, 1 + n_features + C(n_features, 2) + ... ).
  1. Feature Selection

    • VarianceThreshold: Removes low-variance features.

      • Example: VarianceThreshold(threshold=0.1) removes features with variance < 0.1.

B. Model Training and Evaluation

  1. Linear Models

    • LinearRegression:

      • fit_intercept=True: Includes a bias term (intercept).
      • fit_intercept=False: Forces the model through the origin.
      • Score (R²): Higher for fit_intercept=True if data has an intercept.
    • SGDRegressor:

      • learning_rate='constant': Fixed learning rate (eta0).
      • partial_fit: Updates model incrementally (useful for large datasets).
      • Loss functions: squared_loss, huber, epsilon_insensitive.
  1. Tree-Based Models

    • DecisionTreeClassifier:

      • Hyperparameters:

        • max_depth: Maximum depth of the tree.
        • min_samples_split: Minimum samples required to split a node.
        • criterion: gini (default) or entropy.
      • Attributes:

        • max_depth: Actual depth of the trained tree.
        • feature_importances_: Importance of each feature.
      • Maximum leaf nodes in a balanced binary tree: 2max_depth2^{\text{max\_depth}}.
    • RandomForestClassifier:

      • max_features: Number of features to consider for splits (lower → higher variance).
      • n_estimators: Number of trees in the forest.
  1. Ensemble Methods

    • BaggingClassifier:

      • max_samples: Number of samples to draw for each base estimator (default: full dataset).
      • bootstrap: Whether to sample with replacement.
    • AdaBoostClassifier:

      • Key hyperparameters: n_estimators, learning_rate.
    • GradientBoostingClassifier:

      • Hyperparameters: n_estimators, learning_rate, max_depth.
  1. Neural Networks

    • MLPClassifier/MLPRegressor:

      • hidden_layer_sizes: Tuple specifying neurons per layer (e.g., (5, 3) → 2 layers).
      • alpha: L2 regularization strength (higher → stronger regularization).
      • partial_fit: Incremental learning (requires warm_start=True for repeated fits).
  1. Clustering

    • KMeans:

      • Hyperparameters: n_clusters, init (e.g., k-means++), max_iter.
      • Evaluation:

        • Elbow Method: Plot inertia vs. n_clusters to find the "elbow."
        • Silhouette Score: Measures cluster cohesion/separation (higher = better).

          • Formula: s=b−amax⁡(a,b)s = \frac{b - a}{\max(a, b)}, where aa = intra-cluster distance, bb = inter-cluster distance.

C. Model Evaluation

  1. Metrics

    • Regression:

      • Mean Squared Error (MSE): MSE=1n∑(yi−y^i)2\text{MSE} = \frac{1}{n} \sum (y_i - \hat{y}_i)^2.
      • R² Score: R2=1−SSresSStotR^2 = 1 - \frac{\text{SS}_{\text{res}}}{\text{SS}_{\text{tot}}}.
    • Classification:

      • Confusion Matrix: TN, FP, FN, TP.
      • ROC-AUC: Area under the ROC curve (higher = better).
      • Log Loss: −1N∑yilog⁡(y^i)-\frac{1}{N} \sum y_i \log(\hat{y}_i).
  1. Cross-Validation

    • KFold: Splits data into k folds (no stratification).
    • StratifiedKFold: Preserves class distribution in each fold.
    • GridSearchCV: Exhaustive search over hyperparameter grid.
    • RandomizedSearchCV: Random sampling of hyperparameter combinations.
  1. Learning Curves

    • Plot training/validation loss vs. iterations/epochs.
    • Example: Track log_loss over epochs for SGDClassifier.

D. Handling Large Datasets

  1. Chunking:

    • pd.read_csv(chunksize=N): Reads file in chunks of N rows.
    • Example: Incremental learning with SGDRegressor.partial_fit.
  2. Incremental Learning:

    • Models supporting partial_fit: SGDClassifier, GaussianNB, PassiveAggressiveClassifier.

E. Dimensionality Reduction

  1. PCA: Not covered in the questions, but often used with StandardScaler.
  2. Feature Selection: Use VarianceThreshold or model-based importance (e.g., feature_importances_ in trees).

2. Key Equations

ConceptEquation
Standard Scalingz=x−μσz = \frac{x - \mu}{\sigma}
MinMax Scalingxscaled=x−xmin⁡xmax⁡−xmin⁡x_{\text{scaled}} = \frac{x - x_{\min}}{x_{\max} - x_{\min}}
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}
MSEMSE=1n∑(yi−y^i)2\text{MSE} = \frac{1}{n} \sum (y_i - \hat{y}_i)^2
Log Loss−1N∑yilog⁡(y^i)-\frac{1}{N} \sum y_i \log(\hat{y}_i)
Silhouette Scores=b−amax⁡(a,b)s = \frac{b - a}{\max(a, b)}
Decision Tree Leaf NodesMax leaves=2max_depth\text{Max leaves} = 2^{\text{max\_depth}} (balanced binary tree)

Graph 1: Data Preprocessing

Graph 2: Model Training

Graph 3: Model Evaluation

Graph 4: Handling Large Data

Graph 5: Clustering Evaluation


4. Exam Tips

  1. Pandas/NumPy:

    • Know df.dropna, df.fillna, df.query, and aggregation methods (mean, median, value_counts).
    • Filtering: df[df['Salary'] > 50000] or df.loc[df['Salary'] > 50000].
  1. Scikit-Learn:

    • Commands:

      • fit, transform, fit_transform.
      • predict vs. predict_proba.
    • Hyperparameters:

      • Tree depth, n_estimators, learning_rate, alpha (regularization).
    • Attributes:

      • coef_, intercept_, feature_importances_, labels_ (clustering).
  1. Mathematics:

    • Focus on scaling formulas, MSE, R², and Silhouette Score.
    • Understand how fit_intercept affects linear models.
  1. Algorithms:

    • Decision Trees: How max_depth and min_samples_split affect overfitting.
    • Ensembles: Bagging vs. boosting (e.g., max_samples in BaggingClassifier).
    • Neural Networks: Role of alpha (regularization) and hidden_layer_sizes.
  1. Evaluation:

    • When to use cross-validation (e.g., GridSearchCV).
    • How to interpret learning curves (training vs. validation loss).
  1. Large Data:

    • Use chunksize with pd.read_csv and partial_fit for incremental learning.
  1. Clustering:

    • KMeans: How to choose n_clusters (Elbow Method, Silhouette Score).
    • Evaluation: Silhouette Score does not require ground truth labels.