yoklainterview sim

ML Engineer Fe Interactions Basis Expansion Interview Questions

75 verified ML Engineer Fe Interactions Basis Expansion interview questions — solve with answers, learn from explanations, test yourself in a real simulation.

Try the real simulation →

Sample questions

Fe Interactions Basis ExpansionDifficulty 1
In a tabular design matrix, what does adding an interaction term between two numeric columns x1 and x2 mean in the most literal, arithmetic sense?
  • aA new column holding the row-wise sum of the two
  • bA new column holding the arithmetic mean of x1 and x2 for each row
  • cA new column holding the row-wise product of x1 and x2
  • dA new column holding the correlation between x1 and x2 measured over the whole training set
Explanation:An interaction term is simply an elementwise multiplication: the new column's value on any row is that row's x1 multiplied by that row's x2. Sums and means of two columns are still linear combinations, so a linear model can already express them without a new column. A correlation is a single number computed across rows, not a per-row value, so it cannot become a feature column at all.
Fe Interactions Basis ExpansionDifficulty 2
With scikit-learn 1.6, X has shape (200, 3) and you run PolynomialFeatures(degree=2, include_bias=True).fit_transform(X). How many columns does the result have?
  • a10
  • b6
  • c9
  • d12
Explanation:The expansion emits every monomial of total degree 0 through 2 over 3 inputs, which is C(3+2, 2) = 10 columns: one bias, three linear terms, three squares and three distinct pairwise products. Counting only the squares and products, or only the new columns, misses either the bias or the original linear terms, both of which the transformer keeps.
Fe Interactions Basis ExpansionDifficulty 1
In scikit-learn 1.6's PolynomialFeatures, what does include_bias=True concretely put into the output matrix?
  • aThe intercept value that the downstream estimator will eventually learn from the data
  • bA column recording, for each row, how many original features were non-zero on that row
  • cA copy of the original untransformed input columns placed at the front of the matrix
  • dA single column whose value is 1 on every row
Explanation:The bias column is the degree-zero monomial, so its value is the constant 1 for every row regardless of the input. It is a placeholder that lets a downstream estimator fitted without its own intercept still express one. The original linear terms are emitted anyway as the degree-one monomials, independent of this flag.
Fe Interactions Basis ExpansionDifficulty 2
X has 4 numeric columns. Under scikit-learn 1.6 you call PolynomialFeatures(degree=2, interaction_only=True, include_bias=False).fit_transform(X). How many columns come back?
  • a14
  • b10
  • c6
  • d11
Explanation:The output is the 4 original columns plus the C(4, 2) = 6 distinct pairwise products, giving 10. Fourteen would be the count if the four squares were also kept, six counts only the products and drops the original columns, and eleven adds a bias column that this call explicitly disables.
Fe Interactions Basis ExpansionDifficulty 2
A design matrix contains only 0/1 indicator columns. A colleague runs a degree-2 polynomial expansion on it with interaction_only left at its default False. What happens to the squared terms of those indicator columns?
  • aThey come out as columns of zeros
  • bThey mark rows where the indicator changed value
  • cThey are skipped once the transformer sees the column is binary
  • dEach one is an exact duplicate of the indicator column it came from
Explanation:For a value that is only ever 0 or 1, squaring is the identity map: 0 squared is 0 and 1 squared is 1. So every squared indicator column reproduces its source column value for value, adding width without adding any new direction to the matrix. The transformer does not inspect the value range, so it emits these duplicates regardless.
Fe Interactions Basis ExpansionDifficulty 2
A matrix holds one-hot indicators for city (3 categories) and for device (2 categories). You multiply the city=istanbul column by the device=mobile column, row by row. What does the resulting column represent?
  • aAn indicator that fires exactly on rows that are both istanbul and mobile
  • bAn indicator marking rows that are istanbul or mobile, or both at once
  • cThe share of mobile rows among all rows recorded for the city istanbul
  • dAn indicator for istanbul, left untouched by multiplication with a device flag
Explanation:A product of two 0/1 columns is 1 only when both factors are 1, so it is the indicator of the intersection cell of the two categorical variables. That is why crossing two one-hot blocks produces one column per joint category combination. A union would require an addition-style rule, and a share is an aggregate over rows rather than a per-row value.

Test yourself against the 1950-question ML Engineer bank.

Start interview