Mit Sammlungen den Überblick behalten
Sie können Inhalte basierend auf Ihren Einstellungen speichern und kategorisieren.
Dies ist eine umfassende Anleitung, die Ihnen zeigt, wie Sie mit dem Vertex AI SDK für Python ein benutzerdefiniert trainiertes Modell erstellen. Sie führen Code in einer Notebookdatei (IPYNB) aus, in der ein Docker-Container zum Trainieren und Erstellen des Modells verwendet wird. Diese Anleitung richtet sich an Data Scientists, die mit Vertex AI noch nicht vertraut sind, sich aber mit Notebooks Python und maschinellem Lernen (ML) auskennen.
Zuerst erstellen Sie in der Google Cloud Console das Projekt, das Ihre Arbeit enthält. In Ihrem Projekt erstellen Sie mit Vertex AI Workbench ein Jupyter-Notebook. In der Notebookumgebung führen Sie Code aus, der ein Dataset herunterlädt und vorbereitet. Dann verwendest du das Dataset zum Erstellen und Trainieren eines Modells. Am Ende des Tutorials werden mit dem trainierten Modell Vorhersagen erstellt.
Das Ziel dieser Anleitung ist es, Sie in weniger als einer Stunde durch alle Schritte zu führen, die zum Erstellen von Vorhersagen erforderlich sind. Das verwendete Dataset ist relativ klein, sodass das Training des Modells nicht sehr lange dauert. Wenn Sie fertig sind, können Sie das Gelernte auf größere Datensätze anwenden. Je größer der Datensatz, desto genauer sind die Prognosen.
Anleitungsschritte
Voraussetzungen: Erstellen Sie ein Google CloudKonto und ein Projekt.
Notebook erstellen: Erstellen und bereiten Sie ein Jupyter-Notebook und dessen Umgebung vor. Sie verwenden das Notebook, um Code auszuführen, der Ihr Dataset erstellt, Ihr Modell erstellt und trainiert und Vorhersagen generiert.
Dataset erstellen: Laden Sie ein öffentlich verfügbares BigQuery-Dataset herunter und erstellen Sie damit ein tabellarisches Vertex AI-Dataset. Das Dataset enthält die Daten, mit denen Sie Ihr Modell trainieren.
Trainingsskript erstellen: Erstellen Sie ein Python-Skript, das Sie an den Trainingsjob übergeben. Das Skript wird ausgeführt, wenn der Trainingsjob trainiert und das Modell erstellt wird.
Modell trainieren: Mit Ihrem tabellarischen Dataset ein Modell trainieren und bereitstellen. Sie verwenden das Modell, um Ihre Vorhersagen zu erstellen.
Vorhersagen treffen: Erstellen Sie mit Ihrem Modell Vorhersagen. In diesem Abschnitt werden Sie auch durch das Löschen von Ressourcen geführt, die Sie im Laufe dieser Anleitung erstellen, sodass keine unnötigen Kosten anfallen.
Was Sie erreichen
In dieser Anleitung erfahren Sie, wie Sie mit dem Vertex AI SDK für Python Folgendes tun:
Cloud Storage-Bucket zum Speichern eines Datensatzes erstellen
Daten für das Training vorverarbeiten
Mit den verarbeiteten Daten ein Dataset in BigQuery erstellen
Tabellarisches Vertex AI-Dataset aus BigQuery-Dataset erstellen
Benutzerdefiniert trainiertes Modell erstellen und trainieren
Benutzerdefiniert trainiertes Modell auf einem Endpunkt bereitstellen
Vorhersage generieren
Bereitstellung des Modells aufheben
Alle im Rahmen der Anleitung erstellten Ressourcen löschen, damit keine weiteren Kosten anfallen.
Verwendete abrechenbare Ressourcen
In dieser Anleitung werden kostenpflichtige Ressourcen verwendet, die mit den Diensten Vertex AI, BigQuery und Cloud Storage Google Cloud zusammenhängen. Wenn Sie neu bei Google Cloudsind, können Sie möglicherweise einen oder mehrere dieser Dienste kostenlos nutzen. Vertex AI bietet Neukunden ein Guthaben von 300 $und Cloud Storage und BigQuery haben kostenlose Stufen. Hier finden Sie weitere Informationen:
Um weitere Gebühren zu vermeiden, wird im letzten Schritt dieser Anleitung die Entfernung aller kostenpflichtigen Google Cloud Ressourcen, die Sie erstellt haben, beschrieben.
[[["Leicht verständlich","easyToUnderstand","thumb-up"],["Mein Problem wurde gelöst","solvedMyProblem","thumb-up"],["Sonstiges","otherUp","thumb-up"]],[["Schwer verständlich","hardToUnderstand","thumb-down"],["Informationen oder Beispielcode falsch","incorrectInformationOrSampleCode","thumb-down"],["Benötigte Informationen/Beispiele nicht gefunden","missingTheInformationSamplesINeed","thumb-down"],["Problem mit der Übersetzung","translationIssue","thumb-down"],["Sonstiges","otherDown","thumb-down"]],["Zuletzt aktualisiert: 2025-08-25 (UTC)."],[],[],null,["# Train a model using Vertex AI and the Python SDK\n\n| This tutorial takes between 30 and 60 minutes to complete.\n\n\u003cbr /\u003e\n\nThis tutorial is a start-to-finish guide that shows you how to use the\nVertex AI SDK for Python to create a custom-trained model. You run code in a\nnotebook (IPYNB) file that uses a Docker container to train and create the\nmodel. The tutorial is for data scientists who are new to Vertex AI and\nfamiliar with notebooks, Python, and the Machine Learning (ML) workflow.\n\nThe process starts using the Google Cloud console to create the project that\ncontains your work. In your project, you use Vertex AI Workbench to\ncreate a Jupyter notebook. The notebook environment is where you run code\nthat downloads and prepares a dataset, then use the dataset to create and train\na model. At the end of the tutorial, the trained model generates predictions.\n\nThe goal of this tutorial is to walk you through every step required to create\npredictions in less than an hour. The dataset used is relatively small so that it\ndoesn't take very long to train your model. When you're done, you can apply what\nyou learn to larger datasets. The larger your dataset is, the more accurate your\npredictions are.\n\nTutorial steps\n--------------\n\n1. [Prerequisites](/vertex-ai/docs/tutorials/tabular-bq-prediction/prerequisites) - Create your Google Cloud\n account and project.\n\n2. [Create a\n notebook](/vertex-ai/docs/tutorials/tabular-bq-prediction/create-notebook) -\n Create and prepare a Jupyter notebook and its environment. You use the\n notebook to run code that creates your dataset, creates and trains your\n model, and generates your predictions.\n\n3. [Create a dataset](/vertex-ai/docs/tutorials/tabular-bq-prediction/create-dataset) - Download a publicly\n available BigQuery dataset, then use it to create a Vertex AI\n tabular dataset. The dataset contains the data you use to train your model.\n\n4. [Create a training script](/vertex-ai/docs/tutorials/tabular-bq-prediction/create-training-script) - Create\n a Python script that you pass to your training job. The script runs when the\n training job trains and creates your model.\n\n5. [Train a model](/vertex-ai/docs/tutorials/tabular-bq-prediction/train-and-deploy-model) - Use your tabular\n dataset to train and deploy a model. You use the model to create your\n predictions.\n\n6. [Make predictions](/vertex-ai/docs/tutorials/tabular-bq-prediction/make-prediction) - Use your model to\n create predictions. This section also walks you through deleting resources\n you create while running this tutorial so you don't incur unnecessary\n charges.\n\nWhat you accomplish\n-------------------\n\nThis tutorial walks you through how to use the Vertex AI SDK for Python to do the\nfollowing:\n\n- Create a Cloud Storage bucket to store a dataset\n- Preprocess data for training\n- Use the processed data to create a dataset in BigQuery\n- Use the BigQuery dataset to create a Vertex AI tabular dataset\n- Create and train a custom-trained model\n- Deploy the custom-trained model to an endpoint\n- Generate a prediction\n- Undeploy the model\n- Delete all resources created in the tutorial so you don't incur further charges\n\nBillable resources used\n-----------------------\n\nThis tutorial uses billable resources associated with the Vertex AI,\nBigQuery, and Cloud Storage Google Cloud services. If you're\nnew to Google Cloud, you might be able to use one or more of these services at\nno cost. Vertex AI offers $300 in free credits to new customers, and\nCloud Storage and BigQuery have [free\ntiers](https://cloud.google.com/free). For more information, see the following:\n\n- [Vertex AI pricing](/vertex-ai/pricing) and [Free cloud features and trial offer](https://cloud.google.com/free/docs/free-cloud-features#free-trial)\n- [BigQuery pricing](/bigquery/pricing) and [BigQuery free tier usage](https://cloud.google.com/free/docs/free-cloud-features?#bigquery)\n- [Cloud Storage pricing](/storage/pricing) and [Cloud Storage free tier usage](https://cloud.google.com/free/docs/free-cloud-features#storage)\n- [Google Cloud pricing calculator](/products/calculator)\n\nTo prevent further charges, the final step of this tutorial walks you\nthrough removing all billable Google Cloud resources you created."]]