Fit logistic regression and return top features

Quick Overview

This question evaluates understanding of binary logistic regression, coefficient-based feature importance, and practical model-fitting considerations such as intercept inclusion and input shape handling.

Fit logistic regression and return top features

Company: Roblox

Role: Data Scientist

Category: Machine Learning

Difficulty: hard

Interview Round: Take-home Project

You are given: - `X`: a 2D numeric array where **each row is a feature** and each column is an observation (shape: `n_features x n_samples`). - `feature_names`: a list of length `n_features`. - `y`: a binary outcome array of length `n_samples` with values in {0, 1}. Task: 1) Fit a (binary) **logistic regression** model to predict `y` from `X`. - Include an intercept. - No regularization unless explicitly stated. 2) Rank features by the absolute value of their fitted coefficients (exclude the intercept). 3) Return the **top 3 feature names** by `|coef|` (break ties by lexicographic order of `feature_names`). Output: - A list of 3 strings (feature names).

Quick Answer: This question evaluates understanding of binary logistic regression, coefficient-based feature importance, and practical model-fitting considerations such as intercept inclusion and input shape handling.

|Home/Machine Learning/Roblox
Roblox logo
Roblox
Nov 23, 2025, 12:00 AM
hardData ScientistTake-home ProjectMachine Learning
4
0

You are given:

  • X : a 2D numeric array where each row is a feature and each column is an observation (shape: n_features x n_samples ).
  • feature_names : a list of length n_features .
  • y : a binary outcome array of length n_samples with values in {0, 1}.

Task:

  1. Fit a (binary) logistic regression model to predict y from X .
    • Include an intercept.
    • No regularization unless explicitly stated.
  2. Rank features by the absolute value of their fitted coefficients (exclude the intercept).
  3. Return the top 3 feature names by |coef| (break ties by lexicographic order of feature_names ).

Output:

  • A list of 3 strings (feature names).
Loading comments...