DSE Knowledge 5 — Questions and Answers
Question 1: What does the term 'data leakage' mean in a machine learning pipeline?
- Data being lost during preprocessing
- Information from the test set or future data inadvertently influencing model training (Correct answer)
- Sensitive data being exposed to unauthorized users
- Training data being overwritten during model updates
Correct answer: Information from the test set or future data inadvertently influencing model training
Data leakage occurs when information outside the legitimate training data is used to build the model, producing overly optimistic evaluation results.
Question 2: In the context of natural language processing, what does TF-IDF measure?
- The grammatical structure of a sentence
- The importance of a word to a document relative to a corpus (Correct answer)
- The sentiment polarity of a text
- The number of unique tokens in a document
Correct answer: The importance of a word to a document relative to a corpus
TF-IDF weights a word by how frequently it appears in a document (TF) offset by how common it is across all documents (IDF), highlighting distinctive terms.
Question 3: What is a key difference between bagging and boosting ensemble methods?
- Bagging trains models on the same data; boosting uses different datasets
- Bagging trains models in parallel on bootstrap samples; boosting trains sequentially with error-focused reweighting (Correct answer)
- Bagging uses decision trees; boosting requires neural networks
- Bagging reduces variance; boosting reduces variance but not bias
Correct answer: Bagging trains models in parallel on bootstrap samples; boosting trains sequentially with error-focused reweighting
Bagging trains independent learners in parallel on random data subsets to reduce variance, while boosting trains sequentially to reduce both bias and variance.
Question 4: Which distance metric computes the sum of absolute differences between coordinates?
- Euclidean distance
- Cosine similarity
- Manhattan distance (Correct answer)
- Mahalanobis distance
Correct answer: Manhattan distance
Manhattan (L1) distance sums the absolute differences along each dimension, geometrically resembling travel along city blocks.
Question 5: In time series analysis, what does 'stationarity' mean?
- The series has no missing values
- The statistical properties (mean, variance, autocorrelation) do not change over time (Correct answer)
- The series is recorded at fixed intervals
- The series has been scaled to zero mean and unit variance
Correct answer: The statistical properties (mean, variance, autocorrelation) do not change over time
A stationary time series has constant statistical properties across time, which is a prerequisite for many forecasting models such as ARIMA.
Question 6: What is the purpose of one-hot encoding in machine learning preprocessing?
- To normalize numerical features to a 0-1 range
- To convert categorical variables into binary indicator columns for use in algorithms requiring numerical input (Correct answer)
- To impute missing values using the most frequent category
- To reduce the number of categories by merging rare levels
Correct answer: To convert categorical variables into binary indicator columns for use in algorithms requiring numerical input
One-hot encoding represents each category as a separate binary column, allowing algorithms that require numerical input to use categorical variables.
Question 7: Which evaluation metric measures the average squared difference between predicted and actual values?
- Mean Absolute Error (MAE)
- Root Mean Squared Error (RMSE)
- Mean Squared Error (MSE) (Correct answer)
- R-squared (R²)
Correct answer: Mean Squared Error (MSE)
Mean Squared Error averages the squared prediction errors, penalizing large errors more heavily than MAE due to squaring.
What does the term 'data leakage' mean in a machine learning pipeline?