Sample questions
Fe Numeric Transforms DistributionsDifficulty 2
A column holds the values 10, 12, 14, 16, 18. After fitting scikit-learn 1.6's StandardScaler on exactly these five values, what does the value 18 become?
- a4.0, the raw distance from the value to the mean
- bAbout 1.414, the distance to the column mean divided by the population standard deviation of 2.8284✓
- cAbout 1.265, the same distance divided by the sample standard deviation
- d1.0, the top of the output range under a range-based rescaling
Explanation:StandardScaler stores mean_ = 14 and scale_ = sqrt(8) ≈ 2.8284, the population standard deviation of the fitted column, so 18 maps to 4 / 2.8284 ≈ 1.4142. Dividing by the sample standard deviation of about 3.1623 would give ≈1.2649, and standardization has no fixed upper bound the way a range-based rescaling does.
Fe Numeric Transforms DistributionsDifficulty 2
In scikit-learn 1.6, a MinMaxScaler is fitted on the column [10, 12, 14, 16, 18] and then asked to transform a new value of 22. What does it return?
- a1.0, since the scaler clamps anything above the fitted maximum back onto the boundary
- b0.0, since an unseen value falls to the bottom
- c1.5, since the fitted formula keeps applying past the maximum✓
- dA ValueError naming the out-of-range input
Explanation:MinMaxScaler stores data_min_ = 10 and data_max_ = 18 and applies the map that subtracts 10 and divides by 8, which for 22 gives 1.5. The clip parameter defaults to False, so the formula is simply evaluated outside the fitted interval instead of being bounded; setting clip=True would cap the result at 1.0.
Fe Numeric Transforms DistributionsDifficulty 1
Two raw features combine multiplicatively: revenue = price × quantity. What happens to that relationship once all three quantities are replaced by their natural logarithms?
- aIt becomes additive: the logged output is the sum of the two logged inputs✓
- bIt stays multiplicative, only with smaller numbers on both sides of the equation
- cIt becomes a ratio of the logged inputs
- dIt disappears; logs discard the link
Explanation:The defining identity of the logarithm is that the log of a product equals the sum of the logs, so a product on the raw scale is exactly a sum on the log scale. This is why a linear model fitted on logged inputs can express a multiplicative power-law relationship that it could not express on the raw scale.
Fe Numeric Transforms DistributionsDifficulty 2
Using NumPy 2.0, an engineer calls np.log on a float array containing the values 0.0, 1.0 and 10.0. What is produced for the first element?
- aAn immediate ValueError that stops the surrounding pipeline before anything downstream runs
- bNaN, the result reported for a negative input
- c0.0, on the convention that the log of zero is zero
- dNegative infinity, signalled by a RuntimeWarning rather than an exception✓
Explanation:np.log evaluated at zero returns negative infinity and NumPy signals it with a RuntimeWarning rather than raising, so a pipeline keeps running with an infinite value inside the array. A negative input is the case that yields NaN, and because neither case stops execution the problem usually surfaces much further downstream.
Fe Numeric Transforms DistributionsDifficulty 2
A numeric column of order amounts contains several exact 0.0 entries. An engineer fits scikit-learn 1.6's PowerTransformer with method='box-cox' on it. What happens?
- aA ValueError is raised naming the strictly positive requirement✓
- bThe fit succeeds and every zero is mapped to the output value zero, leaving the rest of the column intact
- cThe zeros are silently shifted up by one unit before the exponent search begins
- dThe fit succeeds but zero rows come out infinite
Explanation:Box-Cox is defined through a power of the input and through its logarithm, so it is only meaningful for strictly positive values, and scikit-learn refuses the fit with a ValueError stating that the transformation can only be applied to strictly positive data. No automatic shift is applied, so the caller has to decide explicitly what the non-positive rows should become before the fit is attempted.
Fe Numeric Transforms DistributionsDifficulty 3
A column contains 1, 2, 3, 4, 100. scikit-learn 1.6's RobustScaler is fitted on it with default settings, so it centres on the median 3 and divides by the interquartile range 2. What value does the entry 100 take?
- a1.0, because the largest entry in the fitted column defines the top of the output scale
- bAbout 2.0, because the divisor grows together with the most extreme entry present
- c48.5, still far outside the bulk✓
- d0.0, because entries past the upper quartile are folded back toward the centre
Explanation:RobustScaler computes 97 divided by 2, which is 48.5. Choosing median and IQR only makes the fitted centre and width insensitive to the extreme entry; the transform itself is still a plain affine map, so the extreme entry lands far outside the bulk of the column instead of being pulled in.