Challenge - 5 Problems
Scaling and Normalization Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
❓ Predict Output
intermediate2:00remaining
Output of Min-Max Scaling on a Simple Array
What is the output of the following code that applies Min-Max scaling to a numpy array?
Data Analysis Python
import numpy as np from sklearn.preprocessing import MinMaxScaler arr = np.array([[10], [20], [30], [40], [50]]) scaler = MinMaxScaler() scaled_arr = scaler.fit_transform(arr) print(scaled_arr.flatten())
Attempts:
2 left
💡 Hint
Min-Max scaling transforms data to a range between 0 and 1 based on the minimum and maximum values.
✗ Incorrect
Min-Max scaling subtracts the minimum value and divides by the range (max-min). Here, 10 maps to 0, 50 maps to 1, and values in between scale linearly.
❓ data_output
intermediate2:00remaining
Effect of Standardization on Data Mean and Std Dev
After applying standard scaling (z-score normalization) to this data, what are the mean and standard deviation of the transformed data?
Data Analysis Python
import numpy as np from sklearn.preprocessing import StandardScaler data = np.array([[5], [10], [15], [20], [25]]) scaler = StandardScaler() scaled_data = scaler.fit_transform(data) mean = scaled_data.mean() std = scaled_data.std() print(round(mean, 2), round(std, 2))
Attempts:
2 left
💡 Hint
StandardScaler centers data to mean 0 and scales to std dev 1.
✗ Incorrect
StandardScaler subtracts the mean and divides by the standard deviation, resulting in data with mean 0 and std dev 1.
🔧 Debug
advanced2:00remaining
Identify the Error in Normalizing Data with sklearn
What error will this code raise when trying to normalize data using sklearn's Normalizer?
Data Analysis Python
from sklearn.preprocessing import Normalizer X = [[1, 2], [3, 4], [5, 6]] normalizer = Normalizer(norm='l3') X_normalized = normalizer.transform(X) print(X_normalized)
Attempts:
2 left
💡 Hint
Check the allowed norm parameters for Normalizer.
✗ Incorrect
Normalizer only accepts 'l1', 'l2', or 'max' for the norm parameter. 'l3' is invalid and causes a ValueError.
🚀 Application
advanced2:00remaining
Choosing Scaling Method for Skewed Data
You have a dataset with a feature that is heavily skewed to the right (many small values, few very large values). Which scaling method is best to prepare this feature for a machine learning model?
Attempts:
2 left
💡 Hint
Skewed data often benefits from transformations that reduce skewness before scaling.
✗ Incorrect
Log transformation reduces skewness by compressing large values. Then standardization centers and scales the data for modeling.
🧠 Conceptual
expert2:00remaining
Understanding Differences Between Scaling and Normalization
Which statement correctly describes the difference between scaling and normalization in data preprocessing?
Attempts:
2 left
💡 Hint
Think about Min-Max scaling vs StandardScaler.
✗ Incorrect
Scaling usually means adjusting data to a fixed range like 0 to 1 (Min-Max). Normalization often means standardizing data to mean 0 and std dev 1 (z-score).