Implement Streaming Clustering for Numbers
UberData Scientist · OnsiteLast updated
This question evaluates a data scientist's competency in online clustering for numeric streams, testing understanding of streaming algorithms, bounded-memory cluster summaries, online updates, and issues including initialization, convergence behavior, outlier handling, and concept drift.
You receive a continuous stream of numeric values. Choose an appropriate clustering algorithm and implement it so that each incoming number can be assigned to a cluster while using bounded memory.
Clarify and address the following:
- The stream is potentially unbounded, so storing all historical values is not allowed.
- You may assume the number of clusters
kis given, or explain how you would choose it. - The algorithm should update cluster summaries online as new values arrive.
- The implementation should expose at least two operations:
add(value)to process a new number andget_clusters()to return the current cluster centers or summaries. - Discuss initialization, convergence behavior, outliers, concept drift, and how you would test correctness.
Solution walkthrough is for members
Get the full walkthrough with reference code and complexity analysis, plus Kitty Coach at 300 messages a day. Hints, the code runner and community answers stay free.