Which statement best describes the main difference between batch prediction and real-time serving in machine learning?
Think about how often predictions are made and how many data points are handled at once.
Batch prediction runs on large groups of data at scheduled times, while real-time serving responds immediately to single data inputs.
You are building a fraud detection system that must flag suspicious transactions immediately as they happen. Which prediction method is best?
Consider how fast the system needs to respond to new data.
Real-time serving is needed to flag fraud instantly, batch prediction delays detection.
You measure the average latency (time to get prediction) for batch prediction and real-time serving. Which is true?
Think about how predictions are processed individually or in groups.
Real-time serving predicts instantly but each prediction takes some time; batch prediction processes many points together, lowering average latency per point.
A real-time serving system is suddenly slow and sometimes fails to respond. Which is the most likely cause?
Consider what happens when many users request predictions at once.
Real-time serving can slow or fail if too many requests overload the system, causing delays or errors.
Given the code below, what is the output?
def batch_predict(model, data): return [model(x) for x in data] def real_time_predict(model, x): return model(x) model = lambda x: x * 2 batch_data = [1, 2, 3] batch_result = batch_predict(model, batch_data) real_time_result = real_time_predict(model, 4) print(batch_result, real_time_result)
Look at how the model function is applied to data in batch and real-time.
The model doubles each input. Batch prediction applies it to a list, real-time applies it to one value.