Python problem track
Tensors & ranking
Softmax, log-softmax, cosine, top-k, KL, Huber — the DS/MLE follow-up after the metric pad.
8 problems · ~102 min total · Data Scientist · ML Engineer · MLOps Engineer · AI Engineer
Step 1 · ~12 min · OpenAI, Google
SoftmaxImplement softmax(x): exp(x - max(x)) / sum(exp(x - max(x))). Return a list of floats rounded to 4 decimals.
PythonNumPyPyTorchhardProNot startedStep 2 · ~12 min · OpenAI, Anthropic
Log-softmaxReturn log(softmax(x)) with the max-subtraction trick, as a list of floats rounded to 4 decimals.
PythonNumPyPyTorchhardProNot startedStep 3 · ~12 min · OpenAI, Google
Cosine similarityReturn cosine similarity of equal-length vectors a and b, rounded to 4 decimals. Assume they are non-zero.
PythonNumPyPyTorchhardProNot startedStep 4 · ~12 min · Google, NVIDIA
Top-k indicesReturn the indices of the k largest values in x, largest first. Ties keep the earlier index.
PythonNumPyPyTorchhardProNot startedStep 5 · ~14 min · DeepMind, Two Sigma
KL divergenceKullback–Leibler divergence KL(p || q) in nats: sum p_i log(p_i / q_i). Skip zeros in p. Assume q_i > 0 wherever p_i > 0. Round to 4 decimals.
PythonNumPyPyTorchhardProNot startedStep 6 · ~14 min · NVIDIA, Jane Street
Huber lossMean Huber loss of labels y and predictions yhat with delta = 1. For each residual r = yhat - y: 0.5 r^2 if |r| <= 1, else |r| - 0.5. Round to 4 decimals.
PythonNumPyPyTorchhardProNot startedStep 7 · ~12 min · DeepMind, Google
Shannon entropyShannon entropy of a discrete distribution p (nats, natural log): -sum p_i log(p_i). Skip zeros. Round to 4 decimals.
PythonNumPyPyTorchhardProNot startedStep 8 · ~14 min · Two Sigma, Citadel
Pearson correlationReturn the Pearson correlation of equal-length vectors a and b, rounded to 4 decimals. Assume they are not constant.
PythonNumPyPyTorchhardProNot started