0Pricing
NLP Academy · Lektion

Vorhersagen für völlig neuen Text

Inference für unbekannte Eingaben ausführen

Vorhersagen für völlig neuen Text ist eine kostenlose NLP 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 NLP Academy-Lernpfads, und dein Fortschritt wird über Web und CoddyKit-App synchronisiert. Der NLP Academy-Kurs umfasst insgesamt 4 Lektionen.

Teile dieser Lektion wurden noch nicht übersetzt und werden auf Englisch angezeigt.

Inference Time

Training is done. Now comes inference: feeding brand-new, unseen text to your saved model and reading back its prediction. 🚀

Load the Model First

Start every prediction script by loading the saved pipeline. From here it behaves exactly like the model you trained.

import joblib
model = joblib.load("models/sentiment.joblib")

Predict Expects a List

The predict method takes a list of texts, not a single string. Even one example must be wrapped in a list.

model.predict(["the food was amazing"])

Predict Many at Once

Pass a whole list to score many texts in one go. Batch prediction is far faster than looping one item at a time.

texts = ["loved it", "total waste of money"]
print(model.predict(texts))

Get Probabilities

Want confidence, not just a label? Call predict_proba to see how sure the model is about each class.

model.predict_proba(["it was okay i guess"])

Same Cleaning as Training

New text must go through the same cleaning as your training data. The pipeline handles this, which is exactly why you saved it whole.

Unknown Words Are Fine

Words the model never saw are simply ignored by the vectorizer. Your vocabulary is fixed at training time, so prediction stays stable.

Map Labels to Names

Models often return numbers like 0 and 1. Turn them into a readable label name so people can understand the output.

names = {0: "negative", 1: "positive"}
print(names[model.predict(["great"])[0]])

Wrap It in a Function

Wrap loading and predicting in one helper function. Now any part of your app can classify text with a single clean call.

def classify(text):
    return model.predict([text])[0]

Watch for Drift

Real text changes over time. When accuracy slips, that is data drift, a signal it is time to retrain on fresh examples.

Serve It Anywhere

Your classify function can sit behind a web API or a script. The same saved model now powers real predictions in production. 🎯

Quick Check

Think about the input format predict requires.

Recap

You loaded the model, predicted on new text in batches, read probabilities, mapped labels, wrapped it in a function, and watched for drift. 🏁

Häufig gestellte Fragen

Ist die Lektion „Vorhersagen für völlig neuen Text“ kostenlos?

Ja — der vollständige Text von „Vorhersagen für völlig neuen Text“ ist hier im Web kostenlos zu lesen. Um sie interaktiv zu üben (integrierter Code-Editor und 24/7 KI-Tutor) und den Rest des NLP Academy-Kurses freizuschalten, upgrade auf CoddyKit PRO. Der NLP Academy-Kurs umfasst insgesamt 4 Lektionen.

Was lerne ich in „Vorhersagen für völlig neuen Text“?

Inference für unbekannte Eingaben ausführen Du übst NLP 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 NLP Academy zu starten?

Keine Vorkenntnisse erforderlich. NLP 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 „Vorhersagen für völlig neuen Text“?

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 NLP Academy-Lektion Code schreiben und ausführen?

Ja. Jede NLP 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

  1. Ein echtes NLP-Projekt strukturieren
  2. scikit-learn-Pipelines von Anfang bis Ende
  3. Ihr Modell speichern und laden
  4. Vorhersagen für völlig neuen Text
← Zurück zu NLP Academy