Eine Prediction-Round-Trip nachverfolgen
Verfolgen Sie eine Anfrage von der Eingabe bis zur protokollierten Antwort.
Eine Prediction-Round-Trip nachverfolgen ist eine kostenlose MLOps Academy-Lektion auf CoddyKit. Dies ist Lektion 4 von 4. Du kannst die komplette Lektion unten kostenlos lesen – dann übst du sie direkt im Browser mit einem integrierten Code-Editor und einem KI-Tutor rund um die Uhr. Sie ist Teil des MLOps Academy-Lernpfads, und dein Fortschritt wird über Web und CoddyKit-App synchronisiert. Der MLOps Academy-Kurs umfasst insgesamt 4 Lektionen.
Teile dieser Lektion wurden noch nicht übersetzt und werden auf Englisch angezeigt.
Follow One Request
Time to watch the whole loop work. You will follow a single prediction from a client request all the way to a logged response. 🔍
The Client Sends Input
A caller POSTs JSON to /predict. This is the raw input feature payload your model needs to make a decision.
curl -X POST localhost:8000/predict \
-H "Content-Type: application/json" \
-d '{"tenure": 12, "monthly_charges": 79.9}'Pydantic Validates
FastAPI parses the body against your schema. If a field is missing or the wrong type, Pydantic rejects it with a 422 before the model runs.
The Model Predicts
The validated row hits the loaded champion model. It computes a result in memory, no retraining and no registry call on the hot path.
pred = app.state.model.predict([[f.tenure, f.monthly_charges]])Log What Happened
Before responding, write a structured log line with the inputs, the prediction, and a timestamp. This is your audit trail.
import logging, json
logging.info(json.dumps({
"input": f.model_dump(),
"prediction": int(pred[0]),
}))Return the Response
FastAPI serializes your dict back to JSON and sends it with a 200. The client receives the prediction in milliseconds.
{"prediction": 1}Capture Latency
Wrap the call to measure how long it took. Logging latency per request is what later powers your monitoring dashboards.
import time
start = time.perf_counter()
# predict...
elapsed_ms = (time.perf_counter() - start) * 1000Tie Back to the Version
Log which model produced the answer. Recording the version means you can always say exactly which model made any past prediction.
{"model": "churn-classifier", "version": 3}The Loop Closed
Train, register, promote, serve, predict, log: one request just walked the entire pipeline you built. That is end-to-end MLOps. 🎯
Quick Check
Why log the input, prediction, and model version on every request?
Logs Feed Monitoring
Those logged round-trips become the raw material for the next stage: monitoring latency, error rates, and eventually input drift over time.
You Built a System
This is no longer a notebook. It is a traceable system where every prediction can be explained and reproduced from end to end.
Recap: The Full Round-Trip
You traced one request through validation, prediction, logging, and response, tying it back to a model version. That closes your first end-to-end flow. ✅
Häufig gestellte Fragen
Ist die Lektion „Eine Prediction-Round-Trip nachverfolgen“ kostenlos?
Ja — der vollständige Text von „Eine Prediction-Round-Trip nachverfolgen“ ist hier im Web kostenlos zu lesen. Um sie interaktiv zu üben (integrierter Code-Editor und 24/7 KI-Tutor) und den Rest des MLOps Academy-Kurses freizuschalten, upgrade auf CoddyKit PRO. Der MLOps Academy-Kurs umfasst insgesamt 4 Lektionen.
Was lerne ich in „Eine Prediction-Round-Trip nachverfolgen“?
Verfolgen Sie eine Anfrage von der Eingabe bis zur protokollierten Antwort. Du übst MLOps Academy mit praktischem Code, den du direkt im Browser ausführst, und ein 24/7 KI-Tutor beantwortet deine Fragen während du die Lektion bearbeitest.
Brauche ich Erfahrung, um MLOps Academy zu starten?
Keine Vorkenntnisse erforderlich. MLOps Academy auf CoddyKit ist für Anfänger bis fortgeschrittene Lernende strukturiert, sodass du hier starten oder von Anfang an beginnen und in deinem eigenen Tempo voranschreiten kannst. Dies ist Lektion 4 von 4.
Wie lange dauert die Lektion „Eine Prediction-Round-Trip nachverfolgen“?
Die meisten CoddyKit-Lektionen dauern etwa 5–10 Minuten. Jede ist kompakt und interaktiv, sodass du stetig Fortschritte machst und genau dort weitermachst, wo du aufgehört hast – im Web und in der App.
Kann ich in dieser MLOps Academy-Lektion Code schreiben und ausführen?
Ja. Jede MLOps Academy-Lektion enthält einen integrierten Code-Editor, sodass du echten Code direkt in deinem Browser schreibst und ausführst und sofort KI-Feedback erhältst — ohne lokale Einrichtung erforderlich.
Alle Lektionen in diesem Kurs
- Trainieren und in der Registry protokollieren
- Das beste Modell in Production überführen
- Das Production-Modell bereitstellen
- Eine Prediction-Round-Trip nachverfolgen