Mid-level interview questionAsked at Spotify · interview write-up
Compare centroid, hierarchical, density-based, Gaussian mixture and spectral clustering: their objectives, assumptions and when you would use each.
Model answer
Choose by the cluster shape you expect and data size.
K-means minimises within-cluster squared distance, assumes compact similar-size clusters, and needs k. Hierarchical merges by a linkage rule into a dendrogram, suiting small, nested data. DBSCAN grows dense regions and flags outliers, finding any shape but struggling with varying density. Gaussian mixtures fit soft, elliptical clusters by EM. Spectral clustering uses eigenvectors of a similarity graph, handling non-convex shapes on moderate data.
Practise the rest
35 Training questions, 492 in all, each with a model answer. Free.
More from Spotify interview questions.
More Training interview questions
- Implement masked cross-entropy in NumPy that stays numerically stable, with label smoothing and a temperature.
- Build a pipeline that finds math documents in web crawls and scores their quality.
- Explain KL divergence for language models: which direction is which, what happens when supports don't match, and how it's used as a regulariser.
- When would you use mean squared error versus cross-entropy? And what is LoRA?
- Explain Adam and its bias correction, and why AdamW decouples weight decay.
- Explain policy types in RL and modern policy-gradient methods such as TRPO, PPO and GAE, then compare linear attention and grouped-query attention.