Real Time and Online Learning Systems Questions
Designing machine learning systems that learn, adapt, and act in real time on streaming data. Topics include online learning algorithms (online gradient descent, incremental learners, contextual bandits), handling concept drift, model freshness versus computational cost trade offs, low latency model updates and serving, streaming feature engineering and feature stores, feedback loops, evaluation strategies for online learners, exploration versus exploitation, data labeling and delayed feedback, reliability and monitoring of models in production, and integration with streaming processing frameworks for both inference and continuous training.
Sample Answer
import numpy as np
def online_kmeans_update(centroids, x, alpha):
"""
centroids: np.ndarray shape (k, d)
x: np.ndarray shape (d,)
alpha: float in (0,1] - learning rate
Returns: updated centroids (in-place modification allowed)
Time: O(k*d)
"""
if centroids is None or len(centroids) == 0:
raise ValueError("centroids must be an array with shape (k,d) and k>0")
x = np.asarray(x)
if x.ndim != 1 or x.shape[0] != centroids.shape[1]:
raise ValueError("x must be 1D and match centroid dimensionality")
if not (0.0 < alpha <= 1.0):
raise ValueError("alpha must be in (0,1]")
# compute squared distances to avoid sqrt
diffs = centroids - x # shape (k,d)
dists_sq = np.einsum('ij,ij->i', diffs, diffs) # fast rowwise dot
idx = int(np.argmin(dists_sq)) # nearest centroid index
# update rule: move centroid toward x
centroids[idx] += alpha * (x - centroids[idx])
return centroidsSample Answer
Sample Answer
Sample Answer
Sample Answer
Unlock Full Question Bank
Get access to hundreds of Real Time and Online Learning Systems interview questions and detailed answers.
Sign in to ContinueJoin thousands of developers preparing for their dream job.