Nondeterminism makes a prediction vary even when the visible feature input appears unchanged. Randomness, current time, and other implicit data can affect the result, complicating reproducibility and debugging. section 13.1
A predictable prediction interface
A predict function that reads the current time internally and fixes a seed still hides an output-controlling parameter. Passing time and seed explicitly lets the caller reproduce a result or deliberately choose different conditions. section 13.1
Listing 13.2 A better design for a predict function
def predict(features, time=None, seed=42):
if time is None:
time = datetime.now()
return model.predict(features, time, seed)
Inspect the better predict-function design, which exposes time and seed while retaining defaults for ordinary calls. section 13.1


