Correct Answer: Colors of a car (Red, Blue, Green)
Explanation:
Nominal data represents categories that do not have an intrinsic order or ranking. Colors like Red, Blue, and Green are distinct categories with no inherent order, unlike satisfaction ratings or sizes which are examples of Ordinal data.
Incorrect! Try again.
2The number of students in a classroom is an example of what type of data?
Types of data
Easy
A.Continuous numerical data
B.Ordinal categorical data
C.Nominal categorical data
D.Discrete numerical data
Correct Answer: Discrete numerical data
Explanation:
Discrete data can only take specific, countable values (like integers). You can have 30 or 31 students, but not 30.5 students. Continuous data, like height or weight, can take any value within a given range.
Incorrect! Try again.
3What is the primary purpose of data pre-processing in machine learning?
Data pre-processing
Easy
A.To transform raw data into a clean and suitable format for a model
B.To visualize the final results of a model
C.To train the machine learning model
D.To select the best machine learning algorithm
Correct Answer: To transform raw data into a clean and suitable format for a model
Explanation:
Data pre-processing is the crucial first step where raw data is cleaned, transformed, and prepared to make it suitable for training and building machine learning models. It improves the quality of the data, and thereby, the model's performance.
Incorrect! Try again.
4Which of the following is NOT a typical data pre-processing step?
Data pre-processing
Easy
A.Model evaluation and deployment
B.Feature scaling
C.Handling missing values
D.Encoding categorical variables
Correct Answer: Model evaluation and deployment
Explanation:
Handling missing values, encoding categorical variables, and feature scaling are all common and essential data pre-processing techniques. Model evaluation and deployment are later stages in the machine learning lifecycle, performed after the model has been trained.
Incorrect! Try again.
5What is data leakage in machine learning?
data leakage concept
Easy
A.When information from outside the training dataset is used to create the model
B.When the model's accuracy is too low
C.When data is lost due to a hardware failure
D.When the dataset is too small to train a model
Correct Answer: When information from outside the training dataset is used to create the model
Explanation:
Data leakage occurs when the training data contains information about the target that would not be available at the time of prediction. This leads to an overly optimistic model performance during training but poor performance in production.
Incorrect! Try again.
6To prevent data leakage, when should you split your data into training and testing sets?
data leakage concept
Easy
A.After performing feature scaling on the entire dataset
B.Before performing any pre-processing like scaling or imputation
C.It does not matter when you split the data
D.After training the model
Correct Answer: Before performing any pre-processing like scaling or imputation
Explanation:
The data should be split into training and testing sets first. Pre-processing steps like scaling or imputation should then be fitted on the training data only and subsequently applied to both the training and testing data to avoid information from the test set 'leaking' into the training process.
Incorrect! Try again.
7The technique of replacing missing values with a substitute value, like the mean or median, is called:
handling missing values
Easy
A.Imputation
B.Deletion
C.Binning
D.Normalization
Correct Answer: Imputation
Explanation:
Imputation is the process of replacing missing data with substituted values. Common methods include using the mean, median, or mode of the respective column.
Incorrect! Try again.
8Which imputation method is most suitable for a numerical feature with significant outliers?
handling missing values
Easy
A.Mean imputation
B.Zero imputation
C.Median imputation
D.Mode imputation
Correct Answer: Median imputation
Explanation:
The mean is highly sensitive to outliers, so using it for imputation can skew the data. The median is a more robust measure of central tendency and is less affected by extreme values, making it a better choice in this scenario.
Incorrect! Try again.
9What is the simplest strategy for handling rows with missing values?
handling missing values
Easy
A.Deleting the rows
B.Replacing them with the mean
C.Using a predictive model to estimate them
D.Replacing them with the mode
Correct Answer: Deleting the rows
Explanation:
The simplest approach is to remove the entire row (or column) that contains missing values. This is known as listwise deletion. However, this can lead to a significant loss of data if many rows have missing values.
Incorrect! Try again.
10What is an outlier in a dataset?
outliers handling
Easy
A.A data point that is missing a value
B.A categorical data point
C.A data point that is significantly different from other data points
D.The average value of a feature
Correct Answer: A data point that is significantly different from other data points
Explanation:
An outlier is an observation that lies an abnormal distance from other values in a random sample from a population. It is an extreme value that deviates from other observations.
Incorrect! Try again.
11Why is it often important to handle outliers?
outliers handling
Easy
A.They always represent incorrect data entry
B.They help improve the accuracy of all models
C.They can skew statistical measures and negatively affect model performance
D.They make the dataset larger
Correct Answer: They can skew statistical measures and negatively affect model performance
Explanation:
Outliers can have a disproportionate effect on statistical measures like the mean and standard deviation, and they can negatively impact the training process of many machine learning algorithms, leading to a less accurate model.
Incorrect! Try again.
12Which encoding technique converts a categorical feature with N unique categories into N new binary features?
handling categorical data
Easy
A.Target Encoding
B.Ordinal Encoding
C.Label Encoding
D.One-Hot Encoding
Correct Answer: One-Hot Encoding
Explanation:
One-Hot Encoding is a process that creates a new binary (0 or 1) column for each unique category. This is done to represent categorical data in a numerical format that machine learning algorithms can understand, without implying any order between categories.
Incorrect! Try again.
13When would Label Encoding be an appropriate choice over One-Hot Encoding?
handling categorical data
Easy
A.When the categorical variable is ordinal
B.When using tree-based models, always
C.When the categorical variable is nominal
D.When the number of categories is very small (e.g., 2)
Correct Answer: When the categorical variable is ordinal
Explanation:
Label Encoding assigns a unique integer to each category (e.g., Small=1, Medium=2, Large=3). This implies an order, which is perfect for ordinal data. Using it for nominal data can mislead the model into thinking there is a ranking where none exists.
Incorrect! Try again.
14What is the primary goal of feature scaling?
scaling and normalization
Easy
A.To encode categorical data
B.To bring all features to a similar scale or range
C.To handle missing values
D.To remove outliers from the data
Correct Answer: To bring all features to a similar scale or range
Explanation:
Feature scaling is a method used to standardize the range of independent variables or features of data. Since the range of values of raw data varies widely, some machine learning algorithms might not work correctly without it, as features with larger ranges can dominate the learning process.
Incorrect! Try again.
15Min-Max Scaling typically scales the data to which of the following ranges?
scaling and normalization
Easy
A.Mean of 0 and Standard Deviation of 1
B.[-1, 1]
C.[0, 1]
D.[0, 100]
Correct Answer: [0, 1]
Explanation:
Min-Max Scaling, also known as normalization, rescales the features to a fixed range, which is typically 0 to 1. The formula is: .
Incorrect! Try again.
16Which technique transforms features to have a mean of 0 and a standard deviation of 1?
Standardization rescales data so that it has a mean () of 0 and a standard deviation () of 1. The formula for a data point is .
Incorrect! Try again.
17What does 'class imbalance' refer to in a classification problem?
class imbalance handling
Easy
A.When features are not on the same scale
B.When the number of observations per class is not equally distributed
C.When there are too many categorical features
D.When the dataset contains many outliers
Correct Answer: When the number of observations per class is not equally distributed
Explanation:
Class imbalance occurs when one or more classes in a classification dataset have a very low number of samples (the minority class) compared to another class (the majority class). For example, a fraud detection dataset might have 99% non-fraudulent and 1% fraudulent transactions.
Incorrect! Try again.
18Which technique involves creating new synthetic data points in the minority class to balance a dataset?
class imbalance handling
Easy
A.Principal Component Analysis (PCA)
B.Feature Scaling
C.Oversampling (e.g., SMOTE)
D.Undersampling
Correct Answer: Oversampling (e.g., SMOTE)
Explanation:
Oversampling techniques aim to balance the dataset by increasing the size of the minority class. SMOTE (Synthetic Minority Over-sampling Technique) is a popular method that creates new synthetic samples rather than just duplicating existing ones.
Incorrect! Try again.
19The Interquartile Range (IQR) method is commonly used for what purpose?
outliers handling
Easy
A.To handle missing values
B.To encode categorical data
C.To scale numerical data
D.To identify potential outliers
Correct Answer: To identify potential outliers
Explanation:
The Interquartile Range (IQR) is the range between the first quartile (25th percentile) and the third quartile (75th percentile). A common rule of thumb is to identify data points as outliers if they fall below or above .
Incorrect! Try again.
20What is the primary disadvantage of One-Hot Encoding?
handling categorical data
Easy
A.It implies an incorrect order among categories
B.It only works for numerical data
C.It cannot handle more than two categories
D.It can lead to a very high number of features (curse of dimensionality)
Correct Answer: It can lead to a very high number of features (curse of dimensionality)
Explanation:
If a categorical variable has a large number of unique categories (high cardinality), One-Hot Encoding will create an equally large number of new features. This can significantly increase the dimensionality of the dataset, which can make model training more computationally expensive and sometimes lead to poorer performance.
Incorrect! Try again.
21You are working with a dataset containing a feature for 'Annual Income' which has a right-skewed distribution and several missing values. Which imputation method would be the most robust and appropriate choice to fill in the missing data?
Handling missing values
Medium
A.Dropping all rows with missing values
B.Median imputation
C.Mode imputation
D.Mean imputation
Correct Answer: Median imputation
Explanation:
For a skewed distribution, the mean is heavily influenced by outliers and extreme values, making it a poor representation of the central tendency. The median is robust to outliers and skewness, making it a much better choice for imputing missing values in such cases. Mode imputation is for categorical data, and dropping rows would lead to loss of valuable information.
Incorrect! Try again.
22A data scientist is building a model to predict customer churn. Before splitting the data into training and test sets, they apply StandardScaler to the entire dataset. Why is this a problematic approach?
Data leakage concept
Medium
A.It will permanently alter the original data, making it impossible to interpret the model's coefficients.
B.It is computationally inefficient to scale the entire dataset at once.
C.It causes data leakage because information from the test set (its mean and variance) is used to transform the training set.
D.StandardScaler cannot be applied before splitting the data.
Correct Answer: It causes data leakage because information from the test set (its mean and variance) is used to transform the training set.
Explanation:
This is a classic example of data leakage. The scaler learns the parameters (mean and standard deviation) from the entire dataset, including the test set. This information then 'leaks' into the training process, leading to an overly optimistic performance estimate on the test set, as the model has already 'seen' some of its statistical properties.
Incorrect! Try again.
23You are preparing data for a linear regression model. A nominal categorical feature, 'Country', has 5 unique values. Why is One-Hot Encoding preferred over Label Encoding in this scenario?
Handling categorical data
Medium
A.Label Encoding would create a large number of new features, leading to dimensionality issues.
B.One-Hot Encoding is computationally faster for linear models.
C.Label Encoding would introduce an arbitrary ordinal relationship (e.g., 1 < 2 < 3) that the linear model might misinterpret as a meaningful ranking.
D.One-Hot Encoding preserves the original 'Country' column in the dataset.
Correct Answer: Label Encoding would introduce an arbitrary ordinal relationship (e.g., 1 < 2 < 3) that the linear model might misinterpret as a meaningful ranking.
Explanation:
Linear models interpret numerical inputs as having magnitude and order. Label Encoding assigns arbitrary integers (e.g., USA=0, UK=1, Canada=2), which implies that Canada > UK > USA. The model would incorrectly learn a relationship based on this artificial order. One-Hot Encoding avoids this by creating binary columns for each category, representing them as distinct entities without any implied ranking.
Incorrect! Try again.
24You have a dataset with features on vastly different scales, and some of these features contain significant outliers. You need to prepare the data for an SVM model. Which scaling technique would be the most appropriate?
Scaling and normalization
Medium
A.MinMaxScaler
B.Normalizer
C.RobustScaler
D.StandardScaler
Correct Answer: RobustScaler
Explanation:
RobustScaler is specifically designed to handle outliers. It scales features using statistics that are robust to outliers, namely the median and the interquartile range (IQR). StandardScaler (using mean and std dev) and MinMaxScaler (using min and max) are both sensitive to outliers, which can skew the transformed data.
Incorrect! Try again.
25When applying the Synthetic Minority Over-sampling Technique (SMOTE), what is the correct procedure to avoid data leakage and get a reliable estimate of model performance?
Class imbalance handling
Medium
A.Apply SMOTE to the test set only to ensure it is balanced.
B.Apply SMOTE to both the training and test data independently after the split.
C.Perform the train-test split first, and then apply SMOTE only to the training data.
D.Apply SMOTE to the entire dataset before performing a train-test split.
Correct Answer: Perform the train-test split first, and then apply SMOTE only to the training data.
Explanation:
The test set must remain a true, unseen representation of the real-world data distribution. If SMOTE is applied before splitting, synthetic data points generated from the training set could end up in the test set, leading to data leakage. If applied to the test set, you are evaluating the model on an artificially altered distribution, not the real one. Therefore, resampling should only ever be done on the training data.
Incorrect! Try again.
26You are analyzing a feature that is not normally distributed. Which method is generally more reliable for identifying outliers in this case?
Outliers handling
Medium
A.Using the Interquartile Range (IQR) method.
B.Visual inspection using a bar chart.
C.Using the Z-score with a threshold of 3.
D.Removing the top and bottom 1% of the data, regardless of distribution.
Correct Answer: Using the Interquartile Range (IQR) method.
Explanation:
The Z-score method relies on the mean and standard deviation, which are sensitive to outliers and assume a roughly normal distribution. The IQR method is based on percentiles (the 25th and 75th), making it non-parametric and robust to the underlying distribution shape and the presence of outliers.
Incorrect! Try again.
27A dataset contains a feature 'Product_Rating' with possible values: 'Poor', 'Average', 'Good', 'Excellent'. Which data type best describes this feature and why?
Types of data
Medium
A.Interval, because the difference between 'Good' and 'Average' is quantifiable.
B.Ratio, because there is a true zero point in the ratings.
C.Ordinal, because the categories have a clear, meaningful order.
D.Nominal, because the values are distinct categories.
Correct Answer: Ordinal, because the categories have a clear, meaningful order.
Explanation:
This is ordinal data because the values are categories that can be logically ranked (Excellent > Good > Average > Poor). However, the interval between the categories is not guaranteed to be equal or quantifiable (the difference between 'Good' and 'Excellent' isn't necessarily the same as between 'Poor' and 'Average').
Incorrect! Try again.
28In a competition to predict if a patient has a certain disease, a feature treatment_administered is found to be highly predictive. However, this treatment is only administered after a diagnosis is confirmed. Including this feature in the model is an example of what?
Data leakage concept
Medium
A.Multicollinearity
B.The curse of dimensionality
C.Target leakage
D.Outlier-driven correlation
Correct Answer: Target leakage
Explanation:
Target leakage occurs when a feature's value would not be known at the time of prediction in a real-world scenario. Since the treatment is given after the diagnosis (the target variable), it leaks information from the future into the model, leading to an artificially high performance that will not generalize.
Incorrect! Try again.
29You are dealing with a high-cardinality categorical feature like 'UserID', which has thousands of unique values. Applying One-Hot Encoding is infeasible due to the massive number of new features it would create. Which of the following is a viable alternative strategy?
Handling categorical data
Medium
A.Binary Encoding, which creates fewer columns than One-Hot Encoding by using binary representations.
B.Dropping the feature, as high-cardinality features are never useful.
C.Converting the feature to an integer and using it directly in a linear model.
D.Label Encoding, as it only creates one new feature.
Correct Answer: Binary Encoding, which creates fewer columns than One-Hot Encoding by using binary representations.
Explanation:
For high-cardinality features, techniques that reduce dimensionality are preferred. Binary Encoding is a good compromise. It first converts categories to integers (like Label Encoding) and then converts those integers to binary code. Each binary digit then becomes a feature. This creates far fewer features than One-Hot Encoding (log₂(n) features instead of n). Label Encoding is unsuitable for nominal data in many models, and dropping the feature might discard valuable information.
Incorrect! Try again.
30For which of the following machine learning algorithms is feature scaling generally NOT required for the model to perform well?
Scaling and normalization
Medium
A.Support Vector Machines (SVM) with an RBF kernel
B.K-Nearest Neighbors (KNN)
C.Random Forest
D.Principal Component Analysis (PCA)
Correct Answer: Random Forest
Explanation:
Random Forest is a tree-based algorithm. At each node, a decision tree splits a feature based on a threshold value. The choice of the split point is not affected by the scale of the feature; it only depends on the ordering of the values. Therefore, algorithms like Random Forest and other decision tree variants are not sensitive to the scale of the input features. In contrast, distance-based (KNN, SVM) and variance-based (PCA) algorithms are highly sensitive to feature scaling.
Incorrect! Try again.
31You observe that missing values in a 'Salary' column occur more frequently for participants who did not report their 'Level of Education'. This situation, where the probability of a value being missing depends on another observed feature, is known as:
Handling missing values
Medium
A.Missing Completely At Random (MCAR)
B.Missing Not At Random (MNAR)
C.Systematically Missing Data (SMD)
D.Missing At Random (MAR)
Correct Answer: Missing At Random (MAR)
Explanation:
Missing At Random (MAR) is the condition where the missingness of a variable can be explained by other observed variables in the dataset. In this case, the probability of 'Salary' being missing is related to the 'Level of Education' variable. This is distinct from MCAR (purely random) and MNAR (where missingness depends on the unobserved value itself).
Incorrect! Try again.
32What is the primary mechanism by which the Synthetic Minority Over-sampling Technique (SMOTE) works?
Class imbalance handling
Medium
A.It removes majority class samples that are close to minority class samples.
B.It creates new, synthetic minority class samples by interpolating between existing minority samples and their nearest neighbors.
C.It duplicates existing minority class samples at random.
D.It assigns higher weights to the minority class samples during model training.
Correct Answer: It creates new, synthetic minority class samples by interpolating between existing minority samples and their nearest neighbors.
Explanation:
SMOTE's key innovation over simple random oversampling is that it generates new, synthetic data points. It selects a minority class instance, finds its k-nearest minority class neighbors, and creates a synthetic point along the line segment joining the instance and one of its selected neighbors. This helps to create more general decision boundaries.
Incorrect! Try again.
33Instead of removing outliers from a 'house_price' feature, a data scientist applies a log transformation (). What is the primary benefit of this approach?
Outliers handling
Medium
A.It converts the feature into a categorical variable.
B.It guarantees that the transformed feature will have a mean of 0 and a standard deviation of 1.
C.It pulls in the high-value outliers, reducing the skewness of the distribution and making it more symmetric.
D.It completely removes the influence of the outliers on the model.
Correct Answer: It pulls in the high-value outliers, reducing the skewness of the distribution and making it more symmetric.
Explanation:
A log transformation is a variance-stabilizing transformation. For right-skewed data with large outliers, it compresses the range of the larger values more than the smaller values. This reduces the skewness, makes the distribution more symmetric (often closer to normal), and lessens the leverage that extreme outliers have on models like linear regression, without completely discarding their information.
Incorrect! Try again.
34To ensure a robust and generalizable machine learning model, what is the correct order of these common pre-processing steps?
Data pre-processing
Medium
A.1. Impute missing values, 2. Split data into train/test sets, 3. Scale features
B.1. Scale features, 2. Impute missing values, 3. Split data into train/test sets
C.1. Split data into train/test sets, 2. Scale features on the training set, 3. Apply the same scaling to the test set
D.1. Split data into train/test sets, 2. Scale features on the entire dataset, 3. Train the model
Correct Answer: 1. Split data into train/test sets, 2. Scale features on the training set, 3. Apply the same scaling to the test set
Explanation:
The cardinal rule of pre-processing is to prevent data leakage from the test set to the training set. The data must be split first. Then, any data-dependent transformations (like fitting a scaler or an imputer) must be learned only from the training data. The same learned transformation is then applied to the test data to ensure consistency without leaking information.
Incorrect! Try again.
35You are implementing Target Encoding for a categorical feature. What is a common technique to mitigate the risk of overfitting, especially for categories with few samples?
Handling categorical data
Medium
A.Applying a smoothing or credibility factor, which blends the category's mean with the global mean of the target.
B.Removing all categories that appear less than 10 times in the dataset.
C.Using One-Hot Encoding as a backup for rare categories.
D.Using the median of the target variable instead of the mean for encoding.
Correct Answer: Applying a smoothing or credibility factor, which blends the category's mean with the global mean of the target.
Explanation:
Target encoding is prone to overfitting because categories with few samples will have their encoded value determined by just a handful of target values, making them noisy and unreliable. Smoothing addresses this by calculating a weighted average between the category's mean and the overall global mean. For rare categories, the encoded value will be closer to the global mean, making it more robust.
Incorrect! Try again.
36What is the primary difference in the output of StandardScaler versus MinMaxScaler?
Scaling and normalization
Medium
A.MinMaxScaler is a linear transformation, while StandardScaler is non-linear.
B.StandardScaler requires the data to be normally distributed, while MinMaxScaler does not.
C.MinMaxScaler removes outliers, while StandardScaler does not.
D.StandardScaler transforms data to have a mean of 0 and a standard deviation of 1, while MinMaxScaler scales data to a fixed range, typically [0, 1].
Correct Answer: StandardScaler transforms data to have a mean of 0 and a standard deviation of 1, while MinMaxScaler scales data to a fixed range, typically [0, 1].
Explanation:
This is the fundamental difference. StandardScaler centers the data around the mean with a unit standard deviation (Z-score normalization). MinMaxScaler rescales the data to a specific range by shifting and scaling, using the minimum and maximum values in the data. The choice between them depends on the algorithm and the data's properties (e.g., presence of outliers).
Incorrect! Try again.
37You are building a time-series forecasting model and have missing values. Simple mean or median imputation is not ideal. Which of the following would be a more suitable approach for this type of data?
Handling missing values
Medium
A.K-Nearest Neighbors (KNN) imputation.
B.Last Observation Carried Forward (LOCF) or interpolation.
C.Dropping the time steps with missing data.
D.Replacing missing values with a constant like -999.
Correct Answer: Last Observation Carried Forward (LOCF) or interpolation.
Explanation:
Time-series data has an inherent temporal order. Methods like LOCF (using the last known value) or linear/spline interpolation respect this order by using adjacent time steps to estimate the missing value. Mean/median imputation ignores the temporal dependency, and KNN imputation can be computationally expensive and may not respect the time flow.
Incorrect! Try again.
38You are working on a credit card fraud detection project where fraud cases (positive class) are only 0.1% of the data. You train a model and achieve 99.9% accuracy. Why is accuracy a misleading metric in this context?
Class imbalance handling
Medium
A.The dataset is too small for accuracy to be a stable metric.
B.Accuracy is computationally expensive to calculate on imbalanced datasets.
C.Accuracy can only be used for models that output probabilities.
D.The model might be achieving high accuracy simply by predicting 'not fraud' for every single transaction.
Correct Answer: The model might be achieving high accuracy simply by predicting 'not fraud' for every single transaction.
Explanation:
This is known as the accuracy paradox. A naive model that always predicts the majority class ('not fraud') would achieve 99.9% accuracy but would be completely useless, as it would never identify any fraudulent transactions. In such cases, metrics like Precision, Recall, F1-Score, or the AUC-ROC are far more informative because they evaluate the model's ability to correctly identify the rare, minority class.
Incorrect! Try again.
39A feature in your dataset is 'postal_code'. While it is numerical, why is it incorrect to treat it as a continuous or ratio variable in a machine learning model?
Types of data
Medium
A.Because postal codes often contain missing values that must be imputed first.
B.Because the numerical difference between two postal codes (e.g., 90210 vs 90211) is not a meaningful measure of distance or magnitude.
C.Because postal codes are always integers and models require floating-point numbers.
D.Because postal codes have a true zero, making them ratio data by definition.
Correct Answer: Because the numerical difference between two postal codes (e.g., 90210 vs 90211) is not a meaningful measure of distance or magnitude.
Explanation:
'Postal code' is a classic example of a nominal variable that happens to be represented by numbers. The numbers are labels for geographic areas. There is no inherent order or magnitude in the numbers themselves; the difference between two codes is meaningless. Treating it as a continuous variable would cause a model to learn incorrect relationships based on this artificial magnitude.
Incorrect! Try again.
40Which of the following models is inherently more robust to outliers in the feature space, often requiring less stringent outlier pre-processing?
Outliers handling
Medium
A.Support Vector Machines (SVM)
B.Linear Regression
C.Decision Tree based models (e.g., Random Forest)
D.K-Means Clustering
Correct Answer: Decision Tree based models (e.g., Random Forest)
Explanation:
Decision trees make splits on features to partition the data. An outlier might be partitioned into its own leaf, but its large value does not affect the splits in other parts of the tree. This makes them robust to outliers. In contrast, Linear Regression, SVMs, and K-Means Clustering are all sensitive to outliers because they are based on minimizing distances or errors, and outliers can exert significant leverage on the final model or cluster centers.
Incorrect! Try again.
41You are building a credit default model. You engineer a new feature z_score_income_by_profession by calculating the Z-score of each individual's income relative to the mean and standard deviation of income within their stated profession. You calculate these means and standard deviations using the entire dataset and then perform a 5-fold cross-validation. Why is this approach a form of data leakage?
data leakage concept
Hard
A.The mean and standard deviation for a profession are calculated using data from all 5 folds, so information from the validation fold 'leaks' into the feature creation for the training folds.
B.Using profession as a grouping variable introduces societal biases into the model.
C.This is not data leakage; it is a valid form of feature engineering known as target-unaware group-wise normalization.
D.Z-score transformation is a form of scaling and should only be applied after the model has been trained.
Correct Answer: The mean and standard deviation for a profession are calculated using data from all 5 folds, so information from the validation fold 'leaks' into the feature creation for the training folds.
Explanation:
Data leakage occurs when information from outside the training dataset is used to create the model. In a cross-validation setting, each fold serves as a hold-out test set once. By calculating the mean and standard deviation for each profession using the entire dataset, the feature values for samples in the training folds are influenced by the values of samples that will be in the validation fold. The correct approach is to compute these statistics only from the training data within each fold of the cross-validation loop and then apply that transformation to the validation data.
Incorrect! Try again.
42You are working with a high-cardinality categorical feature 'user_id' (over 1 million unique IDs). You choose to use Target Encoding to convert it into a numerical feature for a gradient boosting model. What is the most critical step to prevent severe overfitting and data leakage when using this technique?
handling categorical data
Hard
A.Using One-Hot Encoding instead, as it is immune to overfitting.
B.Applying a smoothing factor or a Bayesian averaging approach, especially for categories with few samples.
C.Hashing the 'user_id' feature before applying the target encoding.
D.Normalizing the encoded feature using StandardScaler after the transformation.
Correct Answer: Applying a smoothing factor or a Bayesian averaging approach, especially for categories with few samples.
Explanation:
Target Encoding directly uses the target variable to create the encoding, which carries a high risk of overfitting. For a category with only one sample, the encoded value would be either 0 or 1, causing the model to perfectly 'memorize' the training label. Applying a smoothing factor (e.g., blending the category's mean with the global mean of the target) is crucial. This technique, often implemented as part of a careful cross-validation strategy, ensures that the encoding for rare categories is regularized towards the global average, mitigating the risk of the model relying too heavily on noisy, high-variance estimates from small groups.
Incorrect! Try again.
43Consider a dataset where missing values in a feature 'serum_level' are suspected to be Missing Not At Random (MNAR). Specifically, patients with very high or very low serum levels are less likely to have their values recorded. In this scenario, why would MICE (Multivariate Imputation by Chained Equations) likely produce biased estimates if used naively?
handling missing values
Hard
A.Because MICE requires the data to be normally distributed, which is unlikely for 'serum_level'.
B.Because MICE can only handle numerical data and 'serum_level' might be stored as a string.
C.Because MICE's underlying assumption is that data is Missing at Random (MAR) or Missing Completely at Random (MCAR), and it cannot model the mechanism causing the missingness itself.
D.Because MICE is a deterministic method and will always impute the same value for a given pattern, ignoring the inherent uncertainty.
Correct Answer: Because MICE's underlying assumption is that data is Missing at Random (MAR) or Missing Completely at Random (MCAR), and it cannot model the mechanism causing the missingness itself.
Explanation:
MICE works by building a series of regression models to predict missing values based on the other features. Its core assumption is that the 'missingness' can be explained by the observed values in other columns (MAR). In an MNAR scenario, the reason for missingness depends on the unobserved value itself (e.g., very high values are missing because they are high). MICE, without being explicitly modeled to handle the MNAR mechanism (e.g., through a selection model), will impute values based on the distribution of the observed data, leading to biased estimates that don't reflect the true underlying distribution of the complete data.
Incorrect! Try again.
44You are using SMOTE (Synthetic Minority Oversampling TEchnique) to handle a severely imbalanced dataset. A colleague warns you that SMOTE can be detrimental when the minority class is very noisy and overlaps significantly with the majority class. What is the primary reason for this warning?
class imbalance handling
Hard
A.SMOTE will change the distribution of the majority class, leading to information loss.
B.SMOTE only works by duplicating existing minority samples, not creating new ones.
C.SMOTE may generate synthetic samples in the overlapping region, effectively blurring the decision boundary and making class separation harder.
D.SMOTE is computationally too expensive for datasets with significant class overlap.
Correct Answer: SMOTE may generate synthetic samples in the overlapping region, effectively blurring the decision boundary and making class separation harder.
Explanation:
SMOTE creates synthetic samples by interpolating between a minority sample and its k-nearest minority neighbors. If a minority sample is noisy or located deep within the majority class region, its nearest minority neighbors might be far away, across a dense region of majority samples. Interpolating between them can create synthetic data points that are ambiguous and fall in areas where the class boundary should be sharp. This process is called 'overgeneralization' and can introduce more noise, making it more difficult for a classifier to learn a clear separation.
Incorrect! Try again.
45You are preparing a dataset with several features for a Support Vector Machine (SVM) with an RBF kernel. One feature, 'user_age', ranges from 18-90, while another, 'account_balance', ranges from -5,000 to 2,000,000. Both features contain significant outliers. Which scaling method is most appropriate and why?
scaling and normalization
Hard
A.No scaling is needed, as tree-based kernels like RBF are immune to feature scale.
B.MinMaxScaler, because it scales data to a fixed range [0, 1], which guarantees the fastest convergence for the SVM algorithm.
C.RobustScaler, because it uses the interquartile range (IQR) to scale, making it insensitive to the influence of extreme outliers.
D.StandardScaler, because it centers the data at zero, which is a strict requirement for SVMs.
Correct Answer: RobustScaler, because it uses the interquartile range (IQR) to scale, making it insensitive to the influence of extreme outliers.
Explanation:
SVMs with RBF kernels are distance-based algorithms and are highly sensitive to feature scaling. The presence of significant outliers makes StandardScaler (which uses mean and standard deviation) and MinMaxScaler (which uses min and max) poor choices. Outliers will heavily skew the mean/std dev and the min/max values, causing the majority of the data points to be compressed into a very small range. RobustScaler is the best choice because it scales data based on the median and the interquartile range (IQR), which are statistics robust to outliers. This ensures that the scaling reflects the bulk of the data's distribution, not the extremities.
Incorrect! Try again.
46Instead of removing outliers, a data scientist decides to use Winsorization at the 98th percentile for a right-skewed feature. What is a key theoretical advantage of this method over simply capping the values at a fixed threshold (e.g., a domain-knowledge-based maximum)?
outliers handling
Hard
A.Winsorization guarantees that the feature will have a normal distribution after transformation.
B.Winsorization is guaranteed to improve the performance of any linear model.
C.Winsorization is a non-parametric method, while capping at a fixed threshold is parametric.
D.Winsorization pulls outliers towards the tail of the distribution, rather than clustering them at an arbitrary point, which can better preserve the feature's variance structure.
Correct Answer: Winsorization pulls outliers towards the tail of the distribution, rather than clustering them at an arbitrary point, which can better preserve the feature's variance structure.
Explanation:
Winsorization replaces extreme values with the value at a certain percentile (e.g., the 98th percentile). This means all values above the 98th percentile are set equal to the value at the 98th percentile. Capping at a fixed threshold can be arbitrary and might create an artificial cluster of data points at that threshold if it's not chosen carefully. Winsorization, by using a data-driven percentile, is less arbitrary. More importantly, it clips the tail without completely removing it, which can be less disruptive to the overall variance and relationships with other variables compared to creating a large, artificial spike at a single capped value.
Incorrect! Try again.
47In a time-series forecasting problem, you create features like a 7-day rolling average of sales. For a given day t, you calculate this average using data from days t-3 to t+3. You then use this feature to predict sales on day t. This is a classic example of data leakage. What is the correct way to engineer this feature?
data leakage concept
Hard
A.Use a 'trailing' or 'lagged' window, calculating the average for day t using data from days t-7 to t-1.
B.Calculate the rolling average over the entire dataset to get a stable global baseline.
C.Apply a Box-Cox transformation to the sales data before calculating the rolling average.
D.Use a 'centered' window but with a much larger window size, such as 30 days, to smooth out the noise.
Correct Answer: Use a 'trailing' or 'lagged' window, calculating the average for day t using data from days t-7 to t-1.
Explanation:
The original approach uses future data (days t+1, t+2, t+3) to create a feature for predicting the target at time t. In a real-world prediction scenario, this future information would be unavailable. This is a severe form of data leakage. The correct, non-leaky approach is to use a trailing (or lagged) window, where all feature calculations for a given time point t rely only on information that was available at or before t-1. Using data from t-7 to t-1 ensures the feature is based purely on past information.
Incorrect! Try again.
48You are comparing One-Hot Encoding (OHE) and Dummy Coding for a categorical feature with 5 categories (A, B, C, D, E) for a multiple linear regression model. What is the primary statistical advantage of using Dummy Coding (which creates k-1 new features) over OHE (which creates k features) in this context?
handling categorical data
Hard
A.It automatically assigns a baseline category that has the highest frequency, improving model accuracy.
B.It avoids the 'dummy variable trap' (perfect multicollinearity), which can make the model's coefficient estimates unstable and uninterpretable.
C.It preserves the ordinal nature of the categories, which OHE fails to do.
D.It is more computationally efficient because it generates fewer columns.
Correct Answer: It avoids the 'dummy variable trap' (perfect multicollinearity), which can make the model's coefficient estimates unstable and uninterpretable.
Explanation:
In a linear regression model that includes an intercept term, using OHE (k dummy variables) creates perfect multicollinearity. This is because the sum of the OHE columns for any observation is always 1, which is perfectly correlated with the intercept column (a column of all 1s). This condition, known as the dummy variable trap, means there is no unique solution for the model's coefficients. Dummy Coding (k-1 variables) breaks this perfect correlation by dropping one category (the reference category), allowing the model to estimate stable and interpretable coefficients for the remaining categories relative to the reference.
Incorrect! Try again.
49You are training a model on an imbalanced dataset and decide to use ADASYN (Adaptive Synthetic Sampling) instead of SMOTE. In which scenario would ADASYN be theoretically superior to SMOTE?
class imbalance handling
Hard
A.When the minority class samples that are harder to learn (i.e., those with more majority class neighbors) should be prioritized for synthetic sample generation.
B.When the goal is to generate synthetic samples that are exact duplicates of the original minority samples.
C.When the dataset is extremely large, as ADASYN is computationally simpler than SMOTE.
D.When the feature space has a mix of categorical and numerical features.
Correct Answer: When the minority class samples that are harder to learn (i.e., those with more majority class neighbors) should be prioritized for synthetic sample generation.
Explanation:
The key difference between SMOTE and ADASYN is how they select minority points for synthesis. SMOTE generates an equal number of synthetic samples for each minority instance. ADASYN, on the other hand, is adaptive. It calculates a ratio based on the number of majority class samples in the neighborhood of each minority sample. Minority samples in 'harder-to-learn' regions (i.e., closer to the decision boundary, with more majority neighbors) are assigned a higher weight, and consequently, more synthetic samples are generated around them. This adaptively shifts the decision boundary to focus on the difficult-to-classify examples.
Incorrect! Try again.
50A dataset contains features with drastically different distributions (e.g., one is uniform, one is bimodal, one is heavily skewed). You want to use a method that forces all features to follow a uniform or normal distribution. Which pre-processing technique would achieve this, and what is its primary use case?
scaling and normalization
Hard
A.StandardScaler, used to center data around a mean of 0 and standard deviation of 1.
B.QuantileTransformer, used to handle non-Gaussian distributed features and reduce the impact of outliers for distance-based models.
C.Normalizer (per-sample), used to scale samples to have unit norm, which is required for text classification.
D.PowerTransformer with the 'box-cox' method, used exclusively for positive, skewed data to make it linear.
Correct Answer: QuantileTransformer, used to handle non-Gaussian distributed features and reduce the impact of outliers for distance-based models.
Explanation:
QuantileTransformer is a powerful non-linear transformation that maps the cumulative distribution function (CDF) of a feature to a target distribution (either uniform or normal). By mapping data points to their quantiles, it effectively forces any input distribution into the desired one. This is particularly useful for distance-based algorithms (like k-NN or SVMs) or models that make assumptions about feature distributions, as it can spread out the most frequent values and reduce the influence of both inliers and outliers.
Incorrect! Try again.
51You have a longitudinal dataset tracking patient measurements over time. The 'blood_pressure' feature has missing values. A simple approach is to use LOCF (Last Observation Carried Forward). What is the most significant statistical risk associated with this imputation method in time-series analysis?
handling missing values
Hard
A.It is computationally intensive for long time series.
B.It artificially reduces the variance of the feature and creates spurious temporal correlations, potentially leading to an underestimation of confidence intervals.
C.It can only be applied if the first observation in the series is not missing.
D.It introduces a systematic bias by always imputing values that are lower than the true mean.
Correct Answer: It artificially reduces the variance of the feature and creates spurious temporal correlations, potentially leading to an underestimation of confidence intervals.
Explanation:
LOCF propagates a single value across multiple subsequent time steps. This creates flat, constant segments in the time series wherever data was missing. This process artificially reduces the true variability of the series because the imputed values do not fluctuate as they naturally would. Furthermore, it creates a false autocorrelation structure, as the imputed values are perfectly correlated with the last observed value. This can mislead time-series models and cause them to produce overly optimistic performance metrics and narrower, incorrect confidence intervals for forecasts.
Incorrect! Try again.
52You are using the Isolation Forest algorithm for outlier detection. The algorithm works by building an ensemble of 'isolation trees' and identifies outliers as points that have a short average path length from the root node. Why is this method particularly effective for large, high-dimensional datasets compared to distance-based methods like DBSCAN or Local Outlier Factor (LOF)?
outliers handling
Hard
A.Isolation Forest does not rely on distance calculations, which suffer from the 'curse of dimensionality' where distances between all points become almost equal.
B.Isolation Forest can only detect global outliers, not local ones, which simplifies the problem in high dimensions.
C.Isolation Forest requires the data to be scaled and normalized, which is a simpler pre-processing step than the parameter tuning required for DBSCAN.
D.Isolation Forest is a supervised algorithm that learns from a small set of labeled outliers, making it more accurate.
Correct Answer: Isolation Forest does not rely on distance calculations, which suffer from the 'curse of dimensionality' where distances between all points become almost equal.
Explanation:
Distance-based outlier detection methods like DBSCAN, LOF, or k-NN rely on calculating distances (e.g., Euclidean) between points. In high-dimensional spaces, the concept of 'neighborhood' or 'density' becomes less meaningful because the distance between any two points tends to become very similar (curse of dimensionality). Isolation Forest avoids this entirely. It works by randomly partitioning the feature space. Outliers, being 'few and different,' are easier to isolate and thus tend to be found closer to the root of the trees (shorter path lengths), regardless of the dimensionality. This makes its performance more robust in high-dimensional settings.
Incorrect! Try again.
53A feature in your dataset is 'customer_satisfaction_rating' with values [1, 2, 3, 4, 5], representing 'Very Unsatisfied' to 'Very Satisfied'. A colleague treats this feature as a continuous numerical variable and applies StandardScaler. What is the primary theoretical flaw in this approach?
Types of data
Hard
A.StandardScaler cannot handle integer data; it requires floating-point inputs.
B.The range is too small (1-5), and scaling will have no significant effect on any model.
C.The data is ordinal, not interval or ratio. StandardScaler assumes mathematical operations like mean and standard deviation are meaningful, but the 'distance' between 1 and 2 may not be the same as between 4 and 5.
D.The data is categorical, and One-Hot Encoding should have been used.
Correct Answer: The data is ordinal, not interval or ratio. StandardScaler assumes mathematical operations like mean and standard deviation are meaningful, but the 'distance' between 1 and 2 may not be the same as between 4 and 5.
Explanation:
This feature is an example of ordinal data: there is a clear order, but the intervals between the values are not guaranteed to be equal. Treating it as a continuous numerical variable and applying StandardScaler () is flawed because the calculations of mean () and standard deviation () assume the data is on an interval or ratio scale where differences and averages are meaningful. The assumption that the difference in satisfaction between 'Very Unsatisfied' (1) and 'Unsatisfied' (2) is identical to the difference between 'Satisfied' (4) and 'Very Satisfied' (5) is often invalid and can introduce incorrect information into the model.
Incorrect! Try again.
54You are designing a data pre-processing pipeline for a logistic regression model. The pipeline must include missing value imputation (using the mean), one-hot encoding for a categorical feature, and feature scaling using StandardScaler. What is the correct order of these operations, and why is any other order incorrect?
Data pre-processing
Hard
A.Scaling -> Imputation -> One-Hot Encoding. Scaling first ensures that the imputation value (the mean) is calculated on the scaled data.
B.One-Hot Encoding -> Imputation -> Scaling. This is the most efficient order as it allows for parallel processing.
C.Imputation -> One-Hot Encoding -> Scaling. Encoding before imputation would be complex, and scaling before encoding would ignore the binary nature of the new columns.
D.The order does not matter as all three operations are linear transformations.
Correct Answer: Imputation -> One-Hot Encoding -> Scaling. Encoding before imputation would be complex, and scaling before encoding would ignore the binary nature of the new columns.
Explanation:
The correct order is critical. 1) Imputation: This should be done first on the original features. If you encode first, a single missing value in a categorical column turns into multiple missing values across all the new binary columns, making imputation much harder. 2) One-Hot Encoding: This converts the now-complete categorical feature into numerical binary columns. 3) Scaling: This should be last. If you scale before encoding, the scaler learns from the distribution of the original numerical features but has no knowledge of the new [0, 1] columns. Scaling the one-hot encoded columns after they are created ensures all features are on a comparable scale for the logistic regression model. Applying scaling before imputation is also wrong because the mean used for imputation would be 0 (from the scaled training data), which might not be a sensible imputation value.
Incorrect! Try again.
55When would using Hash Encoding be a clearly superior choice over One-Hot Encoding (OHE) for a categorical feature?
handling categorical data
Hard
A.For any feature with fewer than 10 categories, as it is more computationally efficient.
B.In an online learning environment with a very high-cardinality feature where new categories appear frequently and memory is a major constraint.
C.When training a linear regression model, as hash collisions have a regularizing effect similar to L2 regularization.
D.When the categorical feature has a clear ordinal relationship that must be preserved.
Correct Answer: In an online learning environment with a very high-cardinality feature where new categories appear frequently and memory is a major constraint.
Explanation:
Hash Encoding (or the 'hashing trick') shines in specific, constrained environments. Its primary advantages are: 1) It controls the output dimensionality to a fixed size, regardless of the number of unique categories, making it extremely memory-efficient for high-cardinality features. 2) It can handle new, unseen categories 'on the fly' without needing to refit the encoder, which is ideal for online/streaming systems. OHE would require adding a new column for every new category, which is infeasible. The main drawback of hashing is hash collisions (different categories mapping to the same hash), but in many large-scale applications, this information loss is an acceptable trade-off for the memory and processing gains.
Incorrect! Try again.
56You are working on a fraud detection problem. Instead of using a data-level technique like SMOTE or ADASYN, you opt for an algorithmic-level approach by adjusting the class_weight parameter in your logistic regression model. How does setting class_weight='balanced' typically affect the model's decision-making process?
class imbalance handling
Hard
A.It internally resamples the dataset to be balanced before each training epoch.
B.It changes the optimization algorithm from gradient descent to a weighted least squares method.
C.It adds a regularization term to the loss function that is proportional to the class imbalance ratio.
D.It increases the penalty for misclassifying the minority class by a factor inversely proportional to its frequency, forcing the decision boundary to shift towards the majority class.
Correct Answer: It increases the penalty for misclassifying the minority class by a factor inversely proportional to its frequency, forcing the decision boundary to shift towards the majority class.
Explanation:
Adjusting class weights does not change the data itself. Instead, it modifies the loss function. When calculating the loss during training, the errors made on samples from the minority class are multiplied by a larger weight, while errors on majority class samples get a smaller weight. For a logistic regression model, this means that the model is more heavily penalized for misclassifying a rare positive (fraud) case than for misclassifying a common negative (non-fraud) case. This effectively pushes the decision boundary away from the minority class samples to classify them more accurately, at the potential cost of misclassifying more majority class samples.
Incorrect! Try again.
57When using KNNImputer, what is a significant potential risk if the feature space is high-dimensional and features are not scaled properly before imputation?
handling missing values
Hard
A.The imputer will default to mean imputation if the number of dimensions exceeds a certain threshold (typically 100).
B.The algorithm's time complexity will increase from to , making it unusable.
C.The curse of dimensionality will cause all nearest-neighbor distances to converge to zero, preventing the algorithm from finding any neighbors.
D.The distance metric will be dominated by features with large scales, causing the 'nearest neighbors' to be chosen based on only a few features, leading to irrelevant imputations.
Correct Answer: The distance metric will be dominated by features with large scales, causing the 'nearest neighbors' to be chosen based on only a few features, leading to irrelevant imputations.
Explanation:
KNNImputer works by finding the k-nearest neighbors to a sample with missing values and then imputing the missing value based on the average (or mode) of the values from those neighbors. The 'nearest' is determined by a distance metric (e.g., Euclidean distance). If features are on vastly different scales (e.g., 'age' from 20-60 and 'income' from 30,000-200,000), the 'income' feature will completely dominate the distance calculation. The algorithm will find neighbors that are close in terms of income, ignoring all other features. This leads to poor, biased imputation because the concept of 'similarity' is skewed. Therefore, scaling features before using KNNImputer is a critical pre-processing step.
Incorrect! Try again.
58You have a very sparse dataset (many zero values), common in text analysis (e.g., TF-IDF vectors) or transaction data. You need to apply scaling before feeding it to a model. Why is StandardScaler generally a poor choice for this type of data, and which scaler would be more appropriate?
scaling and normalization
Hard
A.StandardScaler will center the data by subtracting the mean, which destroys sparsity by converting all zero entries into non-zero, dense floating-point numbers. MaxAbsScaler is more appropriate.
B.StandardScaler cannot handle zero values and will raise a 'division by zero' error during transformation.
C.StandardScaler is computationally inefficient for sparse matrices. RobustScaler would be a better choice.
D.Sparse data does not require scaling, as the zero values act as a natural baseline.
Correct Answer: StandardScaler will center the data by subtracting the mean, which destroys sparsity by converting all zero entries into non-zero, dense floating-point numbers. MaxAbsScaler is more appropriate.
Explanation:
Sparsity is a valuable property, especially for memory and computation. StandardScaler calculates the mean of each feature and subtracts it from every entry. Since the mean of a sparse feature is typically a small non-zero number, this operation will turn almost all zero values into non-zero values, destroying the matrix's sparsity and dramatically increasing memory requirements. MaxAbsScaler and Normalizer are better choices as they scale by dividing by the maximum absolute value or by the norm, respectively. These operations preserve the zero entries, thus maintaining the data's sparsity.
Incorrect! Try again.
59Combining undersampling of the majority class with oversampling of the minority class is a common hybrid strategy. Which of the following pairs represents a sophisticated and synergistic combination for cleaning noisy datasets?
class imbalance handling
Hard
A.ADASYN for oversampling followed by Cluster Centroids for undersampling.
B.SMOTE for oversampling followed by Edited Nearest Neighbours (ENN) for undersampling.
C.Tomek Links for undersampling followed by SMOTE for oversampling.
D.Random Undersampling followed by Random Oversampling.
Correct Answer: Tomek Links for undersampling followed by SMOTE for oversampling.
Explanation:
This combination is particularly powerful. A Tomek Link is a pair of instances of opposite classes who are each other's nearest neighbors. These pairs are often considered noise or borderline cases. By removing the majority class sample from each Tomek Link, you 'clean' the space around the minority class, making the class boundary clearer. After this cleaning step, applying SMOTE is more effective because it is less likely to generate synthetic samples in noisy, overlapping regions. This two-step process (clean first, then generate) is a well-regarded strategy for improving classifier performance on imbalanced and noisy data.
Incorrect! Try again.
60During a data science competition, you discover that the row_id in the training data is perfectly correlated with the time the event occurred. For example, lower row_id values correspond to earlier dates. You decide not to use the row_id as a feature directly. However, you perform k-fold cross-validation by randomly shuffling and splitting the data. Why might your local cross-validation score be misleadingly high and not reflect your score on the future-dated, hidden test set?
data leakage concept
Hard
A.K-fold cross-validation is not statistically valid for time-dependent data; bootstrap validation should be used instead.
B.The row_id is a categorical feature and should have been one-hot encoded before cross-validation.
C.The model is overfitting to the row_id even though it's not an explicit feature.
D.The random shuffling violates the temporal ordering. The model is trained on future data to predict the past within each fold, a form of leakage that won't be possible on the real test set.
Correct Answer: The random shuffling violates the temporal ordering. The model is trained on future data to predict the past within each fold, a form of leakage that won't be possible on the real test set.
Explanation:
This is a subtle but critical form of data leakage in time-series-like problems. When you randomly shuffle the data, your training set for a given fold will contain data points from the future relative to the data points in your validation set. The model inadvertently learns patterns or distributions from the future that help it predict the past/present, leading to an artificially inflated CV score. The proper way to validate time-dependent data is with a time-based split, such as TimeSeriesSplit or a simple train/validation split on the time axis (e.g., train on 2020, validate on 2021), which mimics the real-world scenario of predicting the future based only on the past.