yoklainterview sim

ML Engineer Cml Linear Logistic Internals Interview Questions

75 verified ML Engineer Cml Linear Logistic Internals interview questions — solve with answers, learn from explanations, test yourself in a real simulation.

Try the real simulation →

Sample questions

Cml Linear Logistic InternalsDifficulty 1
What quantity does scikit-learn's LinearRegression actually minimise when it fits coefficients?
  • aThe sum of the absolute differences between the predictions and the observed targets
  • bThe sum of the squared differences between the predictions and the observed targets
  • cThe largest single absolute residual produced on any row of the training matrix
  • dThe residual sum of squares plus the sum of the squared coefficients it learned
Explanation:LinearRegression solves the ordinary least squares problem: it picks the coefficient vector that makes the sum of squared residuals as small as possible. Minimising absolute residuals is quantile/least-absolute-deviation regression, minimising the worst residual is a minimax fit, and adding a squared-coefficient term is what Ridge does. Squaring is what makes the solution reachable in closed form through a linear system.
Cml Linear Logistic InternalsDifficulty 2
In logistic regression, which quantity is modelled as a plain linear function of the input features?
  • aThe probability of the positive class itself, kept inside the zero-to-one range
  • bThe squared distance from the row to the fitted decision boundary in feature space
  • cThe natural logarithm of the odds that the row belongs to the positive class
  • dThe ratio of positive to negative labels observed across the whole training set
Explanation:The logit link means that intercept plus weighted feature sum equals log(p / (1 - p)); the sigmoid is just the inverse of that link, mapping the linear score back to a probability. Modelling the probability itself linearly would let predictions leave the zero-to-one range, which is exactly the problem the link solves. The class balance of the training set is a property of the data, not something the linear part predicts.
Cml Linear Logistic InternalsDifficulty 2
A fitted binary LogisticRegression has coef_ = [[0.5]] and intercept_ = [-1.0]. What does predict_proba return for the positive class at x = 2.0?
  • a0.500
  • b0.269
  • c0.731
  • d0.881
Explanation:The linear predictor is 0.5 * 2.0 - 1.0 = 0.0, and the sigmoid of zero is exactly 0.5, so the row sits on the decision boundary. The other values correspond to linear predictors of -1.0, +1.0 and +2.0, which would need different feature values or a different intercept.
Cml Linear Logistic InternalsDifficulty 2
In scikit-learn 1.6, what exactly does the C hyperparameter of LogisticRegression control?
  • aIt is the penalty weight itself, so a smaller C leaves the coefficients closer to the unpenalised fit
  • bIt is the inverse of the penalty weight, so a smaller C shrinks the coefficients harder
  • cIt caps the absolute value that any single coefficient is allowed to reach while fitting
  • dIt sets how many passes the solver makes over the data before it stops and returns
Explanation:scikit-learn writes the objective as C times the summed log-loss plus the squared-norm term, so C sits in front of the data-fit part and behaves as 1/lambda. Lowering C therefore gives the penalty relatively more weight and pulls the coefficients toward zero. There is no per-coefficient clipping in this estimator, and the iteration budget lives in max_iter instead.
Cml Linear Logistic InternalsDifficulty 2
A teammate claims that calling LogisticRegression() with no arguments in scikit-learn 1.6 gives a plain maximum-likelihood fit. What is actually being fitted?
  • aAn unpenalised fit, because the penalty argument already defaults to None in this release
  • bAn L1-penalised fit, because the default lbfgs solver drives small weights to zero
  • cAn unpenalised fit whenever the two classes are balanced, and a penalised one otherwise
  • dAn L2-penalised fit, because the default penalty is 'l2' and the default C is 1.0
Explanation:The defaults in scikit-learn 1.6 are penalty='l2', C=1.0 and solver='lbfgs', so regularisation is on unless you explicitly pass penalty=None. This is a deliberate library choice and it differs from the unpenalised convention used in classical statistics packages. Class balance never switches the penalty on or off, and lbfgs cannot fit an L1 penalty at all.
Cml Linear Logistic InternalsDifficulty 1
LinearRegression solves for its coefficients in one shot, while LogisticRegression has to run an iterative solver. What forces that difference?
  • aIts targets are class labels rather than numbers, and no matrix formula is defined on labels
  • bSetting its derivatives to zero gives equations that are nonlinear in the coefficients
  • cIts objective has several local minima, so the solver must explore before settling on one
  • dThe squared-norm penalty is not differentiable, so gradients have to be approximated
Explanation:Least squares differentiates a quadratic, so the stationarity conditions come out linear in the coefficients and a single linear system returns the answer. The logistic likelihood puts the coefficients inside a sigmoid, so the same conditions are nonlinear and no rearrangement isolates the coefficients; the solver has to walk toward the optimum instead. That walk is still dependable because the objective is convex and has one optimum rather than several. A categorical target does not block a closed form by itself, and the squared-norm penalty is perfectly differentiable.

Test yourself against the 1050-question ML Engineer bank.

Start interview