DSE Data Science 5 — Questions and Answers
Question 1: What does the term 'hyperparameter' refer to in machine learning?
- Parameters learned from training data such as weights
- Configuration settings set before training that control the learning process (Correct answer)
- The final output values predicted by the model
- Statistical measures computed from the training set
Correct answer: Configuration settings set before training that control the learning process
Hyperparameters like learning rate, tree depth, and number of layers are set by the practitioner, not learned from data.
Question 2: Which of the following best describes transfer learning?
- Copying the architecture of one model to another without reusing weights
- Reusing a pretrained model's learned representations for a new but related task (Correct answer)
- Sharing a dataset between two different models during training
- Training a model on multiple datasets simultaneously
Correct answer: Reusing a pretrained model's learned representations for a new but related task
Transfer learning fine-tunes a model pretrained on a large dataset (e.g., ImageNet) for a specific downstream task.
Question 3: What is the role of the kernel in a Support Vector Machine (SVM)?
- It initializes the weights of the model before training
- It maps data into a higher-dimensional space to find a linear separating hyperplane (Correct answer)
- It reduces the number of support vectors to speed up inference
- It regularizes the margin to prevent overfitting
Correct answer: It maps data into a higher-dimensional space to find a linear separating hyperplane
Kernel functions compute dot products in a transformed feature space without explicitly computing the transformation.
Question 4: In Bayesian inference, what does the prior distribution represent?
- The likelihood of observing the data given the parameters
- Beliefs about the parameters before observing any data (Correct answer)
- The posterior probability after updating on evidence
- The marginal distribution of the observed data
Correct answer: Beliefs about the parameters before observing any data
The prior encodes existing knowledge or assumptions about a parameter before data is taken into account.
Question 5: What is the main difference between bagging and boosting ensemble methods?
- Bagging trains sequentially to correct errors; boosting trains in parallel
- Bagging trains models in parallel on bootstrap samples; boosting trains sequentially, focusing on errors (Correct answer)
- Bagging uses gradient descent; boosting uses random subsets
- Both methods are identical except for the loss function used
Correct answer: Bagging trains models in parallel on bootstrap samples; boosting trains sequentially, focusing on errors
Bagging reduces variance by averaging parallel models, while boosting reduces bias by iteratively correcting mistakes.
Question 6: Which Python library is most commonly used for constructing and training deep learning models?
- Scikit-learn
- Statsmodels
- PyTorch (Correct answer)
- Pandas
Correct answer: PyTorch
PyTorch (and TensorFlow/Keras) provide dynamic computation graphs and GPU acceleration essential for deep learning.
Question 7: What does 'precision' measure in the context of a classification model?
- The fraction of actual positives correctly identified by the model
- The fraction of predicted positives that are truly positive (Correct answer)
- The overall accuracy across all classes
- The harmonic mean of recall and specificity
Correct answer: The fraction of predicted positives that are truly positive
Precision = TP / (TP + FP), measuring how trustworthy a positive prediction is.
What does the term 'hyperparameter' refer to in machine learning?