AutoML-Modelle bewerten

Vertex AI bietet Messwerte für die Modellbewertung, damit Sie die Leistung Ihrer Modelle bewerten können, z. B. die Precision- und Recall-Messwerte. Vertex AI berechnet Bewertungsmesswerte mithilfe des Test-Datasets.

Verwendung von Modellbewertungsmesswerten

Modellbewertungsmesswerte liefern quantitative Messungen der Leistung Ihres Modells im Test-Dataset. Wie diese Messwerte interpretiert und verwendet werden sollten, hängt von Ihren geschäftlichen Anforderungen und dem Problem ab, für dessen Lösung das Modell trainiert wurde. Sie haben z. B. eine geringere Toleranz für falsch positive Ergebnisse als für falsch negative, oder andersherum. Diese Fragen haben Einfluss darauf, welche Messwerte für Sie besonders wichtig sind.

Weitere Informationen dazu, wie Sie Ihr Modell iterieren, um die Leistung zu verbessern, finden Sie unter Modell iterieren.

Beispiele

In den folgenden Szenarien wird beschrieben, wie Sie mithilfe von Bewertungsmesswerten die Leistung Ihres AutoML-Modells ermitteln können.

Datenschutz in Bildern

Beispiel: Sie möchten ein System erstellen, das vertrauliche Informationen in einem Bild automatisch erkennt und unkenntlich macht. Falsch positive Werte wären in diesem Fall Dinge, die nicht unkenntlich gemacht werden müssen, aber trotzdem unkenntlich gemacht werden, wie Zahlen in einem Kalender. Dies ist unangenehm, aber nicht schlimm.

Grafik mit verschwommenem Datum

Falsch negative Ergebnisse wären in diesem Fall Objekte, die nicht unkenntlich gemacht werden konnten, wie z. B. eine Kreditkartennummer, was zu Identitätsdiebstahl führen kann.

Grafik mit Kreditkartennummer

In diesem Fall sollten Sie sich auf den Recall konzentrieren. Recall-Messwerte geben an, wie viele der Vorhersagen ausgelassen wurden. Durch einen höheren Recall wird die Anzahl der falsch-positiven Ergebnisse erhöht (die Precision verringert), die Anzahl der falsch-negativen Ergebnisse jedoch verringert. Mit anderen Worten: Das Modell enthält wahrscheinlich mehr relevante Objekte, aber auch mehr irrelevante Objekte.

Spamfilter

Angenommen, Sie möchten ein System erstellen, das automatisch Spam-E-Mails von nützlichen Nachrichten unterscheidet und sie ausfiltert. Ein falsch negatives Ergebnis wäre in diesem Fall eine Spam-E-Mail, die nicht abgefangen wird und die Sie in Ihrem Posteingang sehen. Für Nutzer entsteht dadurch eine geringe Unannehmlichkeit.

Grafik zu Spam-E-Mails

Ein falsch positives Ergebnis wäre in diesem Fall eine E-Mail, die fälschlicherweise als Spam gekennzeichnet und aus dem Posteingang entfernt wird. Wenn die E-Mail wichtig war, kann dies für den Nutzer nachteilig sein.

Grafik zu legitimer E-Mail

In diesem Fall liegt der Fokus auf der Precision. Sie gibt an, wie viele korrekte Vorhersagen aus der Gesamtzahl der Vorhersagen getroffen wurden. Bei Modellen mit hoher Precision ist die Wahrscheinlichkeit hoch, dass sie nur sehr relevante Beispiele mit einem Label versehen. Das kann nützlich sein, wenn Ihre Kategorie in den Trainingsdaten häufig vorkommt.

Von Vertex AI zurückgegebene Bewertungsmesswerte

Vertex AI gibt verschiedene Bewertungsmesswerte zurück, z. B. die Precision, der Recall und die Konfidenzgrenzwerte. Die von Vertex AI zurückgegebenen Messwerte hängen vom Ziel des Modells ab. Vertex AI beispielsweise unterschiedliche Bewertungsmesswerte für ein Bildklassifizierungsmodell im Vergleich zu einem Bildobjekterkennungsmodell.

Eine Schemadatei, die von einem Cloud Storage-Speicherort heruntergeladen werden kann, bestimmt, welche Bewertungsmesswerte Vertex AI für jedes Ziel bereitstellt. Die folgenden Tabs enthalten Links zu den Schemadateien und beschreiben die Bewertungsmesswerte für jedes Modellziel.

Bild

Klassifizierung

Sie können Schemadateien unter dem folgenden Cloud Storage-Speicherort ansehen und herunterladen:
gs://google-cloud-aiplatform/schema/modelevaluation/

  • AuPRC: Der Bereich unter der Precision-/Recall-Kurve (Area Under the Precision/Recall Curve, AuPRC), auch als durchschnittliche Precision bezeichnet. Dieser Wert reicht von null bis eins, wobei ein höherer Wert auf ein Modell von höherer Qualität verweist.
  • Logarithmischer Verlust: Die Kreuzentropie zwischen den Modellvorhersagen und den Zielwerten. Dieser Wert reicht von null bis unendlich, wobei ein niedrigerer Wert auf ein Modell von höherer Qualität hinweist.
  • Konfidenzgrenzwert: Ein Konfidenzwert, der bestimmt, welche Vorhersagen zurückgegeben werden. Ein Modell gibt Vorhersagen mit diesem Wert oder höher zurück. Ein höherer Konfidenzgrenzwert erhöht die Precision, verringert aber den Recall. Vertex AI gibt Konfidenzmesswerte mit unterschiedlichen Grenzwerten zurück, um festzustellen, wie sich der Grenzwert auf die Precision und den Recall auswirkt.
  • Recall: Der Anteil an Vorhersagen mit dieser Klasse, die das Modell korrekt vorhergesagt hat. Wird als Rate richtig positiver Ergebnisse bezeichnet.
  • Präzision: Der Anteil an Klassifizierungsvorhersagen des Modells, die richtig waren.
  • Wahrheitsmatrix: Eine Wahrheitsmatrix gibt an, wie oft ein Modell ein Ergebnis korrekt vorhergesagt hat. Bei falsch vorhergesagten Ergebnissen zeigt die Matrix, was das Modell stattdessen vorhergesagt hat. Die Wahrheitsmatrix hilft Ihnen zu verstehen, wo Ihr Modell zwei Ergebnisse „vermischt“.

Objekterkennung

Sie können Schemadateien unter dem folgenden Cloud Storage-Speicherort ansehen und herunterladen:
gs://google-cloud-aiplatform/schema/modelevaluation/

  • IoU-Grenzwert: Ein Intersection over Union-Grenzwert, der bestimmt, welche Vorhersagen zurückgegeben werden. Ein Modell gibt Vorhersagen mit diesem Wert oder höher zurück. Je höher der Grenzwert ist, desto näher müssen die vorhergesagten Begrenzungsrahmenwerte an den tatsächlichen Begrenzungsrahmenwerten liegen.
  • Mittlere durchschnittliche Precision: auch als durchschnittliche Precision bezeichnet. Dieser Wert reicht von null bis eins, wobei ein höherer Wert auf ein Modell von höherer Qualität verweist.
  • Konfidenzgrenzwert: Ein Konfidenzwert, der bestimmt, welche Vorhersagen zurückgegeben werden. Ein Modell gibt Vorhersagen mit diesem Wert oder höher zurück. Ein höherer Konfidenzgrenzwert erhöht die Precision, verringert aber den Recall. Vertex AI gibt Konfidenzmesswerte mit unterschiedlichen Grenzwerten zurück, um festzustellen, wie sich der Grenzwert auf die Precision und den Recall auswirkt.
  • Recall: Der Anteil an Vorhersagen mit dieser Klasse, die das Modell korrekt vorhergesagt hat. Wird als Rate richtig positiver Ergebnisse bezeichnet.
  • Präzision: Der Anteil an Klassifizierungsvorhersagen des Modells, die richtig waren.
  • F1-Wert: der harmonische Mittelwert von Precision und Recall. F1 ist ein nützlicher Messwert, wenn Sie ein Gleichgewicht zwischen Precision und Recall anstreben und die Klassenverteilung ungleichmäßig ist
  • Begrenzungsrahmen mit mittlerer durchschnittlicher Genauigkeit: Der einzelne Messwert für die Bewertung von Begrenzungsrahmen: Der Durchschnitt der meanAveragePrecision für alle boundingBoxMetrics.

Tabellarisch

Klassifizierung

Sie können Schemadateien unter dem folgenden Cloud Storage-Speicherort ansehen und herunterladen:
gs://google-cloud-aiplatform/schema/modelevaluation/

  • AuPRC: Der Bereich unter der Precision-/Recall-Kurve (Area Under the Precision/Recall Curve, AuPRC), auch als durchschnittliche Precision bezeichnet. Dieser Wert reicht von null bis eins, wobei ein höherer Wert auf ein Modell von höherer Qualität verweist.
  • AuROC: Die Fläche unter der Grenzwertoptimierungskurve (Receiver Operating Characteristic Curve, ROC).. Dieser Wert reicht von null bis eins, wobei ein höherer Wert auf ein Modell von höherer Qualität verweist.
  • Logarithmischer Verlust: Die Kreuzentropie zwischen den Modellvorhersagen und den Zielwerten. Dieser Wert reicht von null bis unendlich, wobei ein niedrigerer Wert auf ein Modell von höherer Qualität hinweist.
  • Konfidenzgrenzwert: Ein Konfidenzwert, der bestimmt, welche Vorhersagen zurückgegeben werden. Ein Modell gibt Vorhersagen mit diesem Wert oder höher zurück. Ein höherer Konfidenzgrenzwert erhöht die Precision, verringert aber den Recall. Vertex AI gibt Konfidenzmesswerte mit unterschiedlichen Grenzwerten zurück, um festzustellen, wie sich der Grenzwert auf die Precision und den Recall auswirkt.
  • Recall: Der Anteil an Vorhersagen mit dieser Klasse, die das Modell korrekt vorhergesagt hat. Wird als Rate richtig positiver Ergebnisse bezeichnet.
  • Rückruf bei 1: Die Trefferquote unter alleiniger Berücksichtigung des Labels, das für jedes Beispiel den höchsten Vorhersagewert hat, der nicht unter dem Konfidenzwert liegt.
  • Präzision: Der Anteil an Klassifizierungsvorhersagen des Modells, die richtig waren.
  • Genauigkeit bei 1: Die Genauigkeit, wenn nur das Label mit dem höchsten Vorhersagewert und nicht der Konfidenzwert für jedes Beispiel berücksichtigt wird.
  • F1-Wert: der harmonische Mittelwert von Precision und Recall. F1 ist ein nützlicher Messwert, wenn Sie ein Gleichgewicht zwischen Precision und Recall anstreben und die Klassenverteilung ungleichmäßig ist
  • F1-Wert bei 1: Der harmonische Mittelwert von Trefferquote bei 1 und Genauigkeit bei 1.
  • Anzahl echt negativer Ergebnisse: Die Häufigkeit, mit der ein Modell eine negative Klasse richtig vorhergesagt hat.
  • Anzahl echt positiver Ergebnisse: Die Häufigkeit, mit der ein Modell eine positive Klasse richtig vorhergesagt hat.
  • Anzahl falsch negativer Ergebnisse: Die Häufigkeit, mit der ein Modell eine negative Klasse falsch vorhergesagt hat.
  • Anzahl falsch positiver Ergebnisse: Die Häufigkeit, mit der ein Modell eine positive Klasse falsch vorhergesagt hat.
  • Rate falsch positiver Ergebnisse: Der Anteil falsch vorhergesagter Ergebnisse aus allen vorhergesagten Ergebnissen.
  • Rate falsch positiver Ergebnisse bei 1: Die Rate falsch positiver Ergebnisse, wenn nur das Label mit dem höchsten Vorhersagewert und nicht der Konfidenzwert für jedes Beispiel berücksichtigt wird.
  • Wahrheitsmatrix: Eine Wahrheitsmatrix gibt an, wie oft ein Modell ein Ergebnis korrekt vorhergesagt hat. Bei falsch vorhergesagten Ergebnissen zeigt die Matrix, was das Modell stattdessen vorhergesagt hat. Die Wahrheitsmatrix hilft Ihnen zu verstehen, wo Ihr Modell zwei Ergebnisse „vermischt“.
  • Modellattributionen: In Vertex AI sehen Sie, wie stark sich jedes Attribut auf ein Modell auswirkt. Die Werte werden für jedes Merkmal als Prozentsatz angegeben. Je höher der Prozentsatz, desto stärker wirkt sich das Merkmal auf das Modelltraining aus. Prüfen Sie diese Informationen, damit alle wichtigen Funktionen für Ihr Daten- und Geschäftsproblem sinnvoll sind.

Vorhersage

Sie können Schemadateien unter dem folgenden Cloud Storage-Speicherort ansehen und herunterladen:
gs://google-cloud-aiplatform/schema/modelevaluation/

  • MAE: Der mittlere absolute Fehler (Mean Absolute Error) ist die durchschnittliche absolute Differenz zwischen den Zielwerten und den vorhergesagten Werten. Dieser Messwert reicht von null bis unendlich. Ein niedrigerer Wert gibt ein höheres Qualitätsmodell an.
  • RMSE: Der RMSE (Root Mean Squared Error) ist der Durchschnitt der Differenz zum Quadrat zwischen dem Zielwert und den tatsächlichen Werten. RMSE reagiert empfindlicher auf Ausreißer als MAE. Wenn Sie also große Fehler befürchten, ist es möglicherweise sinnvoller, RMSE als Messwert für die Auswertung zu nutzen. Ähnlich wie bei MAE zeigt ein kleinerer Wert ein Modell mit höherer Qualität an (0 steht für einen perfekten Prädiktor).
  • RMSLE: Dieser Messwert der Wurzel des mittleren quadratischen logarithmischen Fehlers ähnelt RMSE, verwendet jedoch den natürlichen Logarithmus der vorhergesagten und tatsächlichen Werte plus 1. RMSLE bestraft eine unterdurchschnittliche Vorhersage stärker als eine überdurchschnittliche Vorhersage. Er kann auch ein guter Messwert sein, wenn Sie nicht möchten, dass Unterschiede bei großen Vorhersagewerten stärker als bei kleinen Vorhersagewerten bestraft werden. Dieser Messwert reicht von null bis unendlich. Ein niedrigerer Wert gibt ein Modell mit höherer Qualität an. Der RMSLE-Bewertungsmesswert wird nur zurückgegeben, wenn alle Label- und Vorhersagewerte nicht negativ sind.
  • r^2: r-Quadrat ist das Quadrat des Pearson-Korrelationskoeffizienten zwischen den Labels und vorhergesagten Werten. Dieser Messwert liegt zwischen null und eins. Ein höherer Wert gibt ein höheres Qualitätsmodell an.
  • MAPE: Der mittlere absolute prozentuale Fehler (Mean Absolute Percentage Error) ist die durchschnittliche absolute prozentuale Differenz zwischen den Labels und den vorhergesagten Werten. Dieser Messwert liegt zwischen null und unendlich. Ein niedrigerer Wert gibt ein höheres Qualitätsmodell an.
    MAPE wird nicht angezeigt, wenn die Zielspalte Nullwerte enthält. In diesem Fall ist MAPE nicht definiert.
  • WAPE: Der gewichtete absolute Prozentfehler (WAPE) ist der Gesamtunterschied zwischen dem von einem Modell vorhergesagten Wert und den beobachteten Werten. Im Vergleich zu RMSE wird der WAPE anhand der Gesamtunterschiede statt der individuellen Unterschiede gewichtet, welche sehr von geringen oder periodischen Werten beeinflusst werden können. Ein niedrigerer Wert deutet auf ein Modell höherer Qualität hin.
  • RMSPE: Der mittlere quadratische Prozentfehler (RMPSE) zeigt RMSE als Prozentsatz der tatsächlichen Werte anstelle einer absoluten Zahl an. Ein niedrigerer Wert deutet auf ein Modell höherer Qualität hin.
  • Quantil: Das prozentuale Quantil, das die Wahrscheinlichkeit angibt, dass ein beobachteter Wert unter dem vorhergesagten Wert liegt. Beispielsweise wird erwartet, dass die beobachteten Werte am 0,2-Quantil zu 20 % der Zeit niedriger als die vorhergesagten Werte sind. Vertex AI stellt diesen Messwert bereit, wenn Sie minimize-quantile-loss als Optimierungsziel angeben.
  • Beobachtetes Quantil: Zeigt den Prozentsatz der wahren Werte an, die für ein bestimmtes Quantil unter dem vorhergesagten Wert lagen. Vertex AI stellt diesen Messwert bereit, wenn Sie minimize-quantile-loss als Optimierungsziel angeben.
  • Skalierter Pinball-Loss: Der skalierte Pinball-Loss bei einem bestimmten Quantil. Ein niedrigerer Wert deutet auf ein Modell höherer Qualität am angegebenen Quantil hin. Vertex AI stellt diesen Messwert bereit, wenn Sie minimize-quantile-loss als Optimierungsziel angeben.

Regression

Sie können Schemadateien unter dem folgenden Cloud Storage-Speicherort ansehen und herunterladen:
gs://google-cloud-aiplatform/schema/modelevaluation/

  • MAE: Der mittlere absolute Fehler (Mean Absolute Error) ist die durchschnittliche absolute Differenz zwischen den Zielwerten und den vorhergesagten Werten. Dieser Messwert reicht von null bis unendlich. Ein niedrigerer Wert gibt ein höheres Qualitätsmodell an.
  • RMSE: Der RMSE (Root Mean Squared Error) ist der Durchschnitt der Differenz zum Quadrat zwischen dem Zielwert und den tatsächlichen Werten. RMSE reagiert empfindlicher auf Ausreißer als MAE. Wenn Sie also große Fehler befürchten, ist es möglicherweise sinnvoller, RMSE als Messwert für die Auswertung zu nutzen. Ähnlich wie bei MAE zeigt ein kleinerer Wert ein Modell mit höherer Qualität an (0 steht für einen perfekten Prädiktor).
  • RMSLE: Dieser Messwert der Wurzel des mittleren quadratischen logarithmischen Fehlers ähnelt RMSE, verwendet jedoch den natürlichen Logarithmus der vorhergesagten und tatsächlichen Werte plus 1. RMSLE bestraft eine unterdurchschnittliche Vorhersage stärker als eine überdurchschnittliche Vorhersage. Er kann auch ein guter Messwert sein, wenn Sie nicht möchten, dass Unterschiede bei großen Vorhersagewerten stärker als bei kleinen Vorhersagewerten bestraft werden. Dieser Messwert reicht von null bis unendlich. Ein niedrigerer Wert gibt ein Modell mit höherer Qualität an. Der RMSLE-Bewertungsmesswert wird nur zurückgegeben, wenn alle Label- und Vorhersagewerte nicht negativ sind.
  • r^2: r-Quadrat ist das Quadrat des Pearson-Korrelationskoeffizienten zwischen den Labels und vorhergesagten Werten. Dieser Messwert liegt zwischen null und eins. Ein höherer Wert gibt ein höheres Qualitätsmodell an.
  • MAPE: Der mittlere absolute prozentuale Fehler (Mean Absolute Percentage Error) ist die durchschnittliche absolute prozentuale Differenz zwischen den Labels und den vorhergesagten Werten. Dieser Messwert liegt zwischen null und unendlich. Ein niedrigerer Wert gibt ein höheres Qualitätsmodell an.
    MAPE wird nicht angezeigt, wenn die Zielspalte Nullwerte enthält. In diesem Fall ist MAPE nicht definiert.
  • Modellattributionen: In Vertex AI sehen Sie, wie stark sich jedes Attribut auf ein Modell auswirkt. Die Werte werden für jedes Merkmal als Prozentsatz angegeben. Je höher der Prozentsatz, desto stärker wirkt sich das Merkmal auf das Modelltraining aus. Prüfen Sie diese Informationen, damit alle wichtigen Funktionen für Ihr Daten- und Geschäftsproblem sinnvoll sind.

Text

Klassifizierung

Sie können Schemadateien unter dem folgenden Cloud Storage-Speicherort ansehen und herunterladen:
gs://google-cloud-aiplatform/schema/modelevaluation/

  • AuPRC: Der Bereich unter der Precision-/Recall-Kurve (Area Under the Precision/Recall Curve, AuPRC), auch als durchschnittliche Precision bezeichnet. Dieser Wert reicht von null bis eins, wobei ein höherer Wert auf ein Modell von höherer Qualität verweist.
  • Logarithmischer Verlust: Die Kreuzentropie zwischen den Modellvorhersagen und den Zielwerten. Dieser Wert reicht von null bis unendlich, wobei ein niedrigerer Wert auf ein Modell von höherer Qualität hinweist.
  • Konfidenzgrenzwert: Ein Konfidenzwert, der bestimmt, welche Vorhersagen zurückgegeben werden. Ein Modell gibt Vorhersagen mit diesem Wert oder höher zurück. Ein höherer Konfidenzgrenzwert erhöht die Precision, verringert aber den Recall. Vertex AI gibt Konfidenzmesswerte mit unterschiedlichen Grenzwerten zurück, um festzustellen, wie sich der Grenzwert auf die Precision und den Recall auswirkt.
  • Recall: Der Anteil an Vorhersagen mit dieser Klasse, die das Modell korrekt vorhergesagt hat. Wird als Rate richtig positiver Ergebnisse bezeichnet.
  • Rückruf bei 1: Die Trefferquote unter alleiniger Berücksichtigung des Labels, das für jedes Beispiel den höchsten Vorhersagewert hat, der nicht unter dem Konfidenzwert liegt.
  • Präzision: Der Anteil an Klassifizierungsvorhersagen des Modells, die richtig waren.
  • Genauigkeit bei 1: Die Genauigkeit, wenn nur das Label mit dem höchsten Vorhersagewert und nicht der Konfidenzwert für jedes Beispiel berücksichtigt wird.
  • F1-Wert: der harmonische Mittelwert von Precision und Recall. F1 ist ein nützlicher Messwert, wenn Sie ein Gleichgewicht zwischen Precision und Recall anstreben und die Klassenverteilung ungleichmäßig ist
  • F1-Wert bei 1: Der harmonische Mittelwert von Trefferquote bei 1 und Genauigkeit bei 1.
  • Wahrheitsmatrix: Eine Wahrheitsmatrix gibt an, wie oft ein Modell ein Ergebnis korrekt vorhergesagt hat. Bei falsch vorhergesagten Ergebnissen zeigt die Matrix, was das Modell stattdessen vorhergesagt hat. Die Wahrheitsmatrix hilft Ihnen zu verstehen, wo Ihr Modell zwei Ergebnisse „vermischt“.

Entitätsextraktion

Sie können Schemadateien unter dem folgenden Cloud Storage-Speicherort ansehen und herunterladen:
gs://google-cloud-aiplatform/schema/modelevaluation/

  • Konfidenzgrenzwert: Ein Konfidenzwert, der bestimmt, welche Vorhersagen zurückgegeben werden. Ein Modell gibt Vorhersagen mit diesem Wert oder höher zurück. Ein höherer Konfidenzgrenzwert erhöht die Precision, verringert aber den Recall. Vertex AI gibt Konfidenzmesswerte mit unterschiedlichen Grenzwerten zurück, um festzustellen, wie sich der Grenzwert auf die Precision und den Recall auswirkt.
  • Recall: Der Anteil an Vorhersagen mit dieser Klasse, die das Modell korrekt vorhergesagt hat. Wird als Rate richtig positiver Ergebnisse bezeichnet.
  • Präzision: Der Anteil an Klassifizierungsvorhersagen des Modells, die richtig waren.
  • F1-Wert: der harmonische Mittelwert von Precision und Recall. F1 ist ein nützlicher Messwert, wenn Sie ein Gleichgewicht zwischen Precision und Recall anstreben und die Klassenverteilung ungleichmäßig ist
  • Wahrheitsmatrix: Eine Wahrheitsmatrix gibt an, wie oft ein Modell ein Ergebnis korrekt vorhergesagt hat. Bei falsch vorhergesagten Ergebnissen zeigt die Matrix, was das Modell stattdessen vorhergesagt hat. Die Wahrheitsmatrix hilft Ihnen zu verstehen, wo Ihr Modell zwei Ergebnisse „vermischt“.

Sentimentanalyse

Sie können Schemadateien unter dem folgenden Cloud Storage-Speicherort ansehen und herunterladen:
gs://google-cloud-aiplatform/schema/modelevaluation/

  • Recall: Der Anteil an Vorhersagen mit dieser Klasse, die das Modell korrekt vorhergesagt hat. Wird als Rate richtig positiver Ergebnisse bezeichnet.
  • Präzision: Der Anteil an Klassifizierungsvorhersagen des Modells, die richtig waren.
  • F1-Wert: der harmonische Mittelwert von Precision und Recall. F1 ist ein nützlicher Messwert, wenn Sie ein Gleichgewicht zwischen Precision und Recall anstreben und die Klassenverteilung ungleichmäßig ist
  • MAE: Der mittlere absolute Fehler (Mean Absolute Error) ist die durchschnittliche absolute Differenz zwischen den Zielwerten und den vorhergesagten Werten. Dieser Messwert reicht von null bis unendlich. Ein niedrigerer Wert gibt ein höheres Qualitätsmodell an.
  • MSE: Der mittlere quadratische Fehler (Mean Squared Error, MSE) misst die Unterschiede zwischen den von einem Modell oder einem Estimator vorhergesagten Werten und den beobachteten Werten. Niedrigere Werte deuten auf genauere Modelle hin.
  • Linear gewichteter Kappa und quadratisch gewichteter Kappa: Anhand dieser Messwerte wird bestimmt, wie genau die vom Modell zugewiesenen Sentimentwerte mit den von menschlichen Beurteilern zugewiesenen Werten übereinstimmen. Höhere Werte deuten auf genauere Modelle hin.
  • Wahrheitsmatrix: Eine Wahrheitsmatrix gibt an, wie oft ein Modell ein Ergebnis korrekt vorhergesagt hat. Bei falsch vorhergesagten Ergebnissen zeigt die Matrix, was das Modell stattdessen vorhergesagt hat. Die Wahrheitsmatrix hilft Ihnen zu verstehen, wo Ihr Modell zwei Ergebnisse „vermischt“.

Video

Aktionserkennung

Sie können Schemadateien unter dem folgenden Cloud Storage-Speicherort ansehen und herunterladen:
gs://google-cloud-aiplatform/schema/modelevaluation/

  • AuPRC: Der Bereich unter der Precision-/Recall-Kurve (Area Under the Precision/Recall Curve, AuPRC), auch als durchschnittliche Precision bezeichnet. Dieser Wert reicht von null bis eins, wobei ein höherer Wert auf ein Modell von höherer Qualität verweist.
  • Länge des Genauigkeitsfensters: Zeitstempel für Vorhersagen müssen innerhalb dieser Fensterlänge liegen, um als ein richtig positives Ergebnis zu zählen. Der Mittelpunkt des Genauigkeitsfensters ist der Zeitstempel der Ground-Truth-Aktion. Der Wert wird als Anzahl der Sekunden, gemessen vom Start des Videos, ausgedrückt, wobei am Ende „s“ angehängt wird. Bruchwerte sind bis zu einer Precision von Mikrosekunden zulässig.
  • Mittlere durchschnittliche Precision: auch als durchschnittliche Precision bezeichnet. Dieser Wert reicht von null bis eins, wobei ein höherer Wert auf ein Modell von höherer Qualität verweist.
  • Konfidenzgrenzwert: Ein Konfidenzwert, der bestimmt, welche Vorhersagen zurückgegeben werden. Ein Modell gibt Vorhersagen mit diesem Wert oder höher zurück. Ein höherer Konfidenzgrenzwert erhöht die Precision, verringert aber den Recall. Vertex AI gibt Konfidenzmesswerte mit unterschiedlichen Grenzwerten zurück, um festzustellen, wie sich der Grenzwert auf die Precision und den Recall auswirkt.
  • Recall: Der Anteil an Vorhersagen mit dieser Klasse, die das Modell korrekt vorhergesagt hat. Wird als Rate richtig positiver Ergebnisse bezeichnet.
  • Präzision: Der Anteil an Klassifizierungsvorhersagen des Modells, die richtig waren.
  • F1-Wert: der harmonische Mittelwert von Precision und Recall. F1 ist ein nützlicher Messwert, wenn Sie ein Gleichgewicht zwischen Precision und Recall anstreben und die Klassenverteilung ungleichmäßig ist

Klassifizierung

Sie können Schemadateien unter dem folgenden Cloud Storage-Speicherort ansehen und herunterladen:
gs://google-cloud-aiplatform/schema/modelevaluation/

  • AuPRC: Der Bereich unter der Precision-/Recall-Kurve (Area Under the Precision/Recall Curve, AuPRC), auch als durchschnittliche Precision bezeichnet. Dieser Wert reicht von null bis eins, wobei ein höherer Wert auf ein Modell von höherer Qualität verweist.
  • Konfidenzgrenzwert: Ein Konfidenzwert, der bestimmt, welche Vorhersagen zurückgegeben werden. Ein Modell gibt Vorhersagen mit diesem Wert oder höher zurück. Ein höherer Konfidenzgrenzwert erhöht die Precision, verringert aber den Recall. Vertex AI gibt Konfidenzmesswerte mit unterschiedlichen Grenzwerten zurück, um festzustellen, wie sich der Grenzwert auf die Precision und den Recall auswirkt.
  • Recall: Der Anteil an Vorhersagen mit dieser Klasse, die das Modell korrekt vorhergesagt hat. Wird als Rate richtig positiver Ergebnisse bezeichnet.
  • Präzision: Der Anteil an Klassifizierungsvorhersagen des Modells, die richtig waren.
  • F1-Wert: der harmonische Mittelwert von Precision und Recall. F1 ist ein nützlicher Messwert, wenn Sie ein Gleichgewicht zwischen Precision und Recall anstreben und die Klassenverteilung ungleichmäßig ist
  • Wahrheitsmatrix: Eine Wahrheitsmatrix gibt an, wie oft ein Modell ein Ergebnis korrekt vorhergesagt hat. Bei falsch vorhergesagten Ergebnissen zeigt die Matrix, was das Modell stattdessen vorhergesagt hat. Die Wahrheitsmatrix hilft Ihnen zu verstehen, wo Ihr Modell zwei Ergebnisse „vermischt“.

Objekt-Tracking

Sie können Schemadateien unter dem folgenden Cloud Storage-Speicherort ansehen und herunterladen:
gs://google-cloud-aiplatform/schema/modelevaluation/

  • AuPRC: Der Bereich unter der Precision-/Recall-Kurve (Area Under the Precision/Recall Curve, AuPRC), auch als durchschnittliche Precision bezeichnet. Dieser Wert reicht von null bis eins, wobei ein höherer Wert auf ein Modell von höherer Qualität verweist.
  • IoU-Grenzwert: Ein Intersection over Union-Grenzwert, der bestimmt, welche Vorhersagen zurückgegeben werden. Ein Modell gibt Vorhersagen mit diesem Wert oder höher zurück. Je höher der Grenzwert ist, desto näher müssen die vorhergesagten Begrenzungsrahmenwerte an den tatsächlichen Begrenzungsrahmenwerten liegen.
  • Mittlere durchschnittliche Precision: auch als durchschnittliche Precision bezeichnet. Dieser Wert reicht von null bis eins, wobei ein höherer Wert auf ein Modell von höherer Qualität verweist.
  • Konfidenzgrenzwert: Ein Konfidenzwert, der bestimmt, welche Vorhersagen zurückgegeben werden. Ein Modell gibt Vorhersagen mit diesem Wert oder höher zurück. Ein höherer Konfidenzgrenzwert erhöht die Precision, verringert aber den Recall. Vertex AI gibt Konfidenzmesswerte mit unterschiedlichen Grenzwerten zurück, um festzustellen, wie sich der Grenzwert auf die Precision und den Recall auswirkt.
  • Recall: Der Anteil an Vorhersagen mit dieser Klasse, die das Modell korrekt vorhergesagt hat. Wird als Rate richtig positiver Ergebnisse bezeichnet.
  • Präzision: Der Anteil an Klassifizierungsvorhersagen des Modells, die richtig waren.
  • F1-Wert: der harmonische Mittelwert von Precision und Recall. F1 ist ein nützlicher Messwert, wenn Sie ein Gleichgewicht zwischen Precision und Recall anstreben und die Klassenverteilung ungleichmäßig ist
  • Begrenzungsrahmen mit mittlerer durchschnittlicher Genauigkeit: Der einzelne Messwert für die Bewertung von Begrenzungsrahmen: Der Durchschnitt der meanAveragePrecision für alle boundingBoxMetrics.

Bewertungsmesswerte abrufen

Sie können eine ganze Reihe von zusammengefassten Modellbewertungsmesswerten und, für einige Ziele, Bewertungsmesswerte für eine bestimmte Klasse oder ein bestimmtes Label abrufen. Bewertungsmesswerte für eine bestimmte Klasse oder ein bestimmtes Label werden auch als ein Bewertungssegment bezeichnet. Im Folgenden wird beschrieben, wie Sie mit der Google Cloud Console oder der API zusammengefasste Bewertungsmesswerte und Bewertungssegmente abrufen können.

Console

  1. Rufen Sie in der Google Cloud Console im Abschnitt "Vertex AI" die Seite Modelle auf.

    Zur Seite "Modelle"

  2. Wählen Sie im Drop-down-Menü Region die Region aus, in der sich Ihr Modell befindet.

  3. Klicken Sie in der Liste der Modelle auf Ihr Modell, um den Tab Bewerten des Modells zu öffnen.

    Auf dem Tab Bewerten werden die zusammengefassten Bewertungsmesswerte des Modells angezeigt, zum Beispiel die durchschnittliche Precision und den Recall.

    Wenn das Modellziel Bewertungssegmente enthält, wird in der Console eine Liste mit Labels angezeigt. Sie können auf ein Label klicken, um Bewertungsmesswerte für dieses Label anzusehen, wie im folgenden Beispiel gezeigt:

    Labelauswahl in der Console

API

API-Anfragen zum Abrufen von Bewertungsmesswerten sind für jeden Datentyp und jedes Ziel identisch, aber die Ausgaben unterscheiden sich. Die folgenden Beispiele zeigen dieselbe Anfrage, aber unterschiedliche Antworten.

Zusammengefasste Modellbewertungsmesswerte abrufen

Die Gesamtbewertungsmesswerte für das Modell liefern Informationen über das Modell als Ganzes. Wenn Sie Informationen zu einem bestimmten Segment abrufen möchten, listen Sie die Modellbewertungssegmente auf.

Verwenden Sie die Methode projects.locations.models.evaluations.get, um zusammengefasste Modellbewertungsmesswerte anzusehen.

Bild

Wählen Sie unten den Tab für Ihr Ziel aus:

Klassifizierung

Vertex AI gibt ein Array von Konfidenzmesswerten zurück. Jedes Element zeigt Bewertungsmesswerte mit einem anderen confidenceThreshold-Wert an (beginnend von 0 bis maximal 1). Durch die Anzeige verschiedener Grenzwerte können Sie feststellen, wie sich der Grenzwert auf andere Messwerte wie Precision und Recall auswirkt.

Wählen Sie einen Tab für Ihre Sprache oder Umgebung aus:

REST UND BEFEHLSZEILE

Ersetzen Sie diese Werte in den folgenden Anfragedaten:

  • LOCATION: Region, in der Ihr Modell gespeichert ist
  • PROJECT: Ihre Projekt-ID.
  • MODEL_ID: Die ID der Modellressource.
  • PROJECT_NUMBER: Projektnummer für Ihr Projekt.
  • EVALUATION_ID: ID für die Modellbewertung (wird in der Antwort angezeigt)

HTTP-Methode und URL:

GET https://LOCATION-aiplatform.googleapis.com/v1/projects/PROJECT/locations/LOCATION/models/MODEL_ID/evaluations

Senden Sie die Anfrage mithilfe einer der folgenden Optionen:

curl

Führen Sie diesen Befehl aus:

curl -X GET \
-H "Authorization: Bearer $(gcloud auth application-default print-access-token)" \
"https://LOCATION-aiplatform.googleapis.com/v1/projects/PROJECT/locations/LOCATION/models/MODEL_ID/evaluations"

PowerShell

Führen Sie diesen Befehl aus:

$cred = gcloud auth application-default print-access-token
$headers = @{ "Authorization" = "Bearer $cred" }

Invoke-WebRequest `
-Method GET `
-Headers $headers `
-Uri "https://LOCATION-aiplatform.googleapis.com/v1/projects/PROJECT/locations/LOCATION/models/MODEL_ID/evaluations" | Select-Object -Expand Content

Sie sollten in etwa folgende JSON-Antwort erhalten:

Java

Informationen zum Installieren und Verwenden der Clientbibliothek für Vertex AI finden Sie unter Vertex AI-Clientbibliotheken. Weitere Informationen finden Sie in der Referenzdokumentation zur Vertex AI Java API.


import com.google.cloud.aiplatform.v1.ModelEvaluation;
import com.google.cloud.aiplatform.v1.ModelEvaluationName;
import com.google.cloud.aiplatform.v1.ModelServiceClient;
import com.google.cloud.aiplatform.v1.ModelServiceSettings;
import java.io.IOException;

public class GetModelEvaluationImageClassificationSample {

  public static void main(String[] args) throws IOException {
    // TODO(developer): Replace these variables before running the sample.
    // To obtain evaluationId run the code block below after setting modelServiceSettings.
    //
    // try (ModelServiceClient modelServiceClient = ModelServiceClient.create(modelServiceSettings))
    // {
    //   String location = "us-central1";
    //   ModelName modelFullId = ModelName.of(project, location, modelId);
    //   ListModelEvaluationsRequest modelEvaluationsrequest =
    //   ListModelEvaluationsRequest.newBuilder().setParent(modelFullId.toString()).build();
    //   for (ModelEvaluation modelEvaluation :
    //     modelServiceClient.listModelEvaluations(modelEvaluationsrequest).iterateAll()) {
    //       System.out.format("Model Evaluation Name: %s%n", modelEvaluation.getName());
    //   }
    // }
    String project = "YOUR_PROJECT_ID";
    String modelId = "YOUR_MODEL_ID";
    String evaluationId = "YOUR_EVALUATION_ID";
    getModelEvaluationImageClassificationSample(project, modelId, evaluationId);
  }

  static void getModelEvaluationImageClassificationSample(
      String project, String modelId, String evaluationId) throws IOException {
    ModelServiceSettings modelServiceSettings =
        ModelServiceSettings.newBuilder()
            .setEndpoint("us-central1-aiplatform.googleapis.com:443")
            .build();

    // Initialize client that will be used to send requests. This client only needs to be created
    // once, and can be reused for multiple requests. After completing all of your requests, call
    // the "close" method on the client to safely clean up any remaining background resources.
    try (ModelServiceClient modelServiceClient = ModelServiceClient.create(modelServiceSettings)) {
      String location = "us-central1";
      ModelEvaluationName modelEvaluationName =
          ModelEvaluationName.of(project, location, modelId, evaluationId);

      ModelEvaluation modelEvaluation = modelServiceClient.getModelEvaluation(modelEvaluationName);

      System.out.println("Get Model Evaluation Image Classification Response");
      System.out.format("Model Name: %s\n", modelEvaluation.getName());
      System.out.format("Metrics Schema Uri: %s\n", modelEvaluation.getMetricsSchemaUri());
      System.out.format("Metrics: %s\n", modelEvaluation.getMetrics());
      System.out.format("Create Time: %s\n", modelEvaluation.getCreateTime());
      System.out.format("Slice Dimensions: %s\n", modelEvaluation.getSliceDimensionsList());
    }
  }
}

Node.js

Informationen zum Installieren und Verwenden der Clientbibliothek für Vertex AI finden Sie unter Vertex AI-Clientbibliotheken. Weitere Informationen finden Sie in der Referenzdokumentation zur Vertex AI Node.js API.

/**
 * TODO(developer): Uncomment these variables before running the sample
 * (not necessary if passing values as arguments). To obtain evaluationId,
 * instantiate the client and run the following the commands.
 */
// const parentName = `projects/${project}/locations/${location}/models/${modelId}`;
// const evalRequest = {
//   parent: parentName
// };
// const [evalResponse] = await modelServiceClient.listModelEvaluations(evalRequest);
// console.log(evalResponse);

// const modelId = 'YOUR_MODEL_ID';
// const evaluationId = 'YOUR_EVALUATION_ID';
// const project = 'YOUR_PROJECT_ID';
// const location = 'YOUR_PROJECT_LOCATION';

// Imports the Google Cloud Model Service Client library
const {ModelServiceClient} = require('@google-cloud/aiplatform');

// Specifies the location of the api endpoint
const clientOptions = {
  apiEndpoint: 'us-central1-aiplatform.googleapis.com',
};

// Instantiates a client
const modelServiceClient = new ModelServiceClient(clientOptions);

async function getModelEvaluationImageClassification() {
  // Configure the name resources
  const name = `projects/${project}/locations/${location}/models/${modelId}/evaluations/${evaluationId}`;
  const request = {
    name,
  };

  // Create get model evaluation request
  const [response] = await modelServiceClient.getModelEvaluation(request);

  console.log('Get model evaluation image classification response');
  console.log(`\tName : ${response.name}`);
  console.log(`\tMetrics schema uri : ${response.metricsSchemaUri}`);
  console.log(`\tMetrics : ${JSON.stringify(response.metrics)}`);
  console.log(`\tCreate time : ${JSON.stringify(response.createTime)}`);
  console.log(`\tSlice dimensions : ${response.sliceDimensions}`);

  const modelExplanation = response.modelExplanation;
  if (modelExplanation === null) {
    console.log(`\tModel explanation: ${JSON.stringify(modelExplanation)}`);
  } else {
    const meanAttributions = modelExplanation.meanAttributions;
    for (const meanAttribution of meanAttributions) {
      console.log('\t\tMean attribution');
      console.log(
        `\t\t\tBaseline output value : \
           ${meanAttribution.baselineOutputValue}`
      );
      console.log(
        `\t\t\tInstance output value : \
           ${meanAttribution.instanceOutputValue}`
      );
      console.log(
        `\t\t\tFeature attributions : \
           ${JSON.stringify(meanAttribution.featureAttributions)}`
      );
      console.log(`\t\t\tOutput index : ${meanAttribution.outputIndex}`);
      console.log(
        `\t\t\tOutput display name : \
           ${meanAttribution.outputDisplayName}`
      );
      console.log(
        `\t\t\tApproximation error : \
           ${meanAttribution.approximationError}`
      );
    }
  }
}
getModelEvaluationImageClassification();

Python

Informationen zum Installieren und Verwenden der Clientbibliothek für Vertex AI finden Sie unter Vertex AI-Clientbibliotheken. Weitere Informationen finden Sie in der Referenzdokumentation zur Vertex AI Python API.

from google.cloud import aiplatform

def get_model_evaluation_image_classification_sample(
    project: str,
    model_id: str,
    evaluation_id: str,
    location: str = "us-central1",
    api_endpoint: str = "us-central1-aiplatform.googleapis.com",
):
    """
    To obtain evaluation_id run the following commands where LOCATION
    is the region where the model is stored, PROJECT is the project ID,
    and MODEL_ID is the ID of your model.

    model_client = aiplatform.gapic.ModelServiceClient(
        client_options={
            'api_endpoint':'LOCATION-aiplatform.googleapis.com'
            }
        )
    evaluations = model_client.list_model_evaluations(parent='projects/PROJECT/locations/LOCATION/models/MODEL_ID')
    print("evaluations:", evaluations)
    """
    # The AI Platform services require regional API endpoints.
    client_options = {"api_endpoint": api_endpoint}
    # Initialize client that will be used to create and send requests.
    # This client only needs to be created once, and can be reused for multiple requests.
    client = aiplatform.gapic.ModelServiceClient(client_options=client_options)
    name = client.model_evaluation_path(
        project=project, location=location, model=model_id, evaluation=evaluation_id
    )
    response = client.get_model_evaluation(name=name)
    print("response:", response)

Objekterkennung

Für den Messwert des Begrenzungsrahmens gibt Vertex AI ein Array von Messwerten mit verschiedenen IoU-Grenzwerten (zwischen 0 und 1) und Konfidenzwerten (zwischen 0 und 1) zurück. Beispielsweise können Sie die Bewertungsmesswerte auf einen IoU-Grenzwert von 0,85 und einen Konfidenzwert von 0,8228 einschränken. Durch die Anzeige dieser verschiedenen Grenzwerte können Sie sehen, wie sich diese auf andere Messwerte wie Precision und Recall auswirken.

Wählen Sie einen Tab für Ihre Sprache oder Umgebung aus:

REST UND BEFEHLSZEILE

Ersetzen Sie diese Werte in den folgenden Anfragedaten:

  • LOCATION: Region, in der Ihr Modell gespeichert ist
  • PROJECT: Ihre Projekt-ID.
  • MODEL_ID: Die ID der Modellressource.
  • PROJECT_NUMBER: Projektnummer für Ihr Projekt.
  • EVALUATION_ID: ID für die Modellbewertung (wird in der Antwort angezeigt)

HTTP-Methode und URL:

GET https://LOCATION-aiplatform.googleapis.com/v1/projects/PROJECT/locations/LOCATION/models/MODEL_ID/evaluations

Senden Sie die Anfrage mithilfe einer der folgenden Optionen:

curl

Führen Sie diesen Befehl aus:

curl -X GET \
-H "Authorization: Bearer $(gcloud auth application-default print-access-token)" \
"https://LOCATION-aiplatform.googleapis.com/v1/projects/PROJECT/locations/LOCATION/models/MODEL_ID/evaluations"

PowerShell

Führen Sie diesen Befehl aus:

$cred = gcloud auth application-default print-access-token
$headers = @{ "Authorization" = "Bearer $cred" }

Invoke-WebRequest `
-Method GET `
-Headers $headers `
-Uri "https://LOCATION-aiplatform.googleapis.com/v1/projects/PROJECT/locations/LOCATION/models/MODEL_ID/evaluations" | Select-Object -Expand Content

Sie sollten in etwa folgende JSON-Antwort erhalten:

Java

Informationen zum Installieren und Verwenden der Clientbibliothek für Vertex AI finden Sie unter Vertex AI-Clientbibliotheken. Weitere Informationen finden Sie in der Referenzdokumentation zur Vertex AI Java API.


import com.google.cloud.aiplatform.v1.ModelEvaluation;
import com.google.cloud.aiplatform.v1.ModelEvaluationName;
import com.google.cloud.aiplatform.v1.ModelServiceClient;
import com.google.cloud.aiplatform.v1.ModelServiceSettings;
import java.io.IOException;

public class GetModelEvaluationImageObjectDetectionSample {

  public static void main(String[] args) throws IOException {
    // TODO(developer): Replace these variables before running the sample.
    // To obtain evaluationId run the code block below after setting modelServiceSettings.
    //
    // try (ModelServiceClient modelServiceClient = ModelServiceClient.create(modelServiceSettings))
    // {
    //   String location = "us-central1";
    //   ModelName modelFullId = ModelName.of(project, location, modelId);
    //   ListModelEvaluationsRequest modelEvaluationsrequest =
    //   ListModelEvaluationsRequest.newBuilder().setParent(modelFullId.toString()).build();
    //   for (ModelEvaluation modelEvaluation :
    //     modelServiceClient.listModelEvaluations(modelEvaluationsrequest).iterateAll()) {
    //       System.out.format("Model Evaluation Name: %s%n", modelEvaluation.getName());
    //   }
    // }
    String project = "YOUR_PROJECT_ID";
    String modelId = "YOUR_MODEL_ID";
    String evaluationId = "YOUR_EVALUATION_ID";
    getModelEvaluationImageObjectDetectionSample(project, modelId, evaluationId);
  }

  static void getModelEvaluationImageObjectDetectionSample(
      String project, String modelId, String evaluationId) throws IOException {
    ModelServiceSettings modelServiceSettings =
        ModelServiceSettings.newBuilder()
            .setEndpoint("us-central1-aiplatform.googleapis.com:443")
            .build();

    // Initialize client that will be used to send requests. This client only needs to be created
    // once, and can be reused for multiple requests. After completing all of your requests, call
    // the "close" method on the client to safely clean up any remaining background resources.
    try (ModelServiceClient modelServiceClient = ModelServiceClient.create(modelServiceSettings)) {
      String location = "us-central1";
      ModelEvaluationName modelEvaluationName =
          ModelEvaluationName.of(project, location, modelId, evaluationId);

      ModelEvaluation modelEvaluation = modelServiceClient.getModelEvaluation(modelEvaluationName);

      System.out.println("Get Model Evaluation Image Object Detection Response");
      System.out.format("\tName: %s\n", modelEvaluation.getName());
      System.out.format("\tMetrics Schema Uri: %s\n", modelEvaluation.getMetricsSchemaUri());
      System.out.format("\tMetrics: %s\n", modelEvaluation.getMetrics());
      System.out.format("\tCreate Time: %s\n", modelEvaluation.getCreateTime());
      System.out.format("\tSlice Dimensions: %s\n", modelEvaluation.getSliceDimensionsList());
    }
  }
}

Node.js

Informationen zum Installieren und Verwenden der Clientbibliothek für Vertex AI finden Sie unter Vertex AI-Clientbibliotheken. Weitere Informationen finden Sie in der Referenzdokumentation zur Vertex AI Node.js API.

/**
 * TODO(developer): Uncomment these variables before running the sample
 * (not necessary if passing values as arguments). To obtain evaluationId,
 * instantiate the client and run the following the commands.
 */
// const parentName = `projects/${project}/locations/${location}/models/${modelId}`;
// const evalRequest = {
//   parent: parentName
// };
// const [evalResponse] = await modelServiceClient.listModelEvaluations(evalRequest);
// console.log(evalResponse);

// const modelId = 'YOUR_MODEL_ID';
// const evaluationId = 'YOUR_EVALUATION_ID';
// const project = 'YOUR_PROJECT_ID';
// const location = 'YOUR_PROJECT_LOCATION';

// Imports the Google Cloud Model Service Client library
const {ModelServiceClient} = require('@google-cloud/aiplatform');

// Specifies the location of the api endpoint
const clientOptions = {
  apiEndpoint: 'us-central1-aiplatform.googleapis.com',
};

// Instantiates a client
const modelServiceClient = new ModelServiceClient(clientOptions);

async function getModelEvaluationImageObjectDetection() {
  // Configure the name resources
  const name = `projects/${project}/locations/${location}/models/${modelId}/evaluations/${evaluationId}`;
  const request = {
    name,
  };

  // Create get model evaluation request
  const [response] = await modelServiceClient.getModelEvaluation(request);

  console.log('Get model evaluation image object detection response');
  console.log(`\tName : ${response.name}`);
  console.log(`\tMetrics schema uri : ${response.metricsSchemaUri}`);
  console.log(`\tCreate time : ${JSON.stringify(response.createTime)}`);
  console.log(`\tSlice dimensions : ${response.sliceDimensions}`);

  const modelExplanation = response.modelExplanation;
  console.log('\tModel explanation');
  if (modelExplanation === null) {
    console.log('\t\t{}');
  } else {
    const meanAttributions = modelExplanation.meanAttributions;
    if (meanAttributions === null) {
      console.log('\t\t\t []');
    } else {
      for (const meanAttribution of meanAttributions) {
        console.log('\t\tMean attribution');
        console.log(
          `\t\t\tBaseline output value : \
            ${meanAttribution.baselineOutputValue}`
        );
        console.log(
          `\t\t\tInstance output value : \
            ${meanAttribution.instanceOutputValue}`
        );
        console.log(
          `\t\t\tFeature attributions : \
            ${meanAttribution.featureAttributions}`
        );
        console.log(`\t\t\tOutput index : ${meanAttribution.outputIndex}`);
        console.log(
          `\t\t\tOutput display name : \
            ${meanAttribution.outputDisplayName}`
        );
        console.log(
          `\t\t\tApproximation error : \
            ${meanAttribution.approximationError}`
        );
      }
    }
  }
}
getModelEvaluationImageObjectDetection();

Python

Informationen zum Installieren und Verwenden der Clientbibliothek für Vertex AI finden Sie unter Vertex AI-Clientbibliotheken. Weitere Informationen finden Sie in der Referenzdokumentation zur Vertex AI Python API.

from google.cloud import aiplatform

def get_model_evaluation_image_object_detection_sample(
    project: str,
    model_id: str,
    evaluation_id: str,
    location: str = "us-central1",
    api_endpoint: str = "us-central1-aiplatform.googleapis.com",
):
    """
    To obtain evaluation_id run the following commands where LOCATION
    is the region where the model is stored, PROJECT is the project ID,
    and MODEL_ID is the ID of your model.

    model_client = aiplatform.gapic.ModelServiceClient(
        client_options={
            'api_endpoint':'LOCATION-aiplatform.googleapis.com'
            }
        )
    evaluations = model_client.list_model_evaluations(parent='projects/PROJECT/locations/LOCATION/models/MODEL_ID')
    print("evaluations:", evaluations)
    """
    # The AI Platform services require regional API endpoints.
    client_options = {"api_endpoint": api_endpoint}
    # Initialize client that will be used to create and send requests.
    # This client only needs to be created once, and can be reused for multiple requests.
    client = aiplatform.gapic.ModelServiceClient(client_options=client_options)
    name = client.model_evaluation_path(
        project=project, location=location, model=model_id, evaluation=evaluation_id
    )
    response = client.get_model_evaluation(name=name)
    print("response:", response)

Tabellarisch

Wählen Sie unten den Tab für Ihr Ziel aus:

Klassifizierung

Vertex AI gibt ein Array von Konfidenzmesswerten zurück. Jedes Element zeigt Bewertungsmesswerte mit einem anderen confidenceThreshold-Wert an (beginnend von 0 bis maximal 1). Durch die Anzeige verschiedener Grenzwerte können Sie feststellen, wie sich der Grenzwert auf andere Messwerte wie Precision und Recall auswirkt.

Wählen Sie einen Tab für Ihre Sprache oder Umgebung aus:

REST UND BEFEHLSZEILE

Ersetzen Sie diese Werte in den folgenden Anfragedaten:

  • LOCATION: Region, in der Ihr Modell gespeichert ist
  • PROJECT: Ihre Projekt-ID.
  • MODEL_ID: Die ID der Modellressource.
  • PROJECT_NUMBER: Projektnummer für Ihr Projekt.
  • EVALUATION_ID: ID für die Modellbewertung (wird in der Antwort angezeigt)

HTTP-Methode und URL:

GET https://LOCATION-aiplatform.googleapis.com/v1/projects/PROJECT/locations/LOCATION/models/MODEL_ID/evaluations

Senden Sie die Anfrage mithilfe einer der folgenden Optionen:

curl

Führen Sie diesen Befehl aus:

curl -X GET \
-H "Authorization: Bearer $(gcloud auth application-default print-access-token)" \
"https://LOCATION-aiplatform.googleapis.com/v1/projects/PROJECT/locations/LOCATION/models/MODEL_ID/evaluations"

PowerShell

Führen Sie diesen Befehl aus:

$cred = gcloud auth application-default print-access-token
$headers = @{ "Authorization" = "Bearer $cred" }

Invoke-WebRequest `
-Method GET `
-Headers $headers `
-Uri "https://LOCATION-aiplatform.googleapis.com/v1/projects/PROJECT/locations/LOCATION/models/MODEL_ID/evaluations" | Select-Object -Expand Content

Sie sollten in etwa folgende JSON-Antwort erhalten:

Java

Informationen zum Installieren und Verwenden der Clientbibliothek für Vertex AI finden Sie unter Vertex AI-Clientbibliotheken. Weitere Informationen finden Sie in der Referenzdokumentation zur Vertex AI Java API.


import com.google.cloud.aiplatform.v1.ModelEvaluation;
import com.google.cloud.aiplatform.v1.ModelEvaluationName;
import com.google.cloud.aiplatform.v1.ModelServiceClient;
import com.google.cloud.aiplatform.v1.ModelServiceSettings;
import java.io.IOException;

public class GetModelEvaluationTabularClassificationSample {

  public static void main(String[] args) throws IOException {
    // TODO(developer): Replace these variables before running the sample.
    // To obtain evaluationId run the code block below after setting modelServiceSettings.
    //
    // try (ModelServiceClient modelServiceClient = ModelServiceClient.create(modelServiceSettings))
    // {
    //   String location = "us-central1";
    //   ModelName modelFullId = ModelName.of(project, location, modelId);
    //   ListModelEvaluationsRequest modelEvaluationsrequest =
    //   ListModelEvaluationsRequest.newBuilder().setParent(modelFullId.toString()).build();
    //   for (ModelEvaluation modelEvaluation :
    //     modelServiceClient.listModelEvaluations(modelEvaluationsrequest).iterateAll()) {
    //       System.out.format("Model Evaluation Name: %s%n", modelEvaluation.getName());
    //   }
    // }
    String project = "YOUR_PROJECT_ID";
    String modelId = "YOUR_MODEL_ID";
    String evaluationId = "YOUR_EVALUATION_ID";
    getModelEvaluationTabularClassification(project, modelId, evaluationId);
  }

  static void getModelEvaluationTabularClassification(
      String project, String modelId, String evaluationId) throws IOException {
    ModelServiceSettings modelServiceSettings =
        ModelServiceSettings.newBuilder()
            .setEndpoint("us-central1-aiplatform.googleapis.com:443")
            .build();

    // Initialize client that will be used to send requests. This client only needs to be created
    // once, and can be reused for multiple requests. After completing all of your requests, call
    // the "close" method on the client to safely clean up any remaining background resources.
    try (ModelServiceClient modelServiceClient = ModelServiceClient.create(modelServiceSettings)) {
      String location = "us-central1";
      ModelEvaluationName modelEvaluationName =
          ModelEvaluationName.of(project, location, modelId, evaluationId);
      ModelEvaluation modelEvaluation = modelServiceClient.getModelEvaluation(modelEvaluationName);

      System.out.println("Get Model Evaluation Tabular Classification Response");
      System.out.format("\tName: %s\n", modelEvaluation.getName());
      System.out.format("\tMetrics Schema Uri: %s\n", modelEvaluation.getMetricsSchemaUri());
      System.out.format("\tMetrics: %s\n", modelEvaluation.getMetrics());
      System.out.format("\tCreate Time: %s\n", modelEvaluation.getCreateTime());
      System.out.format("\tSlice Dimensions: %s\n", modelEvaluation.getSliceDimensionsList());
    }
  }
}

Node.js

Informationen zum Installieren und Verwenden der Clientbibliothek für Vertex AI finden Sie unter Vertex AI-Clientbibliotheken. Weitere Informationen finden Sie in der Referenzdokumentation zur Vertex AI Node.js API.

/**
 * TODO(developer): Uncomment these variables before running the sample
 * (not necessary if passing values as arguments). To obtain evaluationId,
 * instantiate the client and run the following the commands.
 */
// const parentName = `projects/${project}/locations/${location}/models/${modelId}`;
// const evalRequest = {
//   parent: parentName
// };
// const [evalResponse] = await modelServiceClient.listModelEvaluations(evalRequest);
// console.log(evalResponse);

// const modelId = 'YOUR_MODEL_ID';
// const evaluationId = 'YOUR_EVALUATION_ID';
// const project = 'YOUR_PROJECT_ID';
// const location = 'YOUR_PROJECT_LOCATION';

// Imports the Google Cloud Model Service Client library
const {ModelServiceClient} = require('@google-cloud/aiplatform');

// Specifies the location of the api endpoint
const clientOptions = {
  apiEndpoint: 'us-central1-aiplatform.googleapis.com',
};

// Instantiates a client
const modelServiceClient = new ModelServiceClient(clientOptions);

async function getModelEvaluationTabularClassification() {
  // Configure the parent resources
  const name = `projects/${project}/locations/${location}/models/${modelId}/evaluations/${evaluationId}`;
  const request = {
    name,
  };

  // Get model evaluation request
  const [response] = await modelServiceClient.getModelEvaluation(request);

  console.log('Get model evaluation tabular classification response');
  console.log(`\tName : ${response.name}`);
  console.log(`\tMetrics schema uri : ${response.metricsSchemaUri}`);
  console.log(`\tMetrics : ${JSON.stringify(response.metrics)}`);
  console.log(`\tCreate time : ${JSON.stringify(response.createTime)}`);
  console.log(`\tSlice dimensions : ${response.sliceDimensions}`);

  const modelExplanation = response.modelExplanation;
  console.log('\tModel explanation');
  if (!modelExplanation) {
    console.log('\t\t{}');
  } else {
    const meanAttributions = modelExplanation.meanAttributions;
    if (!meanAttributions) {
      console.log('\t\t\t []');
    } else {
      for (const meanAttribution of meanAttributions) {
        console.log('\t\tMean attribution');
        console.log(
          `\t\t\tBaseline output value : \
            ${meanAttribution.baselineOutputValue}`
        );
        console.log(
          `\t\t\tInstance output value : \
            ${meanAttribution.instanceOutputValue}`
        );
        console.log(
          `\t\t\tFeature attributions : \
            ${JSON.stringify(meanAttribution.featureAttributions)}`
        );
        console.log(`\t\t\tOutput index : ${meanAttribution.outputIndex}`);
        console.log(
          `\t\t\tOutput display name : \
            ${meanAttribution.outputDisplayName}`
        );
        console.log(
          `\t\t\tApproximation error : \
            ${meanAttribution.approximationError}`
        );
      }
    }
  }
}
getModelEvaluationTabularClassification();

Python

Informationen zum Installieren und Verwenden der Clientbibliothek für Vertex AI finden Sie unter Vertex AI-Clientbibliotheken. Weitere Informationen finden Sie in der Referenzdokumentation zur Vertex AI Python API.

from google.cloud import aiplatform

def get_model_evaluation_tabular_classification_sample(
    project: str,
    model_id: str,
    evaluation_id: str,
    location: str = "us-central1",
    api_endpoint: str = "us-central1-aiplatform.googleapis.com",
):
    """
    To obtain evaluation_id run the following commands where LOCATION
    is the region where the model is stored, PROJECT is the project ID,
    and MODEL_ID is the ID of your model.

    model_client = aiplatform.gapic.ModelServiceClient(
        client_options={
            'api_endpoint':'LOCATION-aiplatform.googleapis.com'
            }
        )
    evaluations = model_client.list_model_evaluations(parent='projects/PROJECT/locations/LOCATION/models/MODEL_ID')
    print("evaluations:", evaluations)
    """
    # The AI Platform services require regional API endpoints.
    client_options = {"api_endpoint": api_endpoint}
    # Initialize client that will be used to create and send requests.
    # This client only needs to be created once, and can be reused for multiple requests.
    client = aiplatform.gapic.ModelServiceClient(client_options=client_options)
    name = client.model_evaluation_path(
        project=project, location=location, model=model_id, evaluation=evaluation_id
    )
    response = client.get_model_evaluation(name=name)
    print("response:", response)

Vorhersage

Wählen Sie einen Tab für Ihre Sprache oder Umgebung aus:

REST UND BEFEHLSZEILE

Ersetzen Sie diese Werte in den folgenden Anfragedaten:

  • LOCATION: Region, in der Ihr Modell gespeichert ist
  • PROJECT: Ihre Projekt-ID.
  • MODEL_ID: Die ID der Modellressource. MODEL_ID wird in der Trainingspipeline angezeigt, nachdem das Modelltraining erfolgreich abgeschlossen wurde. Lesen Sie den Abschnitt Vorbereitung, um die MODEL_ID zu erhalten.

HTTP-Methode und URL:

GET https://LOCATION-aiplatform.googleapis.com/v1/projects/PROJECT/locations/LOCATION/models/MODEL_ID/evaluations

Senden Sie die Anfrage mithilfe einer der folgenden Optionen:

curl

Führen Sie diesen Befehl aus:

curl -X GET \
-H "Authorization: Bearer $(gcloud auth application-default print-access-token)" \
"https://LOCATION-aiplatform.googleapis.com/v1/projects/PROJECT/locations/LOCATION/models/MODEL_ID/evaluations"

PowerShell

Führen Sie diesen Befehl aus:

$cred = gcloud auth application-default print-access-token
$headers = @{ "Authorization" = "Bearer $cred" }

Invoke-WebRequest `
-Method GET `
-Headers $headers `
-Uri "https://LOCATION-aiplatform.googleapis.com/v1/projects/PROJECT/locations/LOCATION/models/MODEL_ID/evaluations" | Select-Object -Expand Content

Sie sollten in etwa folgende JSON-Antwort erhalten:

Regression

Wählen Sie einen Tab für Ihre Sprache oder Umgebung aus:

REST UND BEFEHLSZEILE

Ersetzen Sie diese Werte in den folgenden Anfragedaten:

  • LOCATION: Region, in der Ihr Modell gespeichert ist
  • PROJECT: Ihre Projekt-ID.
  • MODEL_ID: Die ID der Modellressource.
  • PROJECT_NUMBER: Projektnummer für Ihr Projekt.
  • EVALUATION_ID: ID für die Modellbewertung (wird in der Antwort angezeigt)

HTTP-Methode und URL:

GET https://LOCATION-aiplatform.googleapis.com/v1/projects/PROJECT/locations/LOCATION/models/MODEL_ID/evaluations

Senden Sie die Anfrage mithilfe einer der folgenden Optionen:

curl

Führen Sie diesen Befehl aus:

curl -X GET \
-H "Authorization: Bearer $(gcloud auth application-default print-access-token)" \
"https://LOCATION-aiplatform.googleapis.com/v1/projects/PROJECT/locations/LOCATION/models/MODEL_ID/evaluations"

PowerShell

Führen Sie diesen Befehl aus:

$cred = gcloud auth application-default print-access-token
$headers = @{ "Authorization" = "Bearer $cred" }

Invoke-WebRequest `
-Method GET `
-Headers $headers `
-Uri "https://LOCATION-aiplatform.googleapis.com/v1/projects/PROJECT/locations/LOCATION/models/MODEL_ID/evaluations" | Select-Object -Expand Content

Sie sollten in etwa folgende JSON-Antwort erhalten:

Java

Informationen zum Installieren und Verwenden der Clientbibliothek für Vertex AI finden Sie unter Vertex AI-Clientbibliotheken. Weitere Informationen finden Sie in der Referenzdokumentation zur Vertex AI Java API.


import com.google.cloud.aiplatform.v1.ModelEvaluation;
import com.google.cloud.aiplatform.v1.ModelEvaluationName;
import com.google.cloud.aiplatform.v1.ModelServiceClient;
import com.google.cloud.aiplatform.v1.ModelServiceSettings;
import java.io.IOException;

public class GetModelEvaluationTabularRegressionSample {

  public static void main(String[] args) throws IOException {
    // TODO(developer): Replace these variables before running the sample.
    // To obtain evaluationId run the code block below after setting modelServiceSettings.
    //
    // try (ModelServiceClient modelServiceClient = ModelServiceClient.create(modelServiceSettings))
    // {
    //   String location = "us-central1";
    //   ModelName modelFullId = ModelName.of(project, location, modelId);
    //   ListModelEvaluationsRequest modelEvaluationsrequest =
    //   ListModelEvaluationsRequest.newBuilder().setParent(modelFullId.toString()).build();
    //   for (ModelEvaluation modelEvaluation :
    //     modelServiceClient.listModelEvaluations(modelEvaluationsrequest).iterateAll()) {
    //       System.out.format("Model Evaluation Name: %s%n", modelEvaluation.getName());
    //   }
    // }
    String project = "YOUR_PROJECT_ID";
    String modelId = "YOUR_MODEL_ID";
    String evaluationId = "YOUR_EVALUATION_ID";
    getModelEvaluationTabularRegression(project, modelId, evaluationId);
  }

  static void getModelEvaluationTabularRegression(
      String project, String modelId, String evaluationId) throws IOException {
    ModelServiceSettings modelServiceSettings =
        ModelServiceSettings.newBuilder()
            .setEndpoint("us-central1-aiplatform.googleapis.com:443")
            .build();

    // Initialize client that will be used to send requests. This client only needs to be created
    // once, and can be reused for multiple requests. After completing all of your requests, call
    // the "close" method on the client to safely clean up any remaining background resources.
    try (ModelServiceClient modelServiceClient = ModelServiceClient.create(modelServiceSettings)) {
      String location = "us-central1";
      ModelEvaluationName modelEvaluationName =
          ModelEvaluationName.of(project, location, modelId, evaluationId);
      ModelEvaluation modelEvaluation = modelServiceClient.getModelEvaluation(modelEvaluationName);

      System.out.println("Get Model Evaluation Tabular Regression Response");
      System.out.format("\tName: %s\n", modelEvaluation.getName());
      System.out.format("\tMetrics Schema Uri: %s\n", modelEvaluation.getMetricsSchemaUri());
      System.out.format("\tMetrics: %s\n", modelEvaluation.getMetrics());
      System.out.format("\tCreate Time: %s\n", modelEvaluation.getCreateTime());
      System.out.format("\tSlice Dimensions: %s\n", modelEvaluation.getSliceDimensionsList());
    }
  }
}

Node.js

Informationen zum Installieren und Verwenden der Clientbibliothek für Vertex AI finden Sie unter Vertex AI-Clientbibliotheken. Weitere Informationen finden Sie in der Referenzdokumentation zur Vertex AI Node.js API.

/**
 * TODO(developer): Uncomment these variables before running the sample
 * (not necessary if passing values as arguments). To obtain evaluationId,
 * instantiate the client and run the following the commands.
 */
// const parentName = `projects/${project}/locations/${location}/models/${modelId}`;
// const evalRequest = {
//   parent: parentName
// };
// const [evalResponse] = await modelServiceClient.listModelEvaluations(evalRequest);
// console.log(evalResponse);

// const modelId = 'YOUR_MODEL_ID';
// const evaluationId = 'YOUR_EVALUATION_ID';
// const project = 'YOUR_PROJECT_ID';
// const location = 'YOUR_PROJECT_LOCATION';

// Imports the Google Cloud Model Service Client library
const {ModelServiceClient} = require('@google-cloud/aiplatform');

// Specifies the location of the api endpoint
const clientOptions = {
  apiEndpoint: 'us-central1-aiplatform.googleapis.com',
};

// Instantiates a client
const modelServiceClient = new ModelServiceClient(clientOptions);

async function getModelEvaluationTabularRegression() {
  // Configure the parent resources
  const name = `projects/${project}/locations/${location}/models/${modelId}/evaluations/${evaluationId}`;
  const request = {
    name,
  };

  // Get model evaluation request
  const [response] = await modelServiceClient.getModelEvaluation(request);

  console.log('Get model evaluation tabular regression response');
  console.log(`\tName : ${response.name}`);
  console.log(`\tMetrics schema uri : ${response.metricsSchemaUri}`);
  console.log(`\tMetrics : ${JSON.stringify(response.metrics)}`);
  console.log(`\tCreate time : ${JSON.stringify(response.createTime)}`);
  console.log(`\tSlice dimensions : ${response.sliceDimensions}`);

  const modelExplanation = response.modelExplanation;
  console.log('\tModel explanation');
  if (!modelExplanation) {
    console.log('\t\t{}');
  } else {
    const meanAttributions = modelExplanation.meanAttributions;
    if (!meanAttributions) {
      console.log('\t\t\t []');
    } else {
      for (const meanAttribution of meanAttributions) {
        console.log('\t\tMean attribution');
        console.log(
          `\t\t\tBaseline output value : \
            ${meanAttribution.baselineOutputValue}`
        );
        console.log(
          `\t\t\tInstance output value : \
            ${meanAttribution.instanceOutputValue}`
        );
        console.log(
          `\t\t\tFeature attributions : \
            ${JSON.stringify(meanAttribution.featureAttributions)}`
        );
        console.log(`\t\t\tOutput index : ${meanAttribution.outputIndex}`);
        console.log(
          `\t\t\tOutput display name : \
            ${meanAttribution.outputDisplayName}`
        );
        console.log(
          `\t\t\tApproximation error : \
            ${meanAttribution.approximationError}`
        );
      }
    }
  }
}
getModelEvaluationTabularRegression();

Python

Informationen zum Installieren und Verwenden der Clientbibliothek für Vertex AI finden Sie unter Vertex AI-Clientbibliotheken. Weitere Informationen finden Sie in der Referenzdokumentation zur Vertex AI Python API.

from google.cloud import aiplatform

def get_model_evaluation_tabular_regression_sample(
    project: str,
    model_id: str,
    evaluation_id: str,
    location: str = "us-central1",
    api_endpoint: str = "us-central1-aiplatform.googleapis.com",
):
    """
    To obtain evaluation_id run the following commands where LOCATION
    is the region where the model is stored, PROJECT is the project ID,
    and MODEL_ID is the ID of your model.

    model_client = aiplatform.gapic.ModelServiceClient(
        client_options={
            'api_endpoint':'LOCATION-aiplatform.googleapis.com'
            }
        )
    evaluations = model_client.list_model_evaluations(parent='projects/PROJECT/locations/LOCATION/models/MODEL_ID')
    print("evaluations:", evaluations)
    """
    # The AI Platform services require regional API endpoints.
    client_options = {"api_endpoint": api_endpoint}
    # Initialize client that will be used to create and send requests.
    # This client only needs to be created once, and can be reused for multiple requests.
    client = aiplatform.gapic.ModelServiceClient(client_options=client_options)
    name = client.model_evaluation_path(
        project=project, location=location, model=model_id, evaluation=evaluation_id
    )
    response = client.get_model_evaluation(name=name)
    print("response:", response)

Text

Wählen Sie unten den Tab für Ihr Ziel aus:

Klassifizierung

Vertex AI gibt ein Array von Konfidenzmesswerten zurück. Jedes Element zeigt Bewertungsmesswerte mit einem anderen confidenceThreshold-Wert an (beginnend von 0 bis maximal 1). Durch die Anzeige verschiedener Grenzwerte können Sie feststellen, wie sich der Grenzwert auf andere Messwerte wie Precision und Recall auswirkt.

Wählen Sie einen Tab für Ihre Sprache oder Umgebung aus:

REST UND BEFEHLSZEILE

Ersetzen Sie diese Werte in den folgenden Anfragedaten:

  • LOCATION: Region, in der Ihr Modell gespeichert ist
  • PROJECT: Ihre Projekt-ID.
  • MODEL_ID: Die ID der Modellressource.
  • PROJECT_NUMBER: Projektnummer für Ihr Projekt.
  • EVALUATION_ID: ID für die Modellbewertung (wird in der Antwort angezeigt)

HTTP-Methode und URL:

GET https://LOCATION-aiplatform.googleapis.com/v1/projects/PROJECT/locations/LOCATION/models/MODEL_ID/evaluations

Senden Sie die Anfrage mithilfe einer der folgenden Optionen:

curl

Führen Sie diesen Befehl aus:

curl -X GET \
-H "Authorization: Bearer $(gcloud auth application-default print-access-token)" \
"https://LOCATION-aiplatform.googleapis.com/v1/projects/PROJECT/locations/LOCATION/models/MODEL_ID/evaluations"

PowerShell

Führen Sie diesen Befehl aus:

$cred = gcloud auth application-default print-access-token
$headers = @{ "Authorization" = "Bearer $cred" }

Invoke-WebRequest `
-Method GET `
-Headers $headers `
-Uri "https://LOCATION-aiplatform.googleapis.com/v1/projects/PROJECT/locations/LOCATION/models/MODEL_ID/evaluations" | Select-Object -Expand Content

Sie sollten in etwa folgende JSON-Antwort erhalten:

Java

Informationen zum Installieren und Verwenden der Clientbibliothek für Vertex AI finden Sie unter Vertex AI-Clientbibliotheken. Weitere Informationen finden Sie in der Referenzdokumentation zur Vertex AI Java API.


import com.google.cloud.aiplatform.v1.ModelEvaluation;
import com.google.cloud.aiplatform.v1.ModelEvaluationName;
import com.google.cloud.aiplatform.v1.ModelServiceClient;
import com.google.cloud.aiplatform.v1.ModelServiceSettings;
import java.io.IOException;

public class GetModelEvaluationTextClassificationSample {

  public static void main(String[] args) throws IOException {
    // TODO(developer): Replace these variables before running the sample.
    // To obtain evaluationId run the code block below after setting modelServiceSettings.
    //
    // try (ModelServiceClient modelServiceClient = ModelServiceClient.create(modelServiceSettings))
    // {
    //   String location = "us-central1";
    //   ModelName modelFullId = ModelName.of(project, location, modelId);
    //   ListModelEvaluationsRequest modelEvaluationsrequest =
    //   ListModelEvaluationsRequest.newBuilder().setParent(modelFullId.toString()).build();
    //   for (ModelEvaluation modelEvaluation :
    //     modelServiceClient.listModelEvaluations(modelEvaluationsrequest).iterateAll()) {
    //       System.out.format("Model Evaluation Name: %s%n", modelEvaluation.getName());
    //   }
    // }
    String project = "YOUR_PROJECT_ID";
    String modelId = "YOUR_MODEL_ID";
    String evaluationId = "YOUR_EVALUATION_ID";

    getModelEvaluationTextClassificationSample(project, modelId, evaluationId);
  }

  static void getModelEvaluationTextClassificationSample(
      String project, String modelId, String evaluationId) throws IOException {
    ModelServiceSettings modelServiceSettings =
        ModelServiceSettings.newBuilder()
            .setEndpoint("us-central1-aiplatform.googleapis.com:443")
            .build();

    // Initialize client that will be used to send requests. This client only needs to be created
    // once, and can be reused for multiple requests. After completing all of your requests, call
    // the "close" method on the client to safely clean up any remaining background resources.
    try (ModelServiceClient modelServiceClient = ModelServiceClient.create(modelServiceSettings)) {
      String location = "us-central1";

      ModelEvaluationName modelEvaluationName =
          ModelEvaluationName.of(project, location, modelId, evaluationId);
      ModelEvaluation modelEvaluation = modelServiceClient.getModelEvaluation(modelEvaluationName);

      System.out.println("Get Model Evaluation Text Classification Response");
      System.out.format("\tModel Name: %s\n", modelEvaluation.getName());
      System.out.format("\tMetrics Schema Uri: %s\n", modelEvaluation.getMetricsSchemaUri());
      System.out.format("\tMetrics: %s\n", modelEvaluation.getMetrics());
      System.out.format("\tCreate Time: %s\n", modelEvaluation.getCreateTime());
      System.out.format("\tSlice Dimensions: %s\n", modelEvaluation.getSliceDimensionsList());
    }
  }
}

Node.js

Informationen zum Installieren und Verwenden der Clientbibliothek für Vertex AI finden Sie unter Vertex AI-Clientbibliotheken. Weitere Informationen finden Sie in der Referenzdokumentation zur Vertex AI Node.js API.

/**
 * TODO(developer): Uncomment these variables before running the sample
 * (not necessary if passing values as arguments). To obtain evaluationId,
 * instantiate the client and run the following the commands.
 */
// const parentName = `projects/${project}/locations/${location}/models/${modelId}`;
// const evalRequest = {
//   parent: parentName
// };
// const [evalResponse] = await modelServiceClient.listModelEvaluations(evalRequest);
// console.log(evalResponse);

// const modelId = 'YOUR_MODEL_ID';
// const evaluationId = 'YOUR_EVALUATION_ID';
// const project = 'YOUR_PROJECT_ID';
// const location = 'YOUR_PROJECT_LOCATION';

// Imports the Google Cloud Model Service Client library
const {ModelServiceClient} = require('@google-cloud/aiplatform');

// Specifies the location of the api endpoint
const clientOptions = {
  apiEndpoint: 'us-central1-aiplatform.googleapis.com',
};

// Instantiates a client
const modelServiceClient = new ModelServiceClient(clientOptions);

async function getModelEvaluationTextClassification() {
  // Configure the resources
  const name = `projects/${project}/locations/${location}/models/${modelId}/evaluations/${evaluationId}`;
  const request = {
    name,
  };

  // Get model evaluation request
  const [response] = await modelServiceClient.getModelEvaluation(request);

  console.log('Get model evaluation text classification response :');
  console.log(`\tName : ${response.name}`);
  console.log(`\tMetrics schema uri : ${response.metricsSchemaUri}`);
  console.log(`\tMetrics : ${JSON.stringify(response.metrics)}`);

  const modelExplanation = response.modelExplanation;
  console.log('\tModel explanation');
  if (modelExplanation === null) {
    console.log('\t\t{}');
  } else {
    const meanAttributions = modelExplanation.meanAttributions;
    if (meanAttributions === null) {
      console.log('\t\t\t []');
    } else {
      for (const meanAttribution of meanAttributions) {
        console.log('\t\tMean attribution');
        console.log(
          `\t\t\tBaseline output value : \
            ${meanAttribution.baselineOutputValue}`
        );
        console.log(
          `\t\t\tInstance output value : \
            ${meanAttribution.instanceOutputValue}`
        );
        console.log(
          `\t\t\tFeature attributions : \
            ${JSON.stringify(meanAttribution.featureAttributions)}`
        );
        console.log(`\t\t\tOutput index : ${meanAttribution.outputIndex}`);
        console.log(
          `\t\t\tOutput display name : \
            ${meanAttribution.outputDisplayName}`
        );
        console.log(
          `\t\t\tApproximation error : \
            ${meanAttribution.approximationError}`
        );
      }
    }
  }
}
getModelEvaluationTextClassification();

Python

Informationen zum Installieren und Verwenden der Clientbibliothek für Vertex AI finden Sie unter Vertex AI-Clientbibliotheken. Weitere Informationen finden Sie in der Referenzdokumentation zur Vertex AI Python API.

from google.cloud import aiplatform

def get_model_evaluation_text_classification_sample(
    project: str,
    model_id: str,
    evaluation_id: str,
    location: str = "us-central1",
    api_endpoint: str = "us-central1-aiplatform.googleapis.com",
):
    """
    To obtain evaluation_id run the following commands where LOCATION
    is the region where the model is stored, PROJECT is the project ID,
    and MODEL_ID is the ID of your model.

    model_client = aiplatform.gapic.ModelServiceClient(
        client_options={
            'api_endpoint':'LOCATION-aiplatform.googleapis.com'
            }
        )
    evaluations = model_client.list_model_evaluations(parent='projects/PROJECT/locations/LOCATION/models/MODEL_ID')
    print("evaluations:", evaluations)
    """
    # The AI Platform services require regional API endpoints.
    client_options = {"api_endpoint": api_endpoint}
    # Initialize client that will be used to create and send requests.
    # This client only needs to be created once, and can be reused for multiple requests.
    client = aiplatform.gapic.ModelServiceClient(client_options=client_options)
    name = client.model_evaluation_path(
        project=project, location=location, model=model_id, evaluation=evaluation_id
    )
    response = client.get_model_evaluation(name=name)
    print("response:", response)

Entitätsextraktion

Vertex AI gibt ein Array von Konfidenzmesswerten zurück. Jedes Element zeigt Bewertungsmesswerte mit einem anderen confidenceThreshold-Wert an (beginnend von 0 bis maximal 1). Durch die Anzeige verschiedener Grenzwerte können Sie feststellen, wie sich der Grenzwert auf andere Messwerte wie Precision und Recall auswirkt.

Wählen Sie einen Tab für Ihre Sprache oder Umgebung aus:

REST UND BEFEHLSZEILE

Ersetzen Sie diese Werte in den folgenden Anfragedaten:

  • LOCATION: Region, in der Ihr Modell gespeichert ist
  • PROJECT: Ihre Projekt-ID.
  • MODEL_ID: Die ID der Modellressource.
  • PROJECT_NUMBER: Projektnummer für Ihr Projekt.
  • EVALUATION_ID: ID für die Modellbewertung (wird in der Antwort angezeigt)

HTTP-Methode und URL:

GET https://LOCATION-aiplatform.googleapis.com/v1/projects/PROJECT/locations/LOCATION/models/MODEL_ID/evaluations

Senden Sie die Anfrage mithilfe einer der folgenden Optionen:

curl

Führen Sie diesen Befehl aus:

curl -X GET \
-H "Authorization: Bearer $(gcloud auth application-default print-access-token)" \
"https://LOCATION-aiplatform.googleapis.com/v1/projects/PROJECT/locations/LOCATION/models/MODEL_ID/evaluations"

PowerShell

Führen Sie diesen Befehl aus:

$cred = gcloud auth application-default print-access-token
$headers = @{ "Authorization" = "Bearer $cred" }

Invoke-WebRequest `
-Method GET `
-Headers $headers `
-Uri "https://LOCATION-aiplatform.googleapis.com/v1/projects/PROJECT/locations/LOCATION/models/MODEL_ID/evaluations" | Select-Object -Expand Content

Sie sollten in etwa folgende JSON-Antwort erhalten:

Java

Informationen zum Installieren und Verwenden der Clientbibliothek für Vertex AI finden Sie unter Vertex AI-Clientbibliotheken. Weitere Informationen finden Sie in der Referenzdokumentation zur Vertex AI Java API.


import com.google.cloud.aiplatform.v1.ModelEvaluation;
import com.google.cloud.aiplatform.v1.ModelEvaluationName;
import com.google.cloud.aiplatform.v1.ModelServiceClient;
import com.google.cloud.aiplatform.v1.ModelServiceSettings;
import java.io.IOException;

public class GetModelEvaluationTextEntityExtractionSample {

  public static void main(String[] args) throws IOException {
    // TODO(developer): Replace these variables before running the sample.
    // To obtain evaluationId run the code block below after setting modelServiceSettings.
    //
    // try (ModelServiceClient modelServiceClient = ModelServiceClient.create(modelServiceSettings))
    // {
    //   String location = "us-central1";
    //   ModelName modelFullId = ModelName.of(project, location, modelId);
    //   ListModelEvaluationsRequest modelEvaluationsrequest =
    //   ListModelEvaluationsRequest.newBuilder().setParent(modelFullId.toString()).build();
    //   for (ModelEvaluation modelEvaluation :
    //     modelServiceClient.listModelEvaluations(modelEvaluationsrequest).iterateAll()) {
    //       System.out.format("Model Evaluation Name: %s%n", modelEvaluation.getName());
    //   }
    // }
    String project = "YOUR_PROJECT_ID";
    String modelId = "YOUR_MODEL_ID";
    String evaluationId = "YOUR_EVALUATION_ID";

    getModelEvaluationTextEntityExtractionSample(project, modelId, evaluationId);
  }

  static void getModelEvaluationTextEntityExtractionSample(
      String project, String modelId, String evaluationId) throws IOException {
    ModelServiceSettings modelServiceSettings =
        ModelServiceSettings.newBuilder()
            .setEndpoint("us-central1-aiplatform.googleapis.com:443")
            .build();

    // Initialize client that will be used to send requests. This client only needs to be created
    // once, and can be reused for multiple requests. After completing all of your requests, call
    // the "close" method on the client to safely clean up any remaining background resources.
    try (ModelServiceClient modelServiceClient = ModelServiceClient.create(modelServiceSettings)) {
      String location = "us-central1";

      ModelEvaluationName modelEvaluationName =
          ModelEvaluationName.of(project, location, modelId, evaluationId);
      ModelEvaluation modelEvaluation = modelServiceClient.getModelEvaluation(modelEvaluationName);

      System.out.println("Get Model Evaluation Text Entity Extraction Response");
      System.out.format("\tModel Name: %s\n", modelEvaluation.getName());
      System.out.format("\tMetrics Schema Uri: %s\n", modelEvaluation.getMetricsSchemaUri());
      System.out.format("\tMetrics: %s\n", modelEvaluation.getMetrics());
      System.out.format("\tCreate Time: %s\n", modelEvaluation.getCreateTime());
      System.out.format("\tSlice Dimensions: %s\n", modelEvaluation.getSliceDimensionsList());
    }
  }
}

Node.js

Informationen zum Installieren und Verwenden der Clientbibliothek für Vertex AI finden Sie unter Vertex AI-Clientbibliotheken. Weitere Informationen finden Sie in der Referenzdokumentation zur Vertex AI Node.js API.

/**
 * TODO(developer): Uncomment these variables before running the sample
 * (not necessary if passing values as arguments). To obtain evaluationId,
 * instantiate the client and run the following the commands.
 */
// const parentName = `projects/${project}/locations/${location}/models/${modelId}`;
// const evalRequest = {
//   parent: parentName
// };
// const [evalResponse] = await modelServiceClient.listModelEvaluations(evalRequest);
// console.log(evalResponse);

// const modelId = 'YOUR_MODEL_ID';
// const evaluationId = 'YOUR_EVALUATION_ID';
// const project = 'YOUR_PROJECT_ID';
// const location = 'YOUR_PROJECT_LOCATION';

// Imports the Google Cloud Model Service Client library
const {ModelServiceClient} = require('@google-cloud/aiplatform');

// Specifies the location of the api endpoint
const clientOptions = {
  apiEndpoint: 'us-central1-aiplatform.googleapis.com',
};

// Instantiates a client
const modelServiceClient = new ModelServiceClient(clientOptions);

async function getModelEvaluationTextEntityExtraction() {
  // Configure the resources
  const name = `projects/${project}/locations/${location}/models/${modelId}/evaluations/${evaluationId}`;
  const request = {
    name,
  };

  // Get model evaluation request
  const [response] = await modelServiceClient.getModelEvaluation(request);

  console.log('Get model evaluation text entity extraction response :');
  console.log(`\tName : ${response.name}`);
  console.log(`\tMetrics schema uri : ${response.metricsSchemaUri}`);
  console.log(`\tMetrics : ${JSON.stringify(response.metrics)}`);

  const modelExplanation = response.modelExplanation;
  console.log('\tModel explanation');
  if (modelExplanation === null) {
    console.log('\t\t{}');
  } else {
    const meanAttributions = modelExplanation.meanAttributions;
    if (meanAttributions === null) {
      console.log('\t\t\t []');
    } else {
      for (const meanAttribution of meanAttributions) {
        console.log('\t\tMean attribution');
        console.log(
          `\t\t\tBaseline output value : \
            ${meanAttribution.baselineOutputValue}`
        );
        console.log(
          `\t\t\tInstance output value : \
            ${meanAttribution.instanceOutputValue}`
        );
        console.log(
          `\t\t\tFeature attributions : \
            ${JSON.stringify(meanAttribution.featureAttributions)}`
        );
        console.log(`\t\t\tOutput index : ${meanAttribution.outputIndex}`);
        console.log(
          `\t\t\tOutput display name : \
            ${meanAttribution.outputDisplayName}`
        );
        console.log(
          `\t\t\tApproximation error : \
            ${meanAttribution.approximationError}`
        );
      }
    }
  }
}
getModelEvaluationTextEntityExtraction();

Python

Informationen zum Installieren und Verwenden der Clientbibliothek für Vertex AI finden Sie unter Vertex AI-Clientbibliotheken. Weitere Informationen finden Sie in der Referenzdokumentation zur Vertex AI Python API.

from google.cloud import aiplatform

def get_model_evaluation_text_entity_extraction_sample(
    project: str,
    model_id: str,
    evaluation_id: str,
    location: str = "us-central1",
    api_endpoint: str = "us-central1-aiplatform.googleapis.com",
):
    """
    To obtain evaluation_id run the following commands where LOCATION
    is the region where the model is stored, PROJECT is the project ID,
    and MODEL_ID is the ID of your model.

    model_client = aiplatform.gapic.ModelServiceClient(
        client_options={
            'api_endpoint':'LOCATION-aiplatform.googleapis.com'
            }
        )
    evaluations = model_client.list_model_evaluations(parent='projects/PROJECT/locations/LOCATION/models/MODEL_ID')
    print("evaluations:", evaluations)
    """
    # The AI Platform services require regional API endpoints.
    client_options = {"api_endpoint": api_endpoint}
    # Initialize client that will be used to create and send requests.
    # This client only needs to be created once, and can be reused for multiple requests.
    client = aiplatform.gapic.ModelServiceClient(client_options=client_options)
    name = client.model_evaluation_path(
        project=project, location=location, model=model_id, evaluation=evaluation_id
    )
    response = client.get_model_evaluation(name=name)
    print("response:", response)

Sentimentanalyse

Wählen Sie einen Tab für Ihre Sprache oder Umgebung aus:

REST UND BEFEHLSZEILE

Ersetzen Sie diese Werte in den folgenden Anfragedaten:

  • LOCATION: Region, in der Ihr Modell gespeichert ist
  • PROJECT: Ihre Projekt-ID.
  • MODEL_ID: Die ID der Modellressource.
  • PROJECT_NUMBER: Projektnummer für Ihr Projekt.
  • EVALUATION_ID: ID für die Modellbewertung (wird in der Antwort angezeigt)

HTTP-Methode und URL:

GET https://LOCATION-aiplatform.googleapis.com/v1/projects/PROJECT/locations/LOCATION/models/MODEL_ID/evaluations

Senden Sie die Anfrage mithilfe einer der folgenden Optionen:

curl

Führen Sie diesen Befehl aus:

curl -X GET \
-H "Authorization: Bearer $(gcloud auth application-default print-access-token)" \
"https://LOCATION-aiplatform.googleapis.com/v1/projects/PROJECT/locations/LOCATION/models/MODEL_ID/evaluations"

PowerShell

Führen Sie diesen Befehl aus:

$cred = gcloud auth application-default print-access-token
$headers = @{ "Authorization" = "Bearer $cred" }

Invoke-WebRequest `
-Method GET `
-Headers $headers `
-Uri "https://LOCATION-aiplatform.googleapis.com/v1/projects/PROJECT/locations/LOCATION/models/MODEL_ID/evaluations" | Select-Object -Expand Content

Sie sollten in etwa folgende JSON-Antwort erhalten:

Java

Informationen zum Installieren und Verwenden der Clientbibliothek für Vertex AI finden Sie unter Vertex AI-Clientbibliotheken. Weitere Informationen finden Sie in der Referenzdokumentation zur Vertex AI Java API.


import com.google.cloud.aiplatform.v1.ModelEvaluation;
import com.google.cloud.aiplatform.v1.ModelEvaluationName;
import com.google.cloud.aiplatform.v1.ModelServiceClient;
import com.google.cloud.aiplatform.v1.ModelServiceSettings;
import java.io.IOException;

public class GetModelEvaluationTextSentimentAnalysisSample {

  public static void main(String[] args) throws IOException {
    // TODO(developer): Replace these variables before running the sample.
    // To obtain evaluationId run the code block below after setting modelServiceSettings.
    //
    // try (ModelServiceClient modelServiceClient = ModelServiceClient.create(modelServiceSettings))
    // {
    //   String location = "us-central1";
    //   ModelName modelFullId = ModelName.of(project, location, modelId);
    //   ListModelEvaluationsRequest modelEvaluationsrequest =
    //   ListModelEvaluationsRequest.newBuilder().setParent(modelFullId.toString()).build();
    //   for (ModelEvaluation modelEvaluation :
    //     modelServiceClient.listModelEvaluations(modelEvaluationsrequest).iterateAll()) {
    //       System.out.format("Model Evaluation Name: %s%n", modelEvaluation.getName());
    //   }
    // }
    String project = "YOUR_PROJECT_ID";
    String modelId = "YOUR_MODEL_ID";
    String evaluationId = "YOUR_EVALUATION_ID";

    getModelEvaluationTextSentimentAnalysisSample(project, modelId, evaluationId);
  }

  static void getModelEvaluationTextSentimentAnalysisSample(
      String project, String modelId, String evaluationId) throws IOException {
    ModelServiceSettings modelServiceSettings =
        ModelServiceSettings.newBuilder()
            .setEndpoint("us-central1-aiplatform.googleapis.com:443")
            .build();

    // Initialize client that will be used to send requests. This client only needs to be created
    // once, and can be reused for multiple requests. After completing all of your requests, call
    // the "close" method on the client to safely clean up any remaining background resources.
    try (ModelServiceClient modelServiceClient = ModelServiceClient.create(modelServiceSettings)) {
      String location = "us-central1";

      ModelEvaluationName modelEvaluationName =
          ModelEvaluationName.of(project, location, modelId, evaluationId);
      ModelEvaluation modelEvaluation = modelServiceClient.getModelEvaluation(modelEvaluationName);

      System.out.println("Get Model Evaluation Text Sentiment Analysis Response");
      System.out.format("\tModel Name: %s\n", modelEvaluation.getName());
      System.out.format("\tMetrics Schema Uri: %s\n", modelEvaluation.getMetricsSchemaUri());
      System.out.format("\tMetrics: %s\n", modelEvaluation.getMetrics());
      System.out.format("\tCreate Time: %s\n", modelEvaluation.getCreateTime());
      System.out.format("\tSlice Dimensions: %s\n", modelEvaluation.getSliceDimensionsList());
    }
  }
}

Node.js

Informationen zum Installieren und Verwenden der Clientbibliothek für Vertex AI finden Sie unter Vertex AI-Clientbibliotheken. Weitere Informationen finden Sie in der Referenzdokumentation zur Vertex AI Node.js API.

/**
 * TODO(developer): Uncomment these variables before running the sample
 * (not necessary if passing values as arguments). To obtain evaluationId,
 * instantiate the client and run the following the commands.
 */
// const parentName = `projects/${project}/locations/${location}/models/${modelId}`;
// const evalRequest = {
//   parent: parentName
// };
// const [evalResponse] = await modelServiceClient.listModelEvaluations(evalRequest);
// console.log(evalResponse);

// const modelId = 'YOUR_MODEL_ID';
// const evaluationId = 'YOUR_EVALUATION_ID';
// const project = 'YOUR_PROJECT_ID';
// const location = 'YOUR_PROJECT_LOCATION';

// Imports the Google Cloud Model Service Client library
const {ModelServiceClient} = require('@google-cloud/aiplatform');

// Specifies the location of the api endpoint
const clientOptions = {
  apiEndpoint: 'us-central1-aiplatform.googleapis.com',
};

// Instantiates a client
const modelServiceClient = new ModelServiceClient(clientOptions);

async function getModelEvaluationTextSentimentAnalysis() {
  // Configure the resources
  const name = `projects/${project}/locations/${location}/models/${modelId}/evaluations/${evaluationId}`;
  const request = {
    name,
  };

  // Get model evaluation request
  const [response] = await modelServiceClient.getModelEvaluation(request);

  console.log('Get model evaluation text sentiment analysis response :');
  console.log(`\tName : ${response.name}`);
  console.log(`\tMetrics schema uri : ${response.metricsSchemaUri}`);
  console.log(`\tMetrics : ${JSON.stringify(response.metrics)}`);

  const modelExplanation = response.modelExplanation;
  console.log('\tModel explanation');
  if (modelExplanation === null) {
    console.log('\t\t{}');
  } else {
    const meanAttributions = modelExplanation.meanAttributions;
    if (meanAttributions === null) {
      console.log('\t\t\t []');
    } else {
      for (const meanAttribution of meanAttributions) {
        console.log('\t\tMean attribution');
        console.log(
          `\t\t\tBaseline output value : \
            ${meanAttribution.baselineOutputValue}`
        );
        console.log(
          `\t\t\tInstance output value : \
            ${meanAttribution.instanceOutputValue}`
        );
        console.log(
          `\t\t\tFeature attributions : \
            ${JSON.stringify(meanAttribution.featureAttributions)}`
        );
        console.log(`\t\t\tOutput index : ${meanAttribution.outputIndex}`);
        console.log(
          `\t\t\tOutput display name : \
            ${meanAttribution.outputDisplayName}`
        );
        console.log(
          `\t\t\tApproximation error : \
            ${meanAttribution.approximationError}`
        );
      }
    }
  }
}
getModelEvaluationTextSentimentAnalysis();

Python

Informationen zum Installieren und Verwenden der Clientbibliothek für Vertex AI finden Sie unter Vertex AI-Clientbibliotheken. Weitere Informationen finden Sie in der Referenzdokumentation zur Vertex AI Python API.

from google.cloud import aiplatform

def get_model_evaluation_text_sentiment_analysis_sample(
    project: str,
    model_id: str,
    evaluation_id: str,
    location: str = "us-central1",
    api_endpoint: str = "us-central1-aiplatform.googleapis.com",
):
    """
    To obtain evaluation_id run the following commands where LOCATION
    is the region where the model is stored, PROJECT is the project ID,
    and MODEL_ID is the ID of your model.

    model_client = aiplatform.gapic.ModelServiceClient(
        client_options={
            'api_endpoint':'LOCATION-aiplatform.googleapis.com'
            }
        )
    evaluations = model_client.list_model_evaluations(parent='projects/PROJECT/locations/LOCATION/models/MODEL_ID')
    print("evaluations:", evaluations)
    """
    # The AI Platform services require regional API endpoints.
    client_options = {"api_endpoint": api_endpoint}
    # Initialize client that will be used to create and send requests.
    # This client only needs to be created once, and can be reused for multiple requests.
    client = aiplatform.gapic.ModelServiceClient(client_options=client_options)
    name = client.model_evaluation_path(
        project=project, location=location, model=model_id, evaluation=evaluation_id
    )
    response = client.get_model_evaluation(name=name)
    print("response:", response)

Video

Wählen Sie unten den Tab für Ihr Ziel aus:

Aktionserkennung

Vertex AI gibt ein Array von Messwerten zur Videoaktionserkennung zurück. Jedes Element zeigt Bewertungsmesswerte mit unterschiedlichen precisionWindowLength- und confidenceThreshold-Werten an. Wenn Sie die Bewertungsmesswerte bei verschiedenen Fensterlängen und Konfidenzgrenzwerten betrachten, können Sie sehen, wie sie sich auf andere Messwerte wie Precision und Recall auswirken.

Wählen Sie einen Tab für Ihre Sprache oder Umgebung aus:

REST UND BEFEHLSZEILE

Ersetzen Sie diese Werte in den folgenden Anfragedaten:

  • LOCATION: Region, in der Ihr Modell gespeichert ist
  • PROJECT: Ihre Projekt-ID.
  • MODEL_ID: Die ID der Modellressource.
  • PROJECT_NUMBER: Projektnummer für Ihr Projekt.
  • EVALUATION_ID: ID für die Modellbewertung (wird in der Antwort angezeigt)

HTTP-Methode und URL:

GET https://LOCATION-aiplatform.googleapis.com/v1/projects/PROJECT/locations/LOCATION/models/MODEL_ID/evaluations

Senden Sie die Anfrage mithilfe einer der folgenden Optionen:

curl

Führen Sie diesen Befehl aus:

curl -X GET \
-H "Authorization: Bearer $(gcloud auth application-default print-access-token)" \
"https://LOCATION-aiplatform.googleapis.com/v1/projects/PROJECT/locations/LOCATION/models/MODEL_ID/evaluations"

PowerShell

Führen Sie diesen Befehl aus:

$cred = gcloud auth application-default print-access-token
$headers = @{ "Authorization" = "Bearer $cred" }

Invoke-WebRequest `
-Method GET `
-Headers $headers `
-Uri "https://LOCATION-aiplatform.googleapis.com/v1/projects/PROJECT/locations/LOCATION/models/MODEL_ID/evaluations" | Select-Object -Expand Content

Sie sollten in etwa folgende JSON-Antwort erhalten:

Java

Informationen zum Installieren und Verwenden der Clientbibliothek für Vertex AI finden Sie unter Vertex AI-Clientbibliotheken. Weitere Informationen finden Sie in der Referenzdokumentation zur Vertex AI Java API.

import com.google.cloud.aiplatform.v1.ModelEvaluation;
import com.google.cloud.aiplatform.v1.ModelEvaluationName;
import com.google.cloud.aiplatform.v1.ModelServiceClient;
import com.google.cloud.aiplatform.v1.ModelServiceSettings;
import java.io.IOException;

public class GetModelEvaluationVideoActionRecognitionSample {

  public static void main(String[] args) throws IOException {
    // TODO(developer): Replace these variables before running the sample.
    // To obtain evaluationId run the code block below after setting modelServiceSettings.
    //
    // try (ModelServiceClient modelServiceClient = ModelServiceClient.create(modelServiceSettings))
    // {
    //   String location = "us-central1";
    //   ModelName modelFullId = ModelName.of(project, location, modelId);
    //   ListModelEvaluationsRequest modelEvaluationsrequest =
    //   ListModelEvaluationsRequest.newBuilder().setParent(modelFullId.toString()).build();
    //   for (ModelEvaluation modelEvaluation :
    //     modelServiceClient.listModelEvaluations(modelEvaluationsrequest).iterateAll()) {
    //       System.out.format("Model Evaluation Name: %s%n", modelEvaluation.getName());
    //   }
    // }
    String project = "PROJECT";
    String modelId = "MODEL_ID";
    String evaluationId = "EVALUATION_ID";
    getModelEvaluationVideoActionRecognitionSample(project, modelId, evaluationId);
  }

  static void getModelEvaluationVideoActionRecognitionSample(
      String project, String modelId, String evaluationId) throws IOException {
    ModelServiceSettings settings =
        ModelServiceSettings.newBuilder()
            .setEndpoint("us-central1-aiplatform.googleapis.com:443")
            .build();
    String location = "us-central1";

    // Initialize client that will be used to send requests. This client only needs to be created
    // once, and can be reused for multiple requests. After completing all of your requests, call
    // the "close" method on the client to safely clean up any remaining background resources.
    try (ModelServiceClient client = ModelServiceClient.create(settings)) {
      ModelEvaluationName name = ModelEvaluationName.of(project, location, modelId, evaluationId);
      ModelEvaluation response = client.getModelEvaluation(name);
      System.out.format("response: %s\n", response);
    }
  }
}

Python

Informationen zum Installieren und Verwenden der Clientbibliothek für Vertex AI finden Sie unter Vertex AI-Clientbibliotheken. Weitere Informationen finden Sie in der Referenzdokumentation zur Vertex AI Python API.

from google.cloud import aiplatform

def get_model_evaluation_video_action_recognition_sample(
    project: str,
    model_id: str,
    evaluation_id: str,
    location: str = "us-central1",
    api_endpoint: str = "us-central1-aiplatform.googleapis.com",
):
    """
    To obtain evaluation_id run the following commands where LOCATION
    is the region where the model is stored, PROJECT is the project ID,
    and MODEL_ID is the ID of your model.

    model_client = aiplatform.gapic.ModelServiceClient(
        client_options={
            'api_endpoint':'LOCATION-aiplatform.googleapis.com'
            }
        )
    evaluations = model_client.list_model_evaluations(parent='projects/PROJECT/locations/LOCATION/models/MODEL_ID')
    print("evaluations:", evaluations)
    """
    # The AI Platform services require regional API endpoints.
    client_options = {"api_endpoint": api_endpoint}
    # Initialize client that will be used to create and send requests.
    # This client only needs to be created once, and can be reused for multiple requests.
    client = aiplatform.gapic.ModelServiceClient(client_options=client_options)
    name = client.model_evaluation_path(
        project=project, location=location, model=model_id, evaluation=evaluation_id
    )
    response = client.get_model_evaluation(name=name)
    print("response:", response)

Klassifizierung

Vertex AI gibt ein Array von Konfidenzmesswerten zurück. Jedes Element zeigt Bewertungsmesswerte mit einem anderen confidenceThreshold-Wert an (beginnend von 0 bis maximal 1). Durch die Anzeige verschiedener Grenzwerte können Sie feststellen, wie sich der Grenzwert auf andere Messwerte wie Precision und Recall auswirkt.

Wählen Sie einen Tab für Ihre Sprache oder Umgebung aus:

REST UND BEFEHLSZEILE

Ersetzen Sie diese Werte in den folgenden Anfragedaten:

  • LOCATION: Region, in der Ihr Modell gespeichert ist
  • PROJECT: Ihre Projekt-ID.
  • MODEL_ID: Die ID der Modellressource.
  • PROJECT_NUMBER: Projektnummer für Ihr Projekt.
  • EVALUATION_ID: ID für die Modellbewertung (wird in der Antwort angezeigt)

HTTP-Methode und URL:

GET https://LOCATION-aiplatform.googleapis.com/v1/projects/PROJECT/locations/LOCATION/models/MODEL_ID/evaluations

Senden Sie die Anfrage mithilfe einer der folgenden Optionen:

curl

Führen Sie diesen Befehl aus:

curl -X GET \
-H "Authorization: Bearer $(gcloud auth application-default print-access-token)" \
"https://LOCATION-aiplatform.googleapis.com/v1/projects/PROJECT/locations/LOCATION/models/MODEL_ID/evaluations"

PowerShell

Führen Sie diesen Befehl aus:

$cred = gcloud auth application-default print-access-token
$headers = @{ "Authorization" = "Bearer $cred" }

Invoke-WebRequest `
-Method GET `
-Headers $headers `
-Uri "https://LOCATION-aiplatform.googleapis.com/v1/projects/PROJECT/locations/LOCATION/models/MODEL_ID/evaluations" | Select-Object -Expand Content

Sie sollten in etwa folgende JSON-Antwort erhalten:

Java

Informationen zum Installieren und Verwenden der Clientbibliothek für Vertex AI finden Sie unter Vertex AI-Clientbibliotheken. Weitere Informationen finden Sie in der Referenzdokumentation zur Vertex AI Java API.


import com.google.cloud.aiplatform.v1.ModelEvaluation;
import com.google.cloud.aiplatform.v1.ModelEvaluationName;
import com.google.cloud.aiplatform.v1.ModelServiceClient;
import com.google.cloud.aiplatform.v1.ModelServiceSettings;
import java.io.IOException;

public class GetModelEvaluationVideoClassificationSample {

  public static void main(String[] args) throws IOException {
    // TODO(developer): Replace these variables before running the sample.
    // To obtain evaluationId run the code block below after setting modelServiceSettings.
    //
    // try (ModelServiceClient modelServiceClient = ModelServiceClient.create(modelServiceSettings))
    // {
    //   String location = "us-central1";
    //   ModelName modelFullId = ModelName.of(project, location, modelId);
    //   ListModelEvaluationsRequest modelEvaluationsrequest =
    //   ListModelEvaluationsRequest.newBuilder().setParent(modelFullId.toString()).build();
    //   for (ModelEvaluation modelEvaluation :
    //     modelServiceClient.listModelEvaluations(modelEvaluationsrequest).iterateAll()) {
    //       System.out.format("Model Evaluation Name: %s%n", modelEvaluation.getName());
    //   }
    // }
    String project = "YOUR_PROJECT_ID";
    String modelId = "YOUR_MODEL_ID";
    String evaluationId = "YOUR_EVALUATION_ID";
    getModelEvaluationVideoClassification(project, modelId, evaluationId);
  }

  static void getModelEvaluationVideoClassification(
      String project, String modelId, String evaluationId) throws IOException {
    ModelServiceSettings modelServiceSettings =
        ModelServiceSettings.newBuilder()
            .setEndpoint("us-central1-aiplatform.googleapis.com:443")
            .build();

    // Initialize client that will be used to send requests. This client only needs to be created
    // once, and can be reused for multiple requests. After completing all of your requests, call
    // the "close" method on the client to safely clean up any remaining background resources.
    try (ModelServiceClient modelServiceClient = ModelServiceClient.create(modelServiceSettings)) {
      String location = "us-central1";
      ModelEvaluationName modelEvaluationName =
          ModelEvaluationName.of(project, location, modelId, evaluationId);

      ModelEvaluation modelEvaluation = modelServiceClient.getModelEvaluation(modelEvaluationName);

      System.out.println("Get Model Evaluation Video Classification Response");
      System.out.format("Name: %s\n", modelEvaluation.getName());
      System.out.format("Metrics Schema Uri: %s\n", modelEvaluation.getMetricsSchemaUri());
      System.out.format("Metrics: %s\n", modelEvaluation.getMetrics());
      System.out.format("Create Time: %s\n", modelEvaluation.getCreateTime());
      System.out.format("Slice Dimensions: %s\n", modelEvaluation.getSliceDimensionsList());
    }
  }
}

Node.js

Informationen zum Installieren und Verwenden der Clientbibliothek für Vertex AI finden Sie unter Vertex AI-Clientbibliotheken. Weitere Informationen finden Sie in der Referenzdokumentation zur Vertex AI Node.js API.

/**
 * TODO(developer): Uncomment these variables before running the sample
 * (not necessary if passing values as arguments). To obtain evaluationId,
 * instantiate the client and run the following the commands.
 */
// const parentName = `projects/${project}/locations/${location}/models/${modelId}`;
// const evalRequest = {
//   parent: parentName
// };
// const [evalResponse] = await modelServiceClient.listModelEvaluations(evalRequest);
// console.log(evalResponse);

// const modelId = 'YOUR_MODEL_ID';
// const evaluationId = 'YOUR_EVALUATION_ID';
// const project = 'YOUR_PROJECT_ID';
// const location = 'YOUR_PROJECT_LOCATION';

// Imports the Google Cloud Model Service Client library
const {ModelServiceClient} = require('@google-cloud/aiplatform');

// Specifies the location of the api endpoint
const clientOptions = {
  apiEndpoint: 'us-central1-aiplatform.googleapis.com',
};

// Instantiates a client
const modelServiceClient = new ModelServiceClient(clientOptions);

async function getModelEvaluationVideoClassification() {
  // Configure the parent resources
  const name = `projects/${project}/locations/${location}/models/${modelId}/evaluations/${evaluationId}`;
  const request = {
    name,
  };

  // Create get model evaluation request
  const [response] = await modelServiceClient.getModelEvaluation(request);

  console.log('Get model evaluation video classification response');
  console.log(`\tName : ${response.name}`);
  console.log(`\tMetrics schema uri : ${response.metricsSchemaUri}`);
  console.log(`\tMetrics : ${JSON.stringify(response.metrics)}`);
  console.log(`\tCreate time : ${JSON.stringify(response.createTime)}`);
  console.log(`\tSlice dimensions : ${response.sliceDimensions}`);
}
getModelEvaluationVideoClassification();

Python

Informationen zum Installieren und Verwenden der Clientbibliothek für Vertex AI finden Sie unter Vertex AI-Clientbibliotheken. Weitere Informationen finden Sie in der Referenzdokumentation zur Vertex AI Python API.

from google.cloud import aiplatform

def get_model_evaluation_video_classification_sample(
    project: str,
    model_id: str,
    evaluation_id: str,
    location: str = "us-central1",
    api_endpoint: str = "us-central1-aiplatform.googleapis.com",
):
    """
    To obtain evaluation_id run the following commands where LOCATION
    is the region where the model is stored, PROJECT is the project ID,
    and MODEL_ID is the ID of your model.

    model_client = aiplatform.gapic.ModelServiceClient(
        client_options={
            'api_endpoint':'LOCATION-aiplatform.googleapis.com'
            }
        )
    evaluations = model_client.list_model_evaluations(parent='projects/PROJECT/locations/LOCATION/models/MODEL_ID')
    print("evaluations:", evaluations)
    """
    # The AI Platform services require regional API endpoints.
    client_options = {"api_endpoint": api_endpoint}
    # Initialize client that will be used to create and send requests.
    # This client only needs to be created once, and can be reused for multiple requests.
    client = aiplatform.gapic.ModelServiceClient(client_options=client_options)
    name = client.model_evaluation_path(
        project=project, location=location, model=model_id, evaluation=evaluation_id
    )
    response = client.get_model_evaluation(name=name)
    print("response:", response)

Objekt-Tracking

Für den Messwert des Begrenzungsrahmens gibt Vertex AI ein Array von Messwerten mit verschiedenen IoU-Grenzwerten (zwischen 0 und 1) und Konfidenzwerten (zwischen 0 und 1) zurück. Beispielsweise können Sie die Bewertungsmesswerte auf einen IoU-Grenzwert von 0,85 und einen Konfidenzwert von 0,8228 einschränken. Durch die Anzeige dieser verschiedenen Grenzwerte können Sie sehen, wie sich diese auf andere Messwerte wie Precision und Recall auswirken.

Wählen Sie einen Tab für Ihre Sprache oder Umgebung aus:

REST UND BEFEHLSZEILE

Ersetzen Sie diese Werte in den folgenden Anfragedaten:

  • LOCATION: Region, in der Ihr Modell gespeichert ist
  • PROJECT: Ihre Projekt-ID.
  • MODEL_ID: Die ID der Modellressource.
  • PROJECT_NUMBER: Projektnummer für Ihr Projekt.
  • EVALUATION_ID: ID für die Modellbewertung (wird in der Antwort angezeigt)

HTTP-Methode und URL:

GET https://LOCATION-aiplatform.googleapis.com/v1/projects/PROJECT/locations/LOCATION/models/MODEL_ID/evaluations

Senden Sie die Anfrage mithilfe einer der folgenden Optionen:

curl

Führen Sie diesen Befehl aus:

curl -X GET \
-H "Authorization: Bearer $(gcloud auth application-default print-access-token)" \
"https://LOCATION-aiplatform.googleapis.com/v1/projects/PROJECT/locations/LOCATION/models/MODEL_ID/evaluations"

PowerShell

Führen Sie diesen Befehl aus:

$cred = gcloud auth application-default print-access-token
$headers = @{ "Authorization" = "Bearer $cred" }

Invoke-WebRequest `
-Method GET `
-Headers $headers `
-Uri "https://LOCATION-aiplatform.googleapis.com/v1/projects/PROJECT/locations/LOCATION/models/MODEL_ID/evaluations" | Select-Object -Expand Content

Sie sollten in etwa folgende JSON-Antwort erhalten:

Java

Informationen zum Installieren und Verwenden der Clientbibliothek für Vertex AI finden Sie unter Vertex AI-Clientbibliotheken. Weitere Informationen finden Sie in der Referenzdokumentation zur Vertex AI Java API.


import com.google.cloud.aiplatform.v1.ModelEvaluation;
import com.google.cloud.aiplatform.v1.ModelEvaluationName;
import com.google.cloud.aiplatform.v1.ModelServiceClient;
import com.google.cloud.aiplatform.v1.ModelServiceSettings;
import java.io.IOException;

public class GetModelEvaluationVideoObjectTrackingSample {

  public static void main(String[] args) throws IOException {
    // TODO(developer): Replace these variables before running the sample.
    // To obtain evaluationId run the code block below after setting modelServiceSettings.
    //
    // try (ModelServiceClient modelServiceClient = ModelServiceClient.create(modelServiceSettings))
    // {
    //   String location = "us-central1";
    //   ModelName modelFullId = ModelName.of(project, location, modelId);
    //   ListModelEvaluationsRequest modelEvaluationsrequest =
    //   ListModelEvaluationsRequest.newBuilder().setParent(modelFullId.toString()).build();
    //   for (ModelEvaluation modelEvaluation :
    //     modelServiceClient.listModelEvaluations(modelEvaluationsrequest).iterateAll()) {
    //       System.out.format("Model Evaluation Name: %s%n", modelEvaluation.getName());
    //   }
    // }
    String project = "YOUR_PROJECT_ID";
    String modelId = "YOUR_MODEL_ID";
    String evaluationId = "YOUR_EVALUATION_ID";
    getModelEvaluationVideoObjectTracking(project, modelId, evaluationId);
  }

  static void getModelEvaluationVideoObjectTracking(
      String project, String modelId, String evaluationId) throws IOException {
    ModelServiceSettings modelServiceSettings =
        ModelServiceSettings.newBuilder()
            .setEndpoint("us-central1-aiplatform.googleapis.com:443")
            .build();

    // Initialize client that will be used to send requests. This client only needs to be created
    // once, and can be reused for multiple requests. After completing all of your requests, call
    // the "close" method on the client to safely clean up any remaining background resources.
    try (ModelServiceClient modelServiceClient = ModelServiceClient.create(modelServiceSettings)) {
      String location = "us-central1";
      ModelEvaluationName modelEvaluationName =
          ModelEvaluationName.of(project, location, modelId, evaluationId);

      ModelEvaluation modelEvaluation = modelServiceClient.getModelEvaluation(modelEvaluationName);

      System.out.println("Get Model Evaluation Video Object Tracking Response");
      System.out.format("Name: %s\n", modelEvaluation.getName());
      System.out.format("Metrics Schema Uri: %s\n", modelEvaluation.getMetricsSchemaUri());
      System.out.format("Metrics: %s\n", modelEvaluation.getMetrics());
      System.out.format("Create Time: %s\n", modelEvaluation.getCreateTime());
      System.out.format("Slice Dimensions: %s\n", modelEvaluation.getSliceDimensionsList());
    }
  }
}

Node.js

Informationen zum Installieren und Verwenden der Clientbibliothek für Vertex AI finden Sie unter Vertex AI-Clientbibliotheken. Weitere Informationen finden Sie in der Referenzdokumentation zur Vertex AI Node.js API.

/**
 * TODO(developer): Uncomment these variables before running the sample
 * (not necessary if passing values as arguments). To obtain evaluationId,
 * instantiate the client and run the following the commands.
 */
// const parentName = `projects/${project}/locations/${location}/models/${modelId}`;
// const evalRequest = {
//   parent: parentName
// };
// const [evalResponse] = await modelServiceClient.listModelEvaluations(evalRequest);
// console.log(evalResponse);

// const modelId = 'YOUR_MODEL_ID';
// const evaluationId = 'YOUR_EVALUATION_ID';
// const project = 'YOUR_PROJECT_ID';
// const location = 'YOUR_PROJECT_LOCATION';

// Imports the Google Cloud Model Service Client library
const {ModelServiceClient} = require('@google-cloud/aiplatform');

// Specifies the location of the api endpoint
const clientOptions = {
  apiEndpoint: 'us-central1-aiplatform.googleapis.com',
};

// Instantiates a client
const modelServiceClient = new ModelServiceClient(clientOptions);

async function getModelEvaluationVideoObjectTracking() {
  // Configure the parent resources
  const name = `projects/${project}/locations/${location}/models/${modelId}/evaluations/${evaluationId}`;
  const request = {
    name,
  };

  // Create get model evaluation request
  const [response] = await modelServiceClient.getModelEvaluation(request);

  console.log('Get model evaluation video object tracking response');
  console.log(`\tName : ${response.name}`);
  console.log(`\tMetrics schema uri : ${response.metricsSchemaUri}`);
  console.log(`\tMetrics : ${JSON.stringify(response.metrics)}`);
  console.log(`\tCreate time : ${JSON.stringify(response.createTime)}`);
  console.log(`\tSlice dimensions : ${response.sliceDimensions}`);
}
getModelEvaluationVideoObjectTracking();

Python

Informationen zum Installieren und Verwenden der Clientbibliothek für Vertex AI finden Sie unter Vertex AI-Clientbibliotheken. Weitere Informationen finden Sie in der Referenzdokumentation zur Vertex AI Python API.

from google.cloud import aiplatform

def get_model_evaluation_video_object_tracking_sample(
    project: str,
    model_id: str,
    evaluation_id: str,
    location: str = "us-central1",
    api_endpoint: str = "us-central1-aiplatform.googleapis.com",
):
    """
    To obtain evaluation_id run the following commands where LOCATION
    is the region where the model is stored, PROJECT is the project ID,
    and MODEL_ID is the ID of your model.

    model_client = aiplatform.gapic.ModelServiceClient(
        client_options={
            'api_endpoint':'LOCATION-aiplatform.googleapis.com'
            }
        )
    evaluations = model_client.list_model_evaluations(parent='projects/PROJECT/locations/LOCATION/models/MODEL_ID')
    print("evaluations:", evaluations)
    """
    # The AI Platform services require regional API endpoints.
    client_options = {"api_endpoint": api_endpoint}
    # Initialize client that will be used to create and send requests.
    # This client only needs to be created once, and can be reused for multiple requests.
    client = aiplatform.gapic.ModelServiceClient(client_options=client_options)
    name = client.model_evaluation_path(
        project=project, location=location, model=model_id, evaluation=evaluation_id
    )
    response = client.get_model_evaluation(name=name)
    print("response:", response)

Alle Bewertungssegmente auflisten

Die Methode projects.locations.models.evaluations.slices.list listet alle Bewertungssegmente für Ihr Modell auf. Sie müssen die Bewertungs-ID des Modells haben, die Sie beim Aufrufen der zusammengefassten Bewertungsmesswerte erhalten.

Mit Modellbewertungssegmenten können Sie die Leistung des Modells bei einem bestimmten Label ermitteln. Das Feld value gibt an, für welches Label die Messwerte gelten.

Bild

Wählen Sie unten den Tab für Ihr Ziel aus:

Klassifizierung

Vertex AI gibt ein Array von Konfidenzmesswerten zurück. Jedes Element zeigt Bewertungsmesswerte mit einem anderen confidenceThreshold-Wert an (beginnend von 0 bis maximal 1). Durch die Anzeige verschiedener Grenzwerte können Sie feststellen, wie sich der Grenzwert auf andere Messwerte wie Precision und Recall auswirkt.

REST UND BEFEHLSZEILE

Ersetzen Sie diese Werte in den folgenden Anfragedaten:

  • LOCATION: Region, in der sich das Modell befindet. Beispiel: us-central1.
  • PROJECT: Ihre Projekt-ID.
  • MODEL_ID: ID Ihres Modells.
  • EVALUATION_ID: ID der Modellbewertung, die die Bewertungssegmente enthält, die aufgelistet werden sollen.

HTTP-Methode und URL:

GET https://LOCATION-aiplatform.googleapis.com/v1/projects/PROJECT/locations/LOCATION/models/MODEL_ID/evaluations/EVALUATION_ID/slices

Senden Sie die Anfrage mithilfe einer der folgenden Optionen:

curl

Führen Sie diesen Befehl aus:

curl -X GET \
-H "Authorization: Bearer $(gcloud auth application-default print-access-token)" \
"https://LOCATION-aiplatform.googleapis.com/v1/projects/PROJECT/locations/LOCATION/models/MODEL_ID/evaluations/EVALUATION_ID/slices"

PowerShell

Führen Sie diesen Befehl aus:

$cred = gcloud auth application-default print-access-token
$headers = @{ "Authorization" = "Bearer $cred" }

Invoke-WebRequest `
-Method GET `
-Headers $headers `
-Uri "https://LOCATION-aiplatform.googleapis.com/v1/projects/PROJECT/locations/LOCATION/models/MODEL_ID/evaluations/EVALUATION_ID/slices" | Select-Object -Expand Content

Sie sollten in etwa folgende JSON-Antwort erhalten:

Java

Informationen zum Installieren und Verwenden der Clientbibliothek für Vertex AI finden Sie unter Vertex AI-Clientbibliotheken. Weitere Informationen finden Sie in der Referenzdokumentation zur Vertex AI Java API.


import com.google.cloud.aiplatform.v1.ModelEvaluationName;
import com.google.cloud.aiplatform.v1.ModelEvaluationSlice;
import com.google.cloud.aiplatform.v1.ModelEvaluationSlice.Slice;
import com.google.cloud.aiplatform.v1.ModelServiceClient;
import com.google.cloud.aiplatform.v1.ModelServiceSettings;
import java.io.IOException;

public class ListModelEvaluationSliceSample {

  public static void main(String[] args) throws IOException {
    // TODO(developer): Replace these variables before running the sample.
    // To obtain evaluationId run the code block below after setting modelServiceSettings.
    //
    // try (ModelServiceClient modelServiceClient = ModelServiceClient.create(modelServiceSettings))
    // {
    //   String location = "us-central1";
    //   ModelName modelFullId = ModelName.of(project, location, modelId);
    //   ListModelEvaluationsRequest modelEvaluationsrequest =
    //   ListModelEvaluationsRequest.newBuilder().setParent(modelFullId.toString()).build();
    //   for (ModelEvaluation modelEvaluation :
    //     modelServiceClient.listModelEvaluations(modelEvaluationsrequest).iterateAll()) {
    //       System.out.format("Model Evaluation Name: %s%n", modelEvaluation.getName());
    //   }
    // }
    String project = "YOUR_PROJECT_ID";
    String modelId = "YOUR_MODEL_ID";
    String evaluationId = "YOUR_EVALUATION_ID";
    listModelEvaluationSliceSample(project, modelId, evaluationId);
  }

  static void listModelEvaluationSliceSample(String project, String modelId, String evaluationId)
      throws IOException {
    ModelServiceSettings modelServiceSettings =
        ModelServiceSettings.newBuilder()
            .setEndpoint("us-central1-aiplatform.googleapis.com:443")
            .build();

    // Initialize client that will be used to send requests. This client only needs to be created
    // once, and can be reused for multiple requests. After completing all of your requests, call
    // the "close" method on the client to safely clean up any remaining background resources.
    try (ModelServiceClient modelServiceClient = ModelServiceClient.create(modelServiceSettings)) {
      String location = "us-central1";
      ModelEvaluationName modelEvaluationName =
          ModelEvaluationName.of(project, location, modelId, evaluationId);

      for (ModelEvaluationSlice modelEvaluationSlice :
          modelServiceClient.listModelEvaluationSlices(modelEvaluationName).iterateAll()) {
        System.out.format("Model Evaluation Slice Name: %s\n", modelEvaluationSlice.getName());
        System.out.format("Metrics Schema Uri: %s\n", modelEvaluationSlice.getMetricsSchemaUri());
        System.out.format("Metrics: %s\n", modelEvaluationSlice.getMetrics());
        System.out.format("Create Time: %s\n", modelEvaluationSlice.getCreateTime());

        Slice slice = modelEvaluationSlice.getSlice();
        System.out.format("Slice Dimensions: %s\n", slice.getDimension());
        System.out.format("Slice Value: %s\n\n", slice.getValue());
      }
    }
  }
}

Node.js

Informationen zum Installieren und Verwenden der Clientbibliothek für Vertex AI finden Sie unter Vertex AI-Clientbibliotheken. Weitere Informationen finden Sie in der Referenzdokumentation zur Vertex AI Node.js API.

/**
 * TODO(developer): Uncomment these variables before running the sample
 * (not necessary if passing values as arguments). To obtain evaluationId,
 * instantiate the client and run the following the commands.
 */
// const parentName = `projects/${project}/locations/${location}/models/${modelId}`;
// const evalRequest = {
//   parent: parentName
// };
// const [evalResponse] = await modelServiceClient.listModelEvaluations(evalRequest);
// console.log(evalResponse);

// const modelId = 'YOUR_MODEL_ID';
// const evaluationId = 'YOUR_EVALUATION_ID';
// const project = 'YOUR_PROJECT_ID';
// const location = 'YOUR_PROJECT_LOCATION';

// Imports the Google Cloud Model Service Client library
const {ModelServiceClient} = require('@google-cloud/aiplatform');

// Specifies the location of the api endpoint
const clientOptions = {
  apiEndpoint: 'us-central1-aiplatform.googleapis.com',
};

// Instantiates a client
const modelServiceClient = new ModelServiceClient(clientOptions);

async function listModelEvaluationSlices() {
  // Configure the parent resources
  const parent = `projects/${project}/locations/${location}/models/${modelId}/evaluations/${evaluationId}`;
  const request = {
    parent,
  };

  // Get and print out a list of all the evaluation slices for this resource
  const [response] = await modelServiceClient.listModelEvaluationSlices(
    request
  );
  console.log('List model evaluation response', response);
  console.log(response);
}
listModelEvaluationSlices();

Python

Informationen zum Installieren und Verwenden der Clientbibliothek für Vertex AI finden Sie unter Vertex AI-Clientbibliotheken. Weitere Informationen finden Sie in der Referenzdokumentation zur Vertex AI Python API.

from google.cloud import aiplatform

def list_model_evaluation_slices_sample(
    project: str,
    model_id: str,
    evaluation_id: str,
    location: str = "us-central1",
    api_endpoint: str = "us-central1-aiplatform.googleapis.com",
):
    """
    To obtain evaluation_id run the following commands where LOCATION
    is the region where the model is stored, PROJECT is the project ID,
    and MODEL_ID is the ID of your model.

    model_client = aiplatform.gapic.ModelServiceClient(
        client_options={
            'api_endpoint':'LOCATION-aiplatform.googleapis.com'
            }
        )
    evaluations = model_client.list_model_evaluations(parent='projects/PROJECT/locations/LOCATION/models/MODEL_ID')
    print("evaluations:", evaluations)
    """
    # The AI Platform services require regional API endpoints.
    client_options = {"api_endpoint": api_endpoint}
    # Initialize client that will be used to create and send requests.
    # This client only needs to be created once, and can be reused for multiple requests.
    client = aiplatform.gapic.ModelServiceClient(client_options=client_options)
    parent = client.model_evaluation_path(
        project=project, location=location, model=model_id, evaluation=evaluation_id
    )
    response = client.list_model_evaluation_slices(parent=parent)
    for model_evaluation_slice in response:
        print("model_evaluation_slice:", model_evaluation_slice)

Objekterkennung

Für den Messwert des Begrenzungsrahmens gibt Vertex AI ein Array von Messwerten mit verschiedenen IoU-Grenzwerten (zwischen 0 und 1) und Konfidenzwerten (zwischen 0 und 1) zurück. Beispielsweise können Sie die Bewertungsmesswerte auf einen IoU-Grenzwert von 0,85 und einen Konfidenzwert von 0,8228 einschränken. Durch die Anzeige dieser verschiedenen Grenzwerte können Sie sehen, wie sich diese auf andere Messwerte wie Precision und Recall auswirken.

REST UND BEFEHLSZEILE

Ersetzen Sie diese Werte in den folgenden Anfragedaten:

  • LOCATION: Region, in der sich das Modell befindet. Beispiel: us-central1.
  • PROJECT: Ihre Projekt-ID.
  • MODEL_ID: ID Ihres Modells.
  • EVALUATION_ID: ID der Modellbewertung, die die Bewertungssegmente enthält, die aufgelistet werden sollen.

HTTP-Methode und URL:

GET https://LOCATION-aiplatform.googleapis.com/v1/projects/PROJECT/locations/LOCATION/models/MODEL_ID/evaluations/EVALUATION_ID/slices

Senden Sie die Anfrage mithilfe einer der folgenden Optionen:

curl

Führen Sie diesen Befehl aus:

curl -X GET \
-H "Authorization: Bearer $(gcloud auth application-default print-access-token)" \
"https://LOCATION-aiplatform.googleapis.com/v1/projects/PROJECT/locations/LOCATION/models/MODEL_ID/evaluations/EVALUATION_ID/slices"

PowerShell

Führen Sie diesen Befehl aus:

$cred = gcloud auth application-default print-access-token
$headers = @{ "Authorization" = "Bearer $cred" }

Invoke-WebRequest `
-Method GET `
-Headers $headers `
-Uri "https://LOCATION-aiplatform.googleapis.com/v1/projects/PROJECT/locations/LOCATION/models/MODEL_ID/evaluations/EVALUATION_ID/slices" | Select-Object -Expand Content

Sie sollten in etwa folgende JSON-Antwort erhalten:

Java

Informationen zum Installieren und Verwenden der Clientbibliothek für Vertex AI finden Sie unter Vertex AI-Clientbibliotheken. Weitere Informationen finden Sie in der Referenzdokumentation zur Vertex AI Java API.


import com.google.cloud.aiplatform.v1.ModelEvaluationName;
import com.google.cloud.aiplatform.v1.ModelEvaluationSlice;
import com.google.cloud.aiplatform.v1.ModelEvaluationSlice.Slice;
import com.google.cloud.aiplatform.v1.ModelServiceClient;
import com.google.cloud.aiplatform.v1.ModelServiceSettings;
import java.io.IOException;

public class ListModelEvaluationSliceSample {

  public static void main(String[] args) throws IOException {
    // TODO(developer): Replace these variables before running the sample.
    // To obtain evaluationId run the code block below after setting modelServiceSettings.
    //
    // try (ModelServiceClient modelServiceClient = ModelServiceClient.create(modelServiceSettings))
    // {
    //   String location = "us-central1";
    //   ModelName modelFullId = ModelName.of(project, location, modelId);
    //   ListModelEvaluationsRequest modelEvaluationsrequest =
    //   ListModelEvaluationsRequest.newBuilder().setParent(modelFullId.toString()).build();
    //   for (ModelEvaluation modelEvaluation :
    //     modelServiceClient.listModelEvaluations(modelEvaluationsrequest).iterateAll()) {
    //       System.out.format("Model Evaluation Name: %s%n", modelEvaluation.getName());
    //   }
    // }
    String project = "YOUR_PROJECT_ID";
    String modelId = "YOUR_MODEL_ID";
    String evaluationId = "YOUR_EVALUATION_ID";
    listModelEvaluationSliceSample(project, modelId, evaluationId);
  }

  static void listModelEvaluationSliceSample(String project, String modelId, String evaluationId)
      throws IOException {
    ModelServiceSettings modelServiceSettings =
        ModelServiceSettings.newBuilder()
            .setEndpoint("us-central1-aiplatform.googleapis.com:443")
            .build();

    // Initialize client that will be used to send requests. This client only needs to be created
    // once, and can be reused for multiple requests. After completing all of your requests, call
    // the "close" method on the client to safely clean up any remaining background resources.
    try (ModelServiceClient modelServiceClient = ModelServiceClient.create(modelServiceSettings)) {
      String location = "us-central1";
      ModelEvaluationName modelEvaluationName =
          ModelEvaluationName.of(project, location, modelId, evaluationId);

      for (ModelEvaluationSlice modelEvaluationSlice :
          modelServiceClient.listModelEvaluationSlices(modelEvaluationName).iterateAll()) {
        System.out.format("Model Evaluation Slice Name: %s\n", modelEvaluationSlice.getName());
        System.out.format("Metrics Schema Uri: %s\n", modelEvaluationSlice.getMetricsSchemaUri());
        System.out.format("Metrics: %s\n", modelEvaluationSlice.getMetrics());
        System.out.format("Create Time: %s\n", modelEvaluationSlice.getCreateTime());

        Slice slice = modelEvaluationSlice.getSlice();
        System.out.format("Slice Dimensions: %s\n", slice.getDimension());
        System.out.format("Slice Value: %s\n\n", slice.getValue());
      }
    }
  }
}

Node.js

Informationen zum Installieren und Verwenden der Clientbibliothek für Vertex AI finden Sie unter Vertex AI-Clientbibliotheken. Weitere Informationen finden Sie in der Referenzdokumentation zur Vertex AI Node.js API.

/**
 * TODO(developer): Uncomment these variables before running the sample
 * (not necessary if passing values as arguments). To obtain evaluationId,
 * instantiate the client and run the following the commands.
 */
// const parentName = `projects/${project}/locations/${location}/models/${modelId}`;
// const evalRequest = {
//   parent: parentName
// };
// const [evalResponse] = await modelServiceClient.listModelEvaluations(evalRequest);
// console.log(evalResponse);

// const modelId = 'YOUR_MODEL_ID';
// const evaluationId = 'YOUR_EVALUATION_ID';
// const project = 'YOUR_PROJECT_ID';
// const location = 'YOUR_PROJECT_LOCATION';

// Imports the Google Cloud Model Service Client library
const {ModelServiceClient} = require('@google-cloud/aiplatform');

// Specifies the location of the api endpoint
const clientOptions = {
  apiEndpoint: 'us-central1-aiplatform.googleapis.com',
};

// Instantiates a client
const modelServiceClient = new ModelServiceClient(clientOptions);

async function listModelEvaluationSlices() {
  // Configure the parent resources
  const parent = `projects/${project}/locations/${location}/models/${modelId}/evaluations/${evaluationId}`;
  const request = {
    parent,
  };

  // Get and print out a list of all the evaluation slices for this resource
  const [response] = await modelServiceClient.listModelEvaluationSlices(
    request
  );
  console.log('List model evaluation response', response);
  console.log(response);
}
listModelEvaluationSlices();

Python

Informationen zum Installieren und Verwenden der Clientbibliothek für Vertex AI finden Sie unter Vertex AI-Clientbibliotheken. Weitere Informationen finden Sie in der Referenzdokumentation zur Vertex AI Python API.

from google.cloud import aiplatform

def list_model_evaluation_slices_sample(
    project: str,
    model_id: str,
    evaluation_id: str,
    location: str = "us-central1",
    api_endpoint: str = "us-central1-aiplatform.googleapis.com",
):
    """
    To obtain evaluation_id run the following commands where LOCATION
    is the region where the model is stored, PROJECT is the project ID,
    and MODEL_ID is the ID of your model.

    model_client = aiplatform.gapic.ModelServiceClient(
        client_options={
            'api_endpoint':'LOCATION-aiplatform.googleapis.com'
            }
        )
    evaluations = model_client.list_model_evaluations(parent='projects/PROJECT/locations/LOCATION/models/MODEL_ID')
    print("evaluations:", evaluations)
    """
    # The AI Platform services require regional API endpoints.
    client_options = {"api_endpoint": api_endpoint}
    # Initialize client that will be used to create and send requests.
    # This client only needs to be created once, and can be reused for multiple requests.
    client = aiplatform.gapic.ModelServiceClient(client_options=client_options)
    parent = client.model_evaluation_path(
        project=project, location=location, model=model_id, evaluation=evaluation_id
    )
    response = client.list_model_evaluation_slices(parent=parent)
    for model_evaluation_slice in response:
        print("model_evaluation_slice:", model_evaluation_slice)

Tabellarisch

Wählen Sie unten den Tab für Ihr Ziel aus:

Klassifizierung

Vertex AI gibt ein Array von Konfidenzmesswerten zurück. Jedes Element zeigt Bewertungsmesswerte mit einem anderen confidenceThreshold-Wert an (beginnend von 0 bis maximal 1). Durch die Anzeige verschiedener Grenzwerte können Sie feststellen, wie sich der Grenzwert auf andere Messwerte wie Precision und Recall auswirkt.

REST UND BEFEHLSZEILE

Ersetzen Sie diese Werte in den folgenden Anfragedaten:

  • LOCATION: Region, in der sich das Modell befindet. Beispiel: us-central1.
  • PROJECT: Ihre Projekt-ID.
  • MODEL_ID: ID Ihres Modells.
  • EVALUATION_ID: ID der Modellbewertung, die die Bewertungssegmente enthält, die aufgelistet werden sollen.

HTTP-Methode und URL:

GET https://LOCATION-aiplatform.googleapis.com/v1/projects/PROJECT/locations/LOCATION/models/MODEL_ID/evaluations/EVALUATION_ID/slices

Senden Sie die Anfrage mithilfe einer der folgenden Optionen:

curl

Führen Sie diesen Befehl aus:

curl -X GET \
-H "Authorization: Bearer $(gcloud auth application-default print-access-token)" \
"https://LOCATION-aiplatform.googleapis.com/v1/projects/PROJECT/locations/LOCATION/models/MODEL_ID/evaluations/EVALUATION_ID/slices"

PowerShell

Führen Sie diesen Befehl aus:

$cred = gcloud auth application-default print-access-token
$headers = @{ "Authorization" = "Bearer $cred" }

Invoke-WebRequest `
-Method GET `
-Headers $headers `
-Uri "https://LOCATION-aiplatform.googleapis.com/v1/projects/PROJECT/locations/LOCATION/models/MODEL_ID/evaluations/EVALUATION_ID/slices" | Select-Object -Expand Content

Sie sollten in etwa folgende JSON-Antwort erhalten:

Java

Informationen zum Installieren und Verwenden der Clientbibliothek für Vertex AI finden Sie unter Vertex AI-Clientbibliotheken. Weitere Informationen finden Sie in der Referenzdokumentation zur Vertex AI Java API.


import com.google.cloud.aiplatform.v1.ModelEvaluationName;
import com.google.cloud.aiplatform.v1.ModelEvaluationSlice;
import com.google.cloud.aiplatform.v1.ModelEvaluationSlice.Slice;
import com.google.cloud.aiplatform.v1.ModelServiceClient;
import com.google.cloud.aiplatform.v1.ModelServiceSettings;
import java.io.IOException;

public class ListModelEvaluationSliceSample {

  public static void main(String[] args) throws IOException {
    // TODO(developer): Replace these variables before running the sample.
    // To obtain evaluationId run the code block below after setting modelServiceSettings.
    //
    // try (ModelServiceClient modelServiceClient = ModelServiceClient.create(modelServiceSettings))
    // {
    //   String location = "us-central1";
    //   ModelName modelFullId = ModelName.of(project, location, modelId);
    //   ListModelEvaluationsRequest modelEvaluationsrequest =
    //   ListModelEvaluationsRequest.newBuilder().setParent(modelFullId.toString()).build();
    //   for (ModelEvaluation modelEvaluation :
    //     modelServiceClient.listModelEvaluations(modelEvaluationsrequest).iterateAll()) {
    //       System.out.format("Model Evaluation Name: %s%n", modelEvaluation.getName());
    //   }
    // }
    String project = "YOUR_PROJECT_ID";
    String modelId = "YOUR_MODEL_ID";
    String evaluationId = "YOUR_EVALUATION_ID";
    listModelEvaluationSliceSample(project, modelId, evaluationId);
  }

  static void listModelEvaluationSliceSample(String project, String modelId, String evaluationId)
      throws IOException {
    ModelServiceSettings modelServiceSettings =
        ModelServiceSettings.newBuilder()
            .setEndpoint("us-central1-aiplatform.googleapis.com:443")
            .build();

    // Initialize client that will be used to send requests. This client only needs to be created
    // once, and can be reused for multiple requests. After completing all of your requests, call
    // the "close" method on the client to safely clean up any remaining background resources.
    try (ModelServiceClient modelServiceClient = ModelServiceClient.create(modelServiceSettings)) {
      String location = "us-central1";
      ModelEvaluationName modelEvaluationName =
          ModelEvaluationName.of(project, location, modelId, evaluationId);

      for (ModelEvaluationSlice modelEvaluationSlice :
          modelServiceClient.listModelEvaluationSlices(modelEvaluationName).iterateAll()) {
        System.out.format("Model Evaluation Slice Name: %s\n", modelEvaluationSlice.getName());
        System.out.format("Metrics Schema Uri: %s\n", modelEvaluationSlice.getMetricsSchemaUri());
        System.out.format("Metrics: %s\n", modelEvaluationSlice.getMetrics());
        System.out.format("Create Time: %s\n", modelEvaluationSlice.getCreateTime());

        Slice slice = modelEvaluationSlice.getSlice();
        System.out.format("Slice Dimensions: %s\n", slice.getDimension());
        System.out.format("Slice Value: %s\n\n", slice.getValue());
      }
    }
  }
}

Node.js

Informationen zum Installieren und Verwenden der Clientbibliothek für Vertex AI finden Sie unter Vertex AI-Clientbibliotheken. Weitere Informationen finden Sie in der Referenzdokumentation zur Vertex AI Node.js API.

/**
 * TODO(developer): Uncomment these variables before running the sample
 * (not necessary if passing values as arguments). To obtain evaluationId,
 * instantiate the client and run the following the commands.
 */
// const parentName = `projects/${project}/locations/${location}/models/${modelId}`;
// const evalRequest = {
//   parent: parentName
// };
// const [evalResponse] = await modelServiceClient.listModelEvaluations(evalRequest);
// console.log(evalResponse);

// const modelId = 'YOUR_MODEL_ID';
// const evaluationId = 'YOUR_EVALUATION_ID';
// const project = 'YOUR_PROJECT_ID';
// const location = 'YOUR_PROJECT_LOCATION';

// Imports the Google Cloud Model Service Client library
const {ModelServiceClient} = require('@google-cloud/aiplatform');

// Specifies the location of the api endpoint
const clientOptions = {
  apiEndpoint: 'us-central1-aiplatform.googleapis.com',
};

// Instantiates a client
const modelServiceClient = new ModelServiceClient(clientOptions);

async function listModelEvaluationSlices() {
  // Configure the parent resources
  const parent = `projects/${project}/locations/${location}/models/${modelId}/evaluations/${evaluationId}`;
  const request = {
    parent,
  };

  // Get and print out a list of all the evaluation slices for this resource
  const [response] = await modelServiceClient.listModelEvaluationSlices(
    request
  );
  console.log('List model evaluation response', response);
  console.log(response);
}
listModelEvaluationSlices();

Python

Informationen zum Installieren und Verwenden der Clientbibliothek für Vertex AI finden Sie unter Vertex AI-Clientbibliotheken. Weitere Informationen finden Sie in der Referenzdokumentation zur Vertex AI Python API.

from google.cloud import aiplatform

def list_model_evaluation_slices_sample(
    project: str,
    model_id: str,
    evaluation_id: str,
    location: str = "us-central1",
    api_endpoint: str = "us-central1-aiplatform.googleapis.com",
):
    """
    To obtain evaluation_id run the following commands where LOCATION
    is the region where the model is stored, PROJECT is the project ID,
    and MODEL_ID is the ID of your model.

    model_client = aiplatform.gapic.ModelServiceClient(
        client_options={
            'api_endpoint':'LOCATION-aiplatform.googleapis.com'
            }
        )
    evaluations = model_client.list_model_evaluations(parent='projects/PROJECT/locations/LOCATION/models/MODEL_ID')
    print("evaluations:", evaluations)
    """
    # The AI Platform services require regional API endpoints.
    client_options = {"api_endpoint": api_endpoint}
    # Initialize client that will be used to create and send requests.
    # This client only needs to be created once, and can be reused for multiple requests.
    client = aiplatform.gapic.ModelServiceClient(client_options=client_options)
    parent = client.model_evaluation_path(
        project=project, location=location, model=model_id, evaluation=evaluation_id
    )
    response = client.list_model_evaluation_slices(parent=parent)
    for model_evaluation_slice in response:
        print("model_evaluation_slice:", model_evaluation_slice)

Vorhersage

Tabellarische Prognosemodelle haben keine Bewertungsmesswertsegmente.

Regression

Tabellarische Regressionsmodelle haben keine Bewertungsmesswertsegmente.

Text

Wählen Sie unten den Tab für Ihr Ziel aus:

Klassifizierung

Vertex AI gibt ein Array von Konfidenzmesswerten zurück. Jedes Element zeigt Bewertungsmesswerte mit einem anderen confidenceThreshold-Wert an (beginnend von 0 bis maximal 1). Durch die Anzeige verschiedener Grenzwerte können Sie feststellen, wie sich der Grenzwert auf andere Messwerte wie Precision und Recall auswirkt.

REST UND BEFEHLSZEILE

Ersetzen Sie diese Werte in den folgenden Anfragedaten:

  • LOCATION: Region, in der sich das Modell befindet. Beispiel: us-central1.
  • PROJECT: Ihre Projekt-ID.
  • MODEL_ID: ID Ihres Modells.
  • EVALUATION_ID: ID der Modellbewertung, die die Bewertungssegmente enthält, die aufgelistet werden sollen.

HTTP-Methode und URL:

GET https://LOCATION-aiplatform.googleapis.com/v1/projects/PROJECT/locations/LOCATION/models/MODEL_ID/evaluations/EVALUATION_ID/slices

Senden Sie die Anfrage mithilfe einer der folgenden Optionen:

curl

Führen Sie diesen Befehl aus:

curl -X GET \
-H "Authorization: Bearer $(gcloud auth application-default print-access-token)" \
"https://LOCATION-aiplatform.googleapis.com/v1/projects/PROJECT/locations/LOCATION/models/MODEL_ID/evaluations/EVALUATION_ID/slices"

PowerShell

Führen Sie diesen Befehl aus:

$cred = gcloud auth application-default print-access-token
$headers = @{ "Authorization" = "Bearer $cred" }

Invoke-WebRequest `
-Method GET `
-Headers $headers `
-Uri "https://LOCATION-aiplatform.googleapis.com/v1/projects/PROJECT/locations/LOCATION/models/MODEL_ID/evaluations/EVALUATION_ID/slices" | Select-Object -Expand Content

Sie sollten in etwa folgende JSON-Antwort erhalten:

Java

Informationen zum Installieren und Verwenden der Clientbibliothek für Vertex AI finden Sie unter Vertex AI-Clientbibliotheken. Weitere Informationen finden Sie in der Referenzdokumentation zur Vertex AI Java API.


import com.google.cloud.aiplatform.v1.ModelEvaluationName;
import com.google.cloud.aiplatform.v1.ModelEvaluationSlice;
import com.google.cloud.aiplatform.v1.ModelEvaluationSlice.Slice;
import com.google.cloud.aiplatform.v1.ModelServiceClient;
import com.google.cloud.aiplatform.v1.ModelServiceSettings;
import java.io.IOException;

public class ListModelEvaluationSliceSample {

  public static void main(String[] args) throws IOException {
    // TODO(developer): Replace these variables before running the sample.
    // To obtain evaluationId run the code block below after setting modelServiceSettings.
    //
    // try (ModelServiceClient modelServiceClient = ModelServiceClient.create(modelServiceSettings))
    // {
    //   String location = "us-central1";
    //   ModelName modelFullId = ModelName.of(project, location, modelId);
    //   ListModelEvaluationsRequest modelEvaluationsrequest =
    //   ListModelEvaluationsRequest.newBuilder().setParent(modelFullId.toString()).build();
    //   for (ModelEvaluation modelEvaluation :
    //     modelServiceClient.listModelEvaluations(modelEvaluationsrequest).iterateAll()) {
    //       System.out.format("Model Evaluation Name: %s%n", modelEvaluation.getName());
    //   }
    // }
    String project = "YOUR_PROJECT_ID";
    String modelId = "YOUR_MODEL_ID";
    String evaluationId = "YOUR_EVALUATION_ID";
    listModelEvaluationSliceSample(project, modelId, evaluationId);
  }

  static void listModelEvaluationSliceSample(String project, String modelId, String evaluationId)
      throws IOException {
    ModelServiceSettings modelServiceSettings =
        ModelServiceSettings.newBuilder()
            .setEndpoint("us-central1-aiplatform.googleapis.com:443")
            .build();

    // Initialize client that will be used to send requests. This client only needs to be created
    // once, and can be reused for multiple requests. After completing all of your requests, call
    // the "close" method on the client to safely clean up any remaining background resources.
    try (ModelServiceClient modelServiceClient = ModelServiceClient.create(modelServiceSettings)) {
      String location = "us-central1";
      ModelEvaluationName modelEvaluationName =
          ModelEvaluationName.of(project, location, modelId, evaluationId);

      for (ModelEvaluationSlice modelEvaluationSlice :
          modelServiceClient.listModelEvaluationSlices(modelEvaluationName).iterateAll()) {
        System.out.format("Model Evaluation Slice Name: %s\n", modelEvaluationSlice.getName());
        System.out.format("Metrics Schema Uri: %s\n", modelEvaluationSlice.getMetricsSchemaUri());
        System.out.format("Metrics: %s\n", modelEvaluationSlice.getMetrics());
        System.out.format("Create Time: %s\n", modelEvaluationSlice.getCreateTime());

        Slice slice = modelEvaluationSlice.getSlice();
        System.out.format("Slice Dimensions: %s\n", slice.getDimension());
        System.out.format("Slice Value: %s\n\n", slice.getValue());
      }
    }
  }
}

Node.js

Informationen zum Installieren und Verwenden der Clientbibliothek für Vertex AI finden Sie unter Vertex AI-Clientbibliotheken. Weitere Informationen finden Sie in der Referenzdokumentation zur Vertex AI Node.js API.

/**
 * TODO(developer): Uncomment these variables before running the sample
 * (not necessary if passing values as arguments). To obtain evaluationId,
 * instantiate the client and run the following the commands.
 */
// const parentName = `projects/${project}/locations/${location}/models/${modelId}`;
// const evalRequest = {
//   parent: parentName
// };
// const [evalResponse] = await modelServiceClient.listModelEvaluations(evalRequest);
// console.log(evalResponse);

// const modelId = 'YOUR_MODEL_ID';
// const evaluationId = 'YOUR_EVALUATION_ID';
// const project = 'YOUR_PROJECT_ID';
// const location = 'YOUR_PROJECT_LOCATION';

// Imports the Google Cloud Model Service Client library
const {ModelServiceClient} = require('@google-cloud/aiplatform');

// Specifies the location of the api endpoint
const clientOptions = {
  apiEndpoint: 'us-central1-aiplatform.googleapis.com',
};

// Instantiates a client
const modelServiceClient = new ModelServiceClient(clientOptions);

async function listModelEvaluationSlices() {
  // Configure the parent resources
  const parent = `projects/${project}/locations/${location}/models/${modelId}/evaluations/${evaluationId}`;
  const request = {
    parent,
  };

  // Get and print out a list of all the evaluation slices for this resource
  const [response] = await modelServiceClient.listModelEvaluationSlices(
    request
  );
  console.log('List model evaluation response', response);
  console.log(response);
}
listModelEvaluationSlices();

Python

Informationen zum Installieren und Verwenden der Clientbibliothek für Vertex AI finden Sie unter Vertex AI-Clientbibliotheken. Weitere Informationen finden Sie in der Referenzdokumentation zur Vertex AI Python API.

from google.cloud import aiplatform

def list_model_evaluation_slices_sample(
    project: str,
    model_id: str,
    evaluation_id: str,
    location: str = "us-central1",
    api_endpoint: str = "us-central1-aiplatform.googleapis.com",
):
    """
    To obtain evaluation_id run the following commands where LOCATION
    is the region where the model is stored, PROJECT is the project ID,
    and MODEL_ID is the ID of your model.

    model_client = aiplatform.gapic.ModelServiceClient(
        client_options={
            'api_endpoint':'LOCATION-aiplatform.googleapis.com'
            }
        )
    evaluations = model_client.list_model_evaluations(parent='projects/PROJECT/locations/LOCATION/models/MODEL_ID')
    print("evaluations:", evaluations)
    """
    # The AI Platform services require regional API endpoints.
    client_options = {"api_endpoint": api_endpoint}
    # Initialize client that will be used to create and send requests.
    # This client only needs to be created once, and can be reused for multiple requests.
    client = aiplatform.gapic.ModelServiceClient(client_options=client_options)
    parent = client.model_evaluation_path(
        project=project, location=location, model=model_id, evaluation=evaluation_id
    )
    response = client.list_model_evaluation_slices(parent=parent)
    for model_evaluation_slice in response:
        print("model_evaluation_slice:", model_evaluation_slice)

Entitätsextraktion

Vertex AI gibt ein Array von Konfidenzmesswerten zurück. Jedes Element zeigt Bewertungsmesswerte mit einem anderen confidenceThreshold-Wert an (beginnend von 0 bis maximal 1). Durch die Anzeige verschiedener Grenzwerte können Sie feststellen, wie sich der Grenzwert auf andere Messwerte wie Precision und Recall auswirkt.

REST UND BEFEHLSZEILE

Ersetzen Sie diese Werte in den folgenden Anfragedaten:

  • LOCATION: Region, in der sich das Modell befindet. Beispiel: us-central1.
  • PROJECT: Ihre Projekt-ID.
  • MODEL_ID: ID Ihres Modells.
  • EVALUATION_ID: ID der Modellbewertung, die die Bewertungssegmente enthält, die aufgelistet werden sollen.

HTTP-Methode und URL:

GET https://LOCATION-aiplatform.googleapis.com/v1/projects/PROJECT/locations/LOCATION/models/MODEL_ID/evaluations/EVALUATION_ID/slices

Senden Sie die Anfrage mithilfe einer der folgenden Optionen:

curl

Führen Sie diesen Befehl aus:

curl -X GET \
-H "Authorization: Bearer $(gcloud auth application-default print-access-token)" \
"https://LOCATION-aiplatform.googleapis.com/v1/projects/PROJECT/locations/LOCATION/models/MODEL_ID/evaluations/EVALUATION_ID/slices"

PowerShell

Führen Sie diesen Befehl aus:

$cred = gcloud auth application-default print-access-token
$headers = @{ "Authorization" = "Bearer $cred" }

Invoke-WebRequest `
-Method GET `
-Headers $headers `
-Uri "https://LOCATION-aiplatform.googleapis.com/v1/projects/PROJECT/locations/LOCATION/models/MODEL_ID/evaluations/EVALUATION_ID/slices" | Select-Object -Expand Content

Sie sollten in etwa folgende JSON-Antwort erhalten:

Java

Informationen zum Installieren und Verwenden der Clientbibliothek für Vertex AI finden Sie unter Vertex AI-Clientbibliotheken. Weitere Informationen finden Sie in der Referenzdokumentation zur Vertex AI Java API.


import com.google.cloud.aiplatform.v1.ModelEvaluationName;
import com.google.cloud.aiplatform.v1.ModelEvaluationSlice;
import com.google.cloud.aiplatform.v1.ModelEvaluationSlice.Slice;
import com.google.cloud.aiplatform.v1.ModelServiceClient;
import com.google.cloud.aiplatform.v1.ModelServiceSettings;
import java.io.IOException;

public class ListModelEvaluationSliceSample {

  public static void main(String[] args) throws IOException {
    // TODO(developer): Replace these variables before running the sample.
    // To obtain evaluationId run the code block below after setting modelServiceSettings.
    //
    // try (ModelServiceClient modelServiceClient = ModelServiceClient.create(modelServiceSettings))
    // {
    //   String location = "us-central1";
    //   ModelName modelFullId = ModelName.of(project, location, modelId);
    //   ListModelEvaluationsRequest modelEvaluationsrequest =
    //   ListModelEvaluationsRequest.newBuilder().setParent(modelFullId.toString()).build();
    //   for (ModelEvaluation modelEvaluation :
    //     modelServiceClient.listModelEvaluations(modelEvaluationsrequest).iterateAll()) {
    //       System.out.format("Model Evaluation Name: %s%n", modelEvaluation.getName());
    //   }
    // }
    String project = "YOUR_PROJECT_ID";
    String modelId = "YOUR_MODEL_ID";
    String evaluationId = "YOUR_EVALUATION_ID";
    listModelEvaluationSliceSample(project, modelId, evaluationId);
  }

  static void listModelEvaluationSliceSample(String project, String modelId, String evaluationId)
      throws IOException {
    ModelServiceSettings modelServiceSettings =
        ModelServiceSettings.newBuilder()
            .setEndpoint("us-central1-aiplatform.googleapis.com:443")
            .build();

    // Initialize client that will be used to send requests. This client only needs to be created
    // once, and can be reused for multiple requests. After completing all of your requests, call
    // the "close" method on the client to safely clean up any remaining background resources.
    try (ModelServiceClient modelServiceClient = ModelServiceClient.create(modelServiceSettings)) {
      String location = "us-central1";
      ModelEvaluationName modelEvaluationName =
          ModelEvaluationName.of(project, location, modelId, evaluationId);

      for (ModelEvaluationSlice modelEvaluationSlice :
          modelServiceClient.listModelEvaluationSlices(modelEvaluationName).iterateAll()) {
        System.out.format("Model Evaluation Slice Name: %s\n", modelEvaluationSlice.getName());
        System.out.format("Metrics Schema Uri: %s\n", modelEvaluationSlice.getMetricsSchemaUri());
        System.out.format("Metrics: %s\n", modelEvaluationSlice.getMetrics());
        System.out.format("Create Time: %s\n", modelEvaluationSlice.getCreateTime());

        Slice slice = modelEvaluationSlice.getSlice();
        System.out.format("Slice Dimensions: %s\n", slice.getDimension());
        System.out.format("Slice Value: %s\n\n", slice.getValue());
      }
    }
  }
}

Node.js

Informationen zum Installieren und Verwenden der Clientbibliothek für Vertex AI finden Sie unter Vertex AI-Clientbibliotheken. Weitere Informationen finden Sie in der Referenzdokumentation zur Vertex AI Node.js API.

/**
 * TODO(developer): Uncomment these variables before running the sample
 * (not necessary if passing values as arguments). To obtain evaluationId,
 * instantiate the client and run the following the commands.
 */
// const parentName = `projects/${project}/locations/${location}/models/${modelId}`;
// const evalRequest = {
//   parent: parentName
// };
// const [evalResponse] = await modelServiceClient.listModelEvaluations(evalRequest);
// console.log(evalResponse);

// const modelId = 'YOUR_MODEL_ID';
// const evaluationId = 'YOUR_EVALUATION_ID';
// const project = 'YOUR_PROJECT_ID';
// const location = 'YOUR_PROJECT_LOCATION';

// Imports the Google Cloud Model Service Client library
const {ModelServiceClient} = require('@google-cloud/aiplatform');

// Specifies the location of the api endpoint
const clientOptions = {
  apiEndpoint: 'us-central1-aiplatform.googleapis.com',
};

// Instantiates a client
const modelServiceClient = new ModelServiceClient(clientOptions);

async function listModelEvaluationSlices() {
  // Configure the parent resources
  const parent = `projects/${project}/locations/${location}/models/${modelId}/evaluations/${evaluationId}`;
  const request = {
    parent,
  };

  // Get and print out a list of all the evaluation slices for this resource
  const [response] = await modelServiceClient.listModelEvaluationSlices(
    request
  );
  console.log('List model evaluation response', response);
  console.log(response);
}
listModelEvaluationSlices();

Python

Informationen zum Installieren und Verwenden der Clientbibliothek für Vertex AI finden Sie unter Vertex AI-Clientbibliotheken. Weitere Informationen finden Sie in der Referenzdokumentation zur Vertex AI Python API.

from google.cloud import aiplatform

def list_model_evaluation_slices_sample(
    project: str,
    model_id: str,
    evaluation_id: str,
    location: str = "us-central1",
    api_endpoint: str = "us-central1-aiplatform.googleapis.com",
):
    """
    To obtain evaluation_id run the following commands where LOCATION
    is the region where the model is stored, PROJECT is the project ID,
    and MODEL_ID is the ID of your model.

    model_client = aiplatform.gapic.ModelServiceClient(
        client_options={
            'api_endpoint':'LOCATION-aiplatform.googleapis.com'
            }
        )
    evaluations = model_client.list_model_evaluations(parent='projects/PROJECT/locations/LOCATION/models/MODEL_ID')
    print("evaluations:", evaluations)
    """
    # The AI Platform services require regional API endpoints.
    client_options = {"api_endpoint": api_endpoint}
    # Initialize client that will be used to create and send requests.
    # This client only needs to be created once, and can be reused for multiple requests.
    client = aiplatform.gapic.ModelServiceClient(client_options=client_options)
    parent = client.model_evaluation_path(
        project=project, location=location, model=model_id, evaluation=evaluation_id
    )
    response = client.list_model_evaluation_slices(parent=parent)
    for model_evaluation_slice in response:
        print("model_evaluation_slice:", model_evaluation_slice)

Sentimentanalyse

REST UND BEFEHLSZEILE

Ersetzen Sie diese Werte in den folgenden Anfragedaten:

  • LOCATION: Region, in der sich das Modell befindet. Beispiel: us-central1.
  • PROJECT: Ihre Projekt-ID.
  • MODEL_ID: ID Ihres Modells.
  • EVALUATION_ID: ID der Modellbewertung, die die Bewertungssegmente enthält, die aufgelistet werden sollen.

HTTP-Methode und URL:

GET https://LOCATION-aiplatform.googleapis.com/v1/projects/PROJECT/locations/LOCATION/models/MODEL_ID/evaluations/EVALUATION_ID/slices

Senden Sie die Anfrage mithilfe einer der folgenden Optionen:

curl

Führen Sie diesen Befehl aus:

curl -X GET \
-H "Authorization: Bearer $(gcloud auth application-default print-access-token)" \
"https://LOCATION-aiplatform.googleapis.com/v1/projects/PROJECT/locations/LOCATION/models/MODEL_ID/evaluations/EVALUATION_ID/slices"

PowerShell

Führen Sie diesen Befehl aus:

$cred = gcloud auth application-default print-access-token
$headers = @{ "Authorization" = "Bearer $cred" }

Invoke-WebRequest `
-Method GET `
-Headers $headers `
-Uri "https://LOCATION-aiplatform.googleapis.com/v1/projects/PROJECT/locations/LOCATION/models/MODEL_ID/evaluations/EVALUATION_ID/slices" | Select-Object -Expand Content

Sie sollten in etwa folgende JSON-Antwort erhalten:

Java

Informationen zum Installieren und Verwenden der Clientbibliothek für Vertex AI finden Sie unter Vertex AI-Clientbibliotheken. Weitere Informationen finden Sie in der Referenzdokumentation zur Vertex AI Java API.


import com.google.cloud.aiplatform.v1.ModelEvaluationName;
import com.google.cloud.aiplatform.v1.ModelEvaluationSlice;
import com.google.cloud.aiplatform.v1.ModelEvaluationSlice.Slice;
import com.google.cloud.aiplatform.v1.ModelServiceClient;
import com.google.cloud.aiplatform.v1.ModelServiceSettings;
import java.io.IOException;

public class ListModelEvaluationSliceSample {

  public static void main(String[] args) throws IOException {
    // TODO(developer): Replace these variables before running the sample.
    // To obtain evaluationId run the code block below after setting modelServiceSettings.
    //
    // try (ModelServiceClient modelServiceClient = ModelServiceClient.create(modelServiceSettings))
    // {
    //   String location = "us-central1";
    //   ModelName modelFullId = ModelName.of(project, location, modelId);
    //   ListModelEvaluationsRequest modelEvaluationsrequest =
    //   ListModelEvaluationsRequest.newBuilder().setParent(modelFullId.toString()).build();
    //   for (ModelEvaluation modelEvaluation :
    //     modelServiceClient.listModelEvaluations(modelEvaluationsrequest).iterateAll()) {
    //       System.out.format("Model Evaluation Name: %s%n", modelEvaluation.getName());
    //   }
    // }
    String project = "YOUR_PROJECT_ID";
    String modelId = "YOUR_MODEL_ID";
    String evaluationId = "YOUR_EVALUATION_ID";
    listModelEvaluationSliceSample(project, modelId, evaluationId);
  }

  static void listModelEvaluationSliceSample(String project, String modelId, String evaluationId)
      throws IOException {
    ModelServiceSettings modelServiceSettings =
        ModelServiceSettings.newBuilder()
            .setEndpoint("us-central1-aiplatform.googleapis.com:443")
            .build();

    // Initialize client that will be used to send requests. This client only needs to be created
    // once, and can be reused for multiple requests. After completing all of your requests, call
    // the "close" method on the client to safely clean up any remaining background resources.
    try (ModelServiceClient modelServiceClient = ModelServiceClient.create(modelServiceSettings)) {
      String location = "us-central1";
      ModelEvaluationName modelEvaluationName =
          ModelEvaluationName.of(project, location, modelId, evaluationId);

      for (ModelEvaluationSlice modelEvaluationSlice :
          modelServiceClient.listModelEvaluationSlices(modelEvaluationName).iterateAll()) {
        System.out.format("Model Evaluation Slice Name: %s\n", modelEvaluationSlice.getName());
        System.out.format("Metrics Schema Uri: %s\n", modelEvaluationSlice.getMetricsSchemaUri());
        System.out.format("Metrics: %s\n", modelEvaluationSlice.getMetrics());
        System.out.format("Create Time: %s\n", modelEvaluationSlice.getCreateTime());

        Slice slice = modelEvaluationSlice.getSlice();
        System.out.format("Slice Dimensions: %s\n", slice.getDimension());
        System.out.format("Slice Value: %s\n\n", slice.getValue());
      }
    }
  }
}

Node.js

Informationen zum Installieren und Verwenden der Clientbibliothek für Vertex AI finden Sie unter Vertex AI-Clientbibliotheken. Weitere Informationen finden Sie in der Referenzdokumentation zur Vertex AI Node.js API.

/**
 * TODO(developer): Uncomment these variables before running the sample
 * (not necessary if passing values as arguments). To obtain evaluationId,
 * instantiate the client and run the following the commands.
 */
// const parentName = `projects/${project}/locations/${location}/models/${modelId}`;
// const evalRequest = {
//   parent: parentName
// };
// const [evalResponse] = await modelServiceClient.listModelEvaluations(evalRequest);
// console.log(evalResponse);

// const modelId = 'YOUR_MODEL_ID';
// const evaluationId = 'YOUR_EVALUATION_ID';
// const project = 'YOUR_PROJECT_ID';
// const location = 'YOUR_PROJECT_LOCATION';

// Imports the Google Cloud Model Service Client library
const {ModelServiceClient} = require('@google-cloud/aiplatform');

// Specifies the location of the api endpoint
const clientOptions = {
  apiEndpoint: 'us-central1-aiplatform.googleapis.com',
};

// Instantiates a client
const modelServiceClient = new ModelServiceClient(clientOptions);

async function listModelEvaluationSlices() {
  // Configure the parent resources
  const parent = `projects/${project}/locations/${location}/models/${modelId}/evaluations/${evaluationId}`;
  const request = {
    parent,
  };

  // Get and print out a list of all the evaluation slices for this resource
  const [response] = await modelServiceClient.listModelEvaluationSlices(
    request
  );
  console.log('List model evaluation response', response);
  console.log(response);
}
listModelEvaluationSlices();

Python

Informationen zum Installieren und Verwenden der Clientbibliothek für Vertex AI finden Sie unter Vertex AI-Clientbibliotheken. Weitere Informationen finden Sie in der Referenzdokumentation zur Vertex AI Python API.

from google.cloud import aiplatform

def list_model_evaluation_slices_sample(
    project: str,
    model_id: str,
    evaluation_id: str,
    location: str = "us-central1",
    api_endpoint: str = "us-central1-aiplatform.googleapis.com",
):
    """
    To obtain evaluation_id run the following commands where LOCATION
    is the region where the model is stored, PROJECT is the project ID,
    and MODEL_ID is the ID of your model.

    model_client = aiplatform.gapic.ModelServiceClient(
        client_options={
            'api_endpoint':'LOCATION-aiplatform.googleapis.com'
            }
        )
    evaluations = model_client.list_model_evaluations(parent='projects/PROJECT/locations/LOCATION/models/MODEL_ID')
    print("evaluations:", evaluations)
    """
    # The AI Platform services require regional API endpoints.
    client_options = {"api_endpoint": api_endpoint}
    # Initialize client that will be used to create and send requests.
    # This client only needs to be created once, and can be reused for multiple requests.
    client = aiplatform.gapic.ModelServiceClient(client_options=client_options)
    parent = client.model_evaluation_path(
        project=project, location=location, model=model_id, evaluation=evaluation_id
    )
    response = client.list_model_evaluation_slices(parent=parent)
    for model_evaluation_slice in response:
        print("model_evaluation_slice:", model_evaluation_slice)

Video

Wählen Sie unten den Tab für Ihr Ziel aus:

Aktionserkennung

Vertex AI gibt ein Array von Messwerten zur Videoaktionserkennung zurück. Jedes Element zeigt Bewertungsmesswerte mit unterschiedlichen precisionWindowLength- und confidenceThreshold-Werten an. Wenn Sie die Bewertungsmesswerte bei verschiedenen Fensterlängen und Konfidenzgrenzwerten betrachten, können Sie sehen, wie sie sich auf andere Messwerte wie Precision und Recall auswirken.

REST UND BEFEHLSZEILE

Ersetzen Sie diese Werte in den folgenden Anfragedaten:

  • LOCATION: Region, in der sich das Modell befindet. Beispiel: us-central1.
  • PROJECT: Ihre Projekt-ID.
  • MODEL_ID: ID Ihres Modells.
  • EVALUATION_ID: ID der Modellbewertung, die die Bewertungssegmente enthält, die aufgelistet werden sollen.

HTTP-Methode und URL:

GET https://LOCATION-aiplatform.googleapis.com/v1/projects/PROJECT/locations/LOCATION/models/MODEL_ID/evaluations/EVALUATION_ID/slices

Senden Sie die Anfrage mithilfe einer der folgenden Optionen:

curl

Führen Sie diesen Befehl aus:

curl -X GET \
-H "Authorization: Bearer $(gcloud auth application-default print-access-token)" \
"https://LOCATION-aiplatform.googleapis.com/v1/projects/PROJECT/locations/LOCATION/models/MODEL_ID/evaluations/EVALUATION_ID/slices"

PowerShell

Führen Sie diesen Befehl aus:

$cred = gcloud auth application-default print-access-token
$headers = @{ "Authorization" = "Bearer $cred" }

Invoke-WebRequest `
-Method GET `
-Headers $headers `
-Uri "https://LOCATION-aiplatform.googleapis.com/v1/projects/PROJECT/locations/LOCATION/models/MODEL_ID/evaluations/EVALUATION_ID/slices" | Select-Object -Expand Content

Sie sollten in etwa folgende JSON-Antwort erhalten:

Java

Informationen zum Installieren und Verwenden der Clientbibliothek für Vertex AI finden Sie unter Vertex AI-Clientbibliotheken. Weitere Informationen finden Sie in der Referenzdokumentation zur Vertex AI Java API.


import com.google.cloud.aiplatform.v1.ModelEvaluationName;
import com.google.cloud.aiplatform.v1.ModelEvaluationSlice;
import com.google.cloud.aiplatform.v1.ModelEvaluationSlice.Slice;
import com.google.cloud.aiplatform.v1.ModelServiceClient;
import com.google.cloud.aiplatform.v1.ModelServiceSettings;
import java.io.IOException;

public class ListModelEvaluationSliceSample {

  public static void main(String[] args) throws IOException {
    // TODO(developer): Replace these variables before running the sample.
    // To obtain evaluationId run the code block below after setting modelServiceSettings.
    //
    // try (ModelServiceClient modelServiceClient = ModelServiceClient.create(modelServiceSettings))
    // {
    //   String location = "us-central1";
    //   ModelName modelFullId = ModelName.of(project, location, modelId);
    //   ListModelEvaluationsRequest modelEvaluationsrequest =
    //   ListModelEvaluationsRequest.newBuilder().setParent(modelFullId.toString()).build();
    //   for (ModelEvaluation modelEvaluation :
    //     modelServiceClient.listModelEvaluations(modelEvaluationsrequest).iterateAll()) {
    //       System.out.format("Model Evaluation Name: %s%n", modelEvaluation.getName());
    //   }
    // }
    String project = "YOUR_PROJECT_ID";
    String modelId = "YOUR_MODEL_ID";
    String evaluationId = "YOUR_EVALUATION_ID";
    listModelEvaluationSliceSample(project, modelId, evaluationId);
  }

  static void listModelEvaluationSliceSample(String project, String modelId, String evaluationId)
      throws IOException {
    ModelServiceSettings modelServiceSettings =
        ModelServiceSettings.newBuilder()
            .setEndpoint("us-central1-aiplatform.googleapis.com:443")
            .build();

    // Initialize client that will be used to send requests. This client only needs to be created
    // once, and can be reused for multiple requests. After completing all of your requests, call
    // the "close" method on the client to safely clean up any remaining background resources.
    try (ModelServiceClient modelServiceClient = ModelServiceClient.create(modelServiceSettings)) {
      String location = "us-central1";
      ModelEvaluationName modelEvaluationName =
          ModelEvaluationName.of(project, location, modelId, evaluationId);

      for (ModelEvaluationSlice modelEvaluationSlice :
          modelServiceClient.listModelEvaluationSlices(modelEvaluationName).iterateAll()) {
        System.out.format("Model Evaluation Slice Name: %s\n", modelEvaluationSlice.getName());
        System.out.format("Metrics Schema Uri: %s\n", modelEvaluationSlice.getMetricsSchemaUri());
        System.out.format("Metrics: %s\n", modelEvaluationSlice.getMetrics());
        System.out.format("Create Time: %s\n", modelEvaluationSlice.getCreateTime());

        Slice slice = modelEvaluationSlice.getSlice();
        System.out.format("Slice Dimensions: %s\n", slice.getDimension());
        System.out.format("Slice Value: %s\n\n", slice.getValue());
      }
    }
  }
}

Node.js

Informationen zum Installieren und Verwenden der Clientbibliothek für Vertex AI finden Sie unter Vertex AI-Clientbibliotheken. Weitere Informationen finden Sie in der Referenzdokumentation zur Vertex AI Node.js API.

/**
 * TODO(developer): Uncomment these variables before running the sample
 * (not necessary if passing values as arguments). To obtain evaluationId,
 * instantiate the client and run the following the commands.
 */
// const parentName = `projects/${project}/locations/${location}/models/${modelId}`;
// const evalRequest = {
//   parent: parentName
// };
// const [evalResponse] = await modelServiceClient.listModelEvaluations(evalRequest);
// console.log(evalResponse);

// const modelId = 'YOUR_MODEL_ID';
// const evaluationId = 'YOUR_EVALUATION_ID';
// const project = 'YOUR_PROJECT_ID';
// const location = 'YOUR_PROJECT_LOCATION';

// Imports the Google Cloud Model Service Client library
const {ModelServiceClient} = require('@google-cloud/aiplatform');

// Specifies the location of the api endpoint
const clientOptions = {
  apiEndpoint: 'us-central1-aiplatform.googleapis.com',
};

// Instantiates a client
const modelServiceClient = new ModelServiceClient(clientOptions);

async function listModelEvaluationSlices() {
  // Configure the parent resources
  const parent = `projects/${project}/locations/${location}/models/${modelId}/evaluations/${evaluationId}`;
  const request = {
    parent,
  };

  // Get and print out a list of all the evaluation slices for this resource
  const [response] = await modelServiceClient.listModelEvaluationSlices(
    request
  );
  console.log('List model evaluation response', response);
  console.log(response);
}
listModelEvaluationSlices();

Python

Informationen zum Installieren und Verwenden der Clientbibliothek für Vertex AI finden Sie unter Vertex AI-Clientbibliotheken. Weitere Informationen finden Sie in der Referenzdokumentation zur Vertex AI Python API.

from google.cloud import aiplatform

def list_model_evaluation_slices_sample(
    project: str,
    model_id: str,
    evaluation_id: str,
    location: str = "us-central1",
    api_endpoint: str = "us-central1-aiplatform.googleapis.com",
):
    """
    To obtain evaluation_id run the following commands where LOCATION
    is the region where the model is stored, PROJECT is the project ID,
    and MODEL_ID is the ID of your model.

    model_client = aiplatform.gapic.ModelServiceClient(
        client_options={
            'api_endpoint':'LOCATION-aiplatform.googleapis.com'
            }
        )
    evaluations = model_client.list_model_evaluations(parent='projects/PROJECT/locations/LOCATION/models/MODEL_ID')
    print("evaluations:", evaluations)
    """
    # The AI Platform services require regional API endpoints.
    client_options = {"api_endpoint": api_endpoint}
    # Initialize client that will be used to create and send requests.
    # This client only needs to be created once, and can be reused for multiple requests.
    client = aiplatform.gapic.ModelServiceClient(client_options=client_options)
    parent = client.model_evaluation_path(
        project=project, location=location, model=model_id, evaluation=evaluation_id
    )
    response = client.list_model_evaluation_slices(parent=parent)
    for model_evaluation_slice in response:
        print("model_evaluation_slice:", model_evaluation_slice)

Klassifizierung

Vertex AI gibt ein Array von Konfidenzmesswerten zurück. Jedes Element zeigt Bewertungsmesswerte mit einem anderen confidenceThreshold-Wert an (beginnend von 0 bis maximal 1). Durch die Anzeige verschiedener Grenzwerte können Sie feststellen, wie sich der Grenzwert auf andere Messwerte wie Precision und Recall auswirkt.

REST UND BEFEHLSZEILE

Ersetzen Sie diese Werte in den folgenden Anfragedaten:

  • LOCATION: Region, in der sich das Modell befindet. Beispiel: us-central1.
  • PROJECT: Ihre Projekt-ID.
  • MODEL_ID: ID Ihres Modells.
  • EVALUATION_ID: ID der Modellbewertung, die die Bewertungssegmente enthält, die aufgelistet werden sollen.

HTTP-Methode und URL:

GET https://LOCATION-aiplatform.googleapis.com/v1/projects/PROJECT/locations/LOCATION/models/MODEL_ID/evaluations/EVALUATION_ID/slices

Senden Sie die Anfrage mithilfe einer der folgenden Optionen:

curl

Führen Sie diesen Befehl aus:

curl -X GET \
-H "Authorization: Bearer $(gcloud auth application-default print-access-token)" \
"https://LOCATION-aiplatform.googleapis.com/v1/projects/PROJECT/locations/LOCATION/models/MODEL_ID/evaluations/EVALUATION_ID/slices"

PowerShell

Führen Sie diesen Befehl aus:

$cred = gcloud auth application-default print-access-token
$headers = @{ "Authorization" = "Bearer $cred" }

Invoke-WebRequest `
-Method GET `
-Headers $headers `
-Uri "https://LOCATION-aiplatform.googleapis.com/v1/projects/PROJECT/locations/LOCATION/models/MODEL_ID/evaluations/EVALUATION_ID/slices" | Select-Object -Expand Content

Sie sollten in etwa folgende JSON-Antwort erhalten:

Java

Informationen zum Installieren und Verwenden der Clientbibliothek für Vertex AI finden Sie unter Vertex AI-Clientbibliotheken. Weitere Informationen finden Sie in der Referenzdokumentation zur Vertex AI Java API.


import com.google.cloud.aiplatform.v1.ModelEvaluationName;
import com.google.cloud.aiplatform.v1.ModelEvaluationSlice;
import com.google.cloud.aiplatform.v1.ModelEvaluationSlice.Slice;
import com.google.cloud.aiplatform.v1.ModelServiceClient;
import com.google.cloud.aiplatform.v1.ModelServiceSettings;
import java.io.IOException;

public class ListModelEvaluationSliceSample {

  public static void main(String[] args) throws IOException {
    // TODO(developer): Replace these variables before running the sample.
    // To obtain evaluationId run the code block below after setting modelServiceSettings.
    //
    // try (ModelServiceClient modelServiceClient = ModelServiceClient.create(modelServiceSettings))
    // {
    //   String location = "us-central1";
    //   ModelName modelFullId = ModelName.of(project, location, modelId);
    //   ListModelEvaluationsRequest modelEvaluationsrequest =
    //   ListModelEvaluationsRequest.newBuilder().setParent(modelFullId.toString()).build();
    //   for (ModelEvaluation modelEvaluation :
    //     modelServiceClient.listModelEvaluations(modelEvaluationsrequest).iterateAll()) {
    //       System.out.format("Model Evaluation Name: %s%n", modelEvaluation.getName());
    //   }
    // }
    String project = "YOUR_PROJECT_ID";
    String modelId = "YOUR_MODEL_ID";
    String evaluationId = "YOUR_EVALUATION_ID";
    listModelEvaluationSliceSample(project, modelId, evaluationId);
  }

  static void listModelEvaluationSliceSample(String project, String modelId, String evaluationId)
      throws IOException {
    ModelServiceSettings modelServiceSettings =
        ModelServiceSettings.newBuilder()
            .setEndpoint("us-central1-aiplatform.googleapis.com:443")
            .build();

    // Initialize client that will be used to send requests. This client only needs to be created
    // once, and can be reused for multiple requests. After completing all of your requests, call
    // the "close" method on the client to safely clean up any remaining background resources.
    try (ModelServiceClient modelServiceClient = ModelServiceClient.create(modelServiceSettings)) {
      String location = "us-central1";
      ModelEvaluationName modelEvaluationName =
          ModelEvaluationName.of(project, location, modelId, evaluationId);

      for (ModelEvaluationSlice modelEvaluationSlice :
          modelServiceClient.listModelEvaluationSlices(modelEvaluationName).iterateAll()) {
        System.out.format("Model Evaluation Slice Name: %s\n", modelEvaluationSlice.getName());
        System.out.format("Metrics Schema Uri: %s\n", modelEvaluationSlice.getMetricsSchemaUri());
        System.out.format("Metrics: %s\n", modelEvaluationSlice.getMetrics());
        System.out.format("Create Time: %s\n", modelEvaluationSlice.getCreateTime());

        Slice slice = modelEvaluationSlice.getSlice();
        System.out.format("Slice Dimensions: %s\n", slice.getDimension());
        System.out.format("Slice Value: %s\n\n", slice.getValue());
      }
    }
  }
}

Node.js

Informationen zum Installieren und Verwenden der Clientbibliothek für Vertex AI finden Sie unter Vertex AI-Clientbibliotheken. Weitere Informationen finden Sie in der Referenzdokumentation zur Vertex AI Node.js API.

/**
 * TODO(developer): Uncomment these variables before running the sample
 * (not necessary if passing values as arguments). To obtain evaluationId,
 * instantiate the client and run the following the commands.
 */
// const parentName = `projects/${project}/locations/${location}/models/${modelId}`;
// const evalRequest = {
//   parent: parentName
// };
// const [evalResponse] = await modelServiceClient.listModelEvaluations(evalRequest);
// console.log(evalResponse);

// const modelId = 'YOUR_MODEL_ID';
// const evaluationId = 'YOUR_EVALUATION_ID';
// const project = 'YOUR_PROJECT_ID';
// const location = 'YOUR_PROJECT_LOCATION';

// Imports the Google Cloud Model Service Client library
const {ModelServiceClient} = require('@google-cloud/aiplatform');

// Specifies the location of the api endpoint
const clientOptions = {
  apiEndpoint: 'us-central1-aiplatform.googleapis.com',
};

// Instantiates a client
const modelServiceClient = new ModelServiceClient(clientOptions);

async function listModelEvaluationSlices() {
  // Configure the parent resources
  const parent = `projects/${project}/locations/${location}/models/${modelId}/evaluations/${evaluationId}`;
  const request = {
    parent,
  };

  // Get and print out a list of all the evaluation slices for this resource
  const [response] = await modelServiceClient.listModelEvaluationSlices(
    request
  );
  console.log('List model evaluation response', response);
  console.log(response);
}
listModelEvaluationSlices();

Python

Informationen zum Installieren und Verwenden der Clientbibliothek für Vertex AI finden Sie unter Vertex AI-Clientbibliotheken. Weitere Informationen finden Sie in der Referenzdokumentation zur Vertex AI Python API.

from google.cloud import aiplatform

def list_model_evaluation_slices_sample(
    project: str,
    model_id: str,
    evaluation_id: str,
    location: str = "us-central1",
    api_endpoint: str = "us-central1-aiplatform.googleapis.com",
):
    """
    To obtain evaluation_id run the following commands where LOCATION
    is the region where the model is stored, PROJECT is the project ID,
    and MODEL_ID is the ID of your model.

    model_client = aiplatform.gapic.ModelServiceClient(
        client_options={
            'api_endpoint':'LOCATION-aiplatform.googleapis.com'
            }
        )
    evaluations = model_client.list_model_evaluations(parent='projects/PROJECT/locations/LOCATION/models/MODEL_ID')
    print("evaluations:", evaluations)
    """
    # The AI Platform services require regional API endpoints.
    client_options = {"api_endpoint": api_endpoint}
    # Initialize client that will be used to create and send requests.
    # This client only needs to be created once, and can be reused for multiple requests.
    client = aiplatform.gapic.ModelServiceClient(client_options=client_options)
    parent = client.model_evaluation_path(
        project=project, location=location, model=model_id, evaluation=evaluation_id
    )
    response = client.list_model_evaluation_slices(parent=parent)
    for model_evaluation_slice in response:
        print("model_evaluation_slice:", model_evaluation_slice)

Objekt-Tracking

Für den Messwert des Begrenzungsrahmens gibt Vertex AI ein Array von Messwerten mit verschiedenen IoU-Grenzwerten (zwischen 0 und 1) und Konfidenzwerten (zwischen 0 und 1) zurück. Beispielsweise können Sie die Bewertungsmesswerte auf einen IoU-Grenzwert von 0,85 und einen Konfidenzwert von 0,8228 einschränken. Durch die Anzeige dieser verschiedenen Grenzwerte können Sie sehen, wie sich diese auf andere Messwerte wie Precision und Recall auswirken.

REST UND BEFEHLSZEILE

Ersetzen Sie diese Werte in den folgenden Anfragedaten:

  • LOCATION: Region, in der sich das Modell befindet. Beispiel: us-central1.
  • PROJECT: Ihre Projekt-ID.
  • MODEL_ID: ID Ihres Modells.
  • EVALUATION_ID: ID der Modellbewertung, die die Bewertungssegmente enthält, die aufgelistet werden sollen.

HTTP-Methode und URL:

GET https://LOCATION-aiplatform.googleapis.com/v1/projects/PROJECT/locations/LOCATION/models/MODEL_ID/evaluations/EVALUATION_ID/slices

Senden Sie die Anfrage mithilfe einer der folgenden Optionen:

curl

Führen Sie diesen Befehl aus:

curl -X GET \
-H "Authorization: Bearer $(gcloud auth application-default print-access-token)" \
"https://LOCATION-aiplatform.googleapis.com/v1/projects/PROJECT/locations/LOCATION/models/MODEL_ID/evaluations/EVALUATION_ID/slices"

PowerShell

Führen Sie diesen Befehl aus:

$cred = gcloud auth application-default print-access-token
$headers = @{ "Authorization" = "Bearer $cred" }

Invoke-WebRequest `
-Method GET `
-Headers $headers `
-Uri "https://LOCATION-aiplatform.googleapis.com/v1/projects/PROJECT/locations/LOCATION/models/MODEL_ID/evaluations/EVALUATION_ID/slices" | Select-Object -Expand Content

Sie sollten in etwa folgende JSON-Antwort erhalten:

Java

Informationen zum Installieren und Verwenden der Clientbibliothek für Vertex AI finden Sie unter Vertex AI-Clientbibliotheken. Weitere Informationen finden Sie in der Referenzdokumentation zur Vertex AI Java API.


import com.google.cloud.aiplatform.v1.ModelEvaluationName;
import com.google.cloud.aiplatform.v1.ModelEvaluationSlice;
import com.google.cloud.aiplatform.v1.ModelEvaluationSlice.Slice;
import com.google.cloud.aiplatform.v1.ModelServiceClient;
import com.google.cloud.aiplatform.v1.ModelServiceSettings;
import java.io.IOException;

public class ListModelEvaluationSliceSample {

  public static void main(String[] args) throws IOException {
    // TODO(developer): Replace these variables before running the sample.
    // To obtain evaluationId run the code block below after setting modelServiceSettings.
    //
    // try (ModelServiceClient modelServiceClient = ModelServiceClient.create(modelServiceSettings))
    // {
    //   String location = "us-central1";
    //   ModelName modelFullId = ModelName.of(project, location, modelId);
    //   ListModelEvaluationsRequest modelEvaluationsrequest =
    //   ListModelEvaluationsRequest.newBuilder().setParent(modelFullId.toString()).build();
    //   for (ModelEvaluation modelEvaluation :
    //     modelServiceClient.listModelEvaluations(modelEvaluationsrequest).iterateAll()) {
    //       System.out.format("Model Evaluation Name: %s%n", modelEvaluation.getName());
    //   }
    // }
    String project = "YOUR_PROJECT_ID";
    String modelId = "YOUR_MODEL_ID";
    String evaluationId = "YOUR_EVALUATION_ID";
    listModelEvaluationSliceSample(project, modelId, evaluationId);
  }

  static void listModelEvaluationSliceSample(String project, String modelId, String evaluationId)
      throws IOException {
    ModelServiceSettings modelServiceSettings =
        ModelServiceSettings.newBuilder()
            .setEndpoint("us-central1-aiplatform.googleapis.com:443")
            .build();

    // Initialize client that will be used to send requests. This client only needs to be created
    // once, and can be reused for multiple requests. After completing all of your requests, call
    // the "close" method on the client to safely clean up any remaining background resources.
    try (ModelServiceClient modelServiceClient = ModelServiceClient.create(modelServiceSettings)) {
      String location = "us-central1";
      ModelEvaluationName modelEvaluationName =
          ModelEvaluationName.of(project, location, modelId, evaluationId);

      for (ModelEvaluationSlice modelEvaluationSlice :
          modelServiceClient.listModelEvaluationSlices(modelEvaluationName).iterateAll()) {
        System.out.format("Model Evaluation Slice Name: %s\n", modelEvaluationSlice.getName());
        System.out.format("Metrics Schema Uri: %s\n", modelEvaluationSlice.getMetricsSchemaUri());
        System.out.format("Metrics: %s\n", modelEvaluationSlice.getMetrics());
        System.out.format("Create Time: %s\n", modelEvaluationSlice.getCreateTime());

        Slice slice = modelEvaluationSlice.getSlice();
        System.out.format("Slice Dimensions: %s\n", slice.getDimension());
        System.out.format("Slice Value: %s\n\n", slice.getValue());
      }
    }
  }
}

Node.js

Informationen zum Installieren und Verwenden der Clientbibliothek für Vertex AI finden Sie unter Vertex AI-Clientbibliotheken. Weitere Informationen finden Sie in der Referenzdokumentation zur Vertex AI Node.js API.

/**
 * TODO(developer): Uncomment these variables before running the sample
 * (not necessary if passing values as arguments). To obtain evaluationId,
 * instantiate the client and run the following the commands.
 */
// const parentName = `projects/${project}/locations/${location}/models/${modelId}`;
// const evalRequest = {
//   parent: parentName
// };
// const [evalResponse] = await modelServiceClient.listModelEvaluations(evalRequest);
// console.log(evalResponse);

// const modelId = 'YOUR_MODEL_ID';
// const evaluationId = 'YOUR_EVALUATION_ID';
// const project = 'YOUR_PROJECT_ID';
// const location = 'YOUR_PROJECT_LOCATION';

// Imports the Google Cloud Model Service Client library
const {ModelServiceClient} = require('@google-cloud/aiplatform');

// Specifies the location of the api endpoint
const clientOptions = {
  apiEndpoint: 'us-central1-aiplatform.googleapis.com',
};

// Instantiates a client
const modelServiceClient = new ModelServiceClient(clientOptions);

async function listModelEvaluationSlices() {
  // Configure the parent resources
  const parent = `projects/${project}/locations/${location}/models/${modelId}/evaluations/${evaluationId}`;
  const request = {
    parent,
  };

  // Get and print out a list of all the evaluation slices for this resource
  const [response] = await modelServiceClient.listModelEvaluationSlices(
    request
  );
  console.log('List model evaluation response', response);
  console.log(response);
}
listModelEvaluationSlices();

Python

Informationen zum Installieren und Verwenden der Clientbibliothek für Vertex AI finden Sie unter Vertex AI-Clientbibliotheken. Weitere Informationen finden Sie in der Referenzdokumentation zur Vertex AI Python API.

from google.cloud import aiplatform

def list_model_evaluation_slices_sample(
    project: str,
    model_id: str,
    evaluation_id: str,
    location: str = "us-central1",
    api_endpoint: str = "us-central1-aiplatform.googleapis.com",
):
    """
    To obtain evaluation_id run the following commands where LOCATION
    is the region where the model is stored, PROJECT is the project ID,
    and MODEL_ID is the ID of your model.

    model_client = aiplatform.gapic.ModelServiceClient(
        client_options={
            'api_endpoint':'LOCATION-aiplatform.googleapis.com'
            }
        )
    evaluations = model_client.list_model_evaluations(parent='projects/PROJECT/locations/LOCATION/models/MODEL_ID')
    print("evaluations:", evaluations)
    """
    # The AI Platform services require regional API endpoints.
    client_options = {"api_endpoint": api_endpoint}
    # Initialize client that will be used to create and send requests.
    # This client only needs to be created once, and can be reused for multiple requests.
    client = aiplatform.gapic.ModelServiceClient(client_options=client_options)
    parent = client.model_evaluation_path(
        project=project, location=location, model=model_id, evaluation=evaluation_id
    )
    response = client.list_model_evaluation_slices(parent=parent)
    for model_evaluation_slice in response:
        print("model_evaluation_slice:", model_evaluation_slice)

Messwerte für ein einzelnes Segment abrufen

Verwenden Sie die Methode projects.locations.models.evaluations.slices.get, um Bewertungsmesswerte für ein einzelnes Segment aufzurufen. Sie benötigen die Segment-ID, die Sie erhalten, wenn Sie alle Segmente auflisten. Das folgende Beispiel gilt für alle Datentypen und Ziele.

REST UND BEFEHLSZEILE

Ersetzen Sie diese Werte in den folgenden Anfragedaten:

  • LOCATION: Region, in der sich das Modell befindet. Beispiel: us-central1.
  • PROJECT: Ihre Projekt-ID.
  • MODEL_ID: ID Ihres Modells.
  • EVALUATION_ID: ID der Modellbewertung, die das abzurufende Bewertungssegment enthält.
  • SLICE_ID: ID eines abzurufenden Bewertungssegments.
  • PROJECT_NUMBER: Projektnummer für Ihr Projekt.
  • EVALUATION_METRIC_SCHEMA_FILE_NAME: Der Name einer Schemadatei, die die Bewertungsmesswerte definiert, die zurückgegeben werden sollen, z. B. classification_metrics_1.0.0.

HTTP-Methode und URL:

GET https://LOCATION-aiplatform.googleapis.com/v1/projects/PROJECT/locations/LOCATION/models/MODEL_ID/evaluations/EVALUATION_ID/slices/SLICE_ID

Senden Sie die Anfrage mithilfe einer der folgenden Optionen:

curl

Führen Sie diesen Befehl aus:

curl -X GET \
-H "Authorization: Bearer $(gcloud auth application-default print-access-token)" \
"https://LOCATION-aiplatform.googleapis.com/v1/projects/PROJECT/locations/LOCATION/models/MODEL_ID/evaluations/EVALUATION_ID/slices/SLICE_ID"

PowerShell

Führen Sie diesen Befehl aus:

$cred = gcloud auth application-default print-access-token
$headers = @{ "Authorization" = "Bearer $cred" }

Invoke-WebRequest `
-Method GET `
-Headers $headers `
-Uri "https://LOCATION-aiplatform.googleapis.com/v1/projects/PROJECT/locations/LOCATION/models/MODEL_ID/evaluations/EVALUATION_ID/slices/SLICE_ID" | Select-Object -Expand Content

Sie sollten in etwa folgende JSON-Antwort erhalten:

Java

Informationen zum Installieren und Verwenden der Clientbibliothek für Vertex AI finden Sie unter Vertex AI-Clientbibliotheken. Weitere Informationen finden Sie in der Referenzdokumentation zur Vertex AI Java API.


import com.google.cloud.aiplatform.v1.ModelEvaluationSlice;
import com.google.cloud.aiplatform.v1.ModelEvaluationSlice.Slice;
import com.google.cloud.aiplatform.v1.ModelEvaluationSliceName;
import com.google.cloud.aiplatform.v1.ModelServiceClient;
import com.google.cloud.aiplatform.v1.ModelServiceSettings;
import java.io.IOException;

public class GetModelEvaluationSliceSample {

  public static void main(String[] args) throws IOException {
    // TODO(developer): Replace these variables before running the sample.
    // To obtain evaluationId run the code block below after setting modelServiceSettings.
    //
    // try (ModelServiceClient modelServiceClient = ModelServiceClient.create(modelServiceSettings))
    // {
    //   String location = "us-central1";
    //   ModelName modelFullId = ModelName.of(project, location, modelId);
    //   ListModelEvaluationsRequest modelEvaluationsrequest =
    //   ListModelEvaluationsRequest.newBuilder().setParent(modelFullId.toString()).build();
    //   for (ModelEvaluation modelEvaluation :
    //     modelServiceClient.listModelEvaluations(modelEvaluationsrequest).iterateAll()) {
    //       System.out.format("Model Evaluation Name: %s%n", modelEvaluation.getName());
    //   }
    // }
    String project = "YOUR_PROJECT_ID";
    String modelId = "YOUR_MODEL_ID";
    String evaluationId = "YOUR_EVALUATION_ID";
    String sliceId = "YOUR_SLICE_ID";
    getModelEvaluationSliceSample(project, modelId, evaluationId, sliceId);
  }

  static void getModelEvaluationSliceSample(
      String project, String modelId, String evaluationId, String sliceId) throws IOException {
    ModelServiceSettings modelServiceSettings =
        ModelServiceSettings.newBuilder()
            .setEndpoint("us-central1-aiplatform.googleapis.com:443")
            .build();

    // Initialize client that will be used to send requests. This client only needs to be created
    // once, and can be reused for multiple requests. After completing all of your requests, call
    // the "close" method on the client to safely clean up any remaining background resources.
    try (ModelServiceClient modelServiceClient = ModelServiceClient.create(modelServiceSettings)) {
      String location = "us-central1";
      ModelEvaluationSliceName modelEvaluationSliceName =
          ModelEvaluationSliceName.of(project, location, modelId, evaluationId, sliceId);

      ModelEvaluationSlice modelEvaluationSlice =
          modelServiceClient.getModelEvaluationSlice(modelEvaluationSliceName);

      System.out.println("Get Model Evaluation Slice Response");
      System.out.format("Model Evaluation Slice Name: %s\n", modelEvaluationSlice.getName());
      System.out.format("Metrics Schema Uri: %s\n", modelEvaluationSlice.getMetricsSchemaUri());
      System.out.format("Metrics: %s\n", modelEvaluationSlice.getMetrics());
      System.out.format("Create Time: %s\n", modelEvaluationSlice.getCreateTime());

      Slice slice = modelEvaluationSlice.getSlice();
      System.out.format("Slice Dimensions: %s\n", slice.getDimension());
      System.out.format("Slice Value: %s\n", slice.getValue());
    }
  }
}

Node.js

Informationen zum Installieren und Verwenden der Clientbibliothek für Vertex AI finden Sie unter Vertex AI-Clientbibliotheken. Weitere Informationen finden Sie in der Referenzdokumentation zur Vertex AI Node.js API.

/**
 * TODO(developer): Uncomment these variables before running the sample
 * (not necessary if passing values as arguments). To obtain evaluationId,
 * instantiate the client and run the following the commands.
 */
// const parentName = `projects/${project}/locations/${location}/models/${modelId}`;
// const evalRequest = {
//   parent: parentName
// };
// const [evalResponse] = await modelServiceClient.listModelEvaluations(evalRequest);
// console.log(evalResponse);

// const modelId = 'YOUR_MODEL_ID';
// const evaluationId = 'YOUR_EVALUATION_ID';
// const sliceId = 'YOUR_SLICE_ID';
// const project = 'YOUR_PROJECT_ID';
// const location = 'YOUR_PROJECT_LOCATION';

// Imports the Google Cloud Model Service client library
const {ModelServiceClient} = require('@google-cloud/aiplatform');
// Specifies the location of the api endpoint
const clientOptions = {
  apiEndpoint: 'us-central1-aiplatform.googleapis.com',
};
// Specifies the location of the api endpoint
const modelServiceClient = new ModelServiceClient(clientOptions);

async function getModelEvaluationSlice() {
  // Configure the parent resource
  const name = `projects/${project}/locations/${location}/models/${modelId}/evaluations/${evaluationId}/slices/${sliceId}`;
  const request = {
    name,
  };

  // Get and print out a list of all the endpoints for this resource
  const [response] = await modelServiceClient.getModelEvaluationSlice(
    request
  );

  console.log('Get model evaluation slice');
  console.log(`\tName : ${response.name}`);
  console.log(`\tMetrics_Schema_Uri : ${response.metricsSchemaUri}`);
  console.log(`\tMetrics : ${JSON.stringify(response.metrics)}`);
  console.log(`\tCreate time : ${JSON.stringify(response.createTime)}`);

  console.log('Slice');
  const slice = response.slice;
  console.log(`\tDimension :${slice.dimension}`);
  console.log(`\tValue :${slice.value}`);
}
getModelEvaluationSlice();

Python

Informationen zum Installieren und Verwenden der Clientbibliothek für Vertex AI finden Sie unter Vertex AI-Clientbibliotheken. Weitere Informationen finden Sie in der Referenzdokumentation zur Vertex AI Python API.

from google.cloud import aiplatform

def get_model_evaluation_slice_sample(
    project: str,
    model_id: str,
    evaluation_id: str,
    slice_id: str,
    location: str = "us-central1",
    api_endpoint: str = "us-central1-aiplatform.googleapis.com",
):
    """
    To obtain evaluation_id run the following commands where LOCATION
    is the region where the model is stored, PROJECT is the project ID,
    and MODEL_ID is the ID of your model.

    model_client = aiplatform.gapic.ModelServiceClient(
        client_options={
            'api_endpoint':'LOCATION-aiplatform.googleapis.com'
            }
        )
    evaluations = model_client.list_model_evaluations(parent='projects/PROJECT/locations/LOCATION/models/MODEL_ID')
    print("evaluations:", evaluations)
    """
    # The AI Platform services require regional API endpoints.
    client_options = {"api_endpoint": api_endpoint}
    # Initialize client that will be used to create and send requests.
    # This client only needs to be created once, and can be reused for multiple requests.
    client = aiplatform.gapic.ModelServiceClient(client_options=client_options)
    name = client.model_evaluation_slice_path(
        project=project,
        location=location,
        model=model_id,
        evaluation=evaluation_id,
        slice=slice_id,
    )
    response = client.get_model_evaluation_slice(name=name)
    print("response:", response)

Modell durchlaufen

Modellbewertungsmesswerte bieten einen Ausgangspunkt für das Debugging Ihres Modells, sollte das Modell Ihre Erwartungen nicht erfüllen. Beispielsweise können niedrige Precision- und Recall-Werte darauf hinweisen, dass das Modell zusätzliche Trainingsdaten benötigt oder inkonsistente Labels enthält. Perfekte Precision- und Recall-Werte können darauf hindeuten, dass die Testdaten zu einfach vorherzusagen sind und sich unter Umständen nicht gut verallgemeinern lassen.

Sie können die Trainingsdaten iterieren und ein neues Modell erstellen. Nachdem Sie ein neues Modell erstellt haben, können Sie die Bewertungsmesswerte zwischen dem vorhandenen Modell und dem neuen Modell vergleichen.

Die folgenden Vorschläge können helfen, Modelle zu verbessern, die Elemente mit Labels versehen, z. B. Klassifizierungs- oder Erkennungsmodelle:

  • Sie sollten weitere Beispiele oder eine größere Auswahl an Beispielen in die Trainingsdaten aufnehmen. Für ein Bildklassifizierungsmodell könnten Sie z. B. Bilder mit größerem Winkel, mit höherer oder niedrigerer Auflösung oder mit verschiedenen Blickwinkeln einbeziehen. Eine ausführliche Anleitung hierzu finden Sie unter Daten vorbereiten für Ihren spezifischen Datentyp und Ihr Ziel.
  • Sie können Klassen oder Labels entfernen, die nicht viele Beispiele haben. Unzureichende Beispiele verhindern, dass das Modell konsistent und sicher Vorhersagen zu diesen Klassen oder Labels macht.
  • Maschinen können den Namen Ihrer Klassen oder Labels nicht interpretieren und die Nuancen der Objekte nicht verstehen, z. B. „Tür“ und „Tür_mit_Klinke“. Sie müssen Daten bereitstellen, damit Maschinen solche Nuancen erkennen können.
  • Erweitern Sie Ihre Daten mit weiteren Beispielen für echt positive und echt negative Ergebnisse, insbesondere Beispiele, die nahe an einer Entscheidungsgrenze liegen, um die Verwechslungsgefahr bei dem Modell zu verringern.
  • Legen Sie Ihre eigene Datenaufteilung fest (Training, Validierung und Test). Vertex AI weist jeder Gruppe Elemente nach dem Zufallsprinzip zu. Daher können nahezu identische Duplikate in den Trainings- und Validierungs-Datasets zugewiesen werden. Dies kann zu einer Überanpassung und dann zu einer schlechten Leistung des Test-Datasets führen. Weitere Informationen zum Festlegen Ihrer eigenen Datenaufteilung finden Sie unter Datenaufteilungen für AutoML-Modelle.
  • Wenn die Bewertungsmesswerte Ihres Modells eine Wahrheitsmatrix enthalten, können Sie sehen, ob das Modell zwei Labels verwechselt, wo das Modell ein bestimmtes Label deutlich häufiger als das echte Label vorhersagt. Überprüfen Sie Ihre Daten und achten Sie darauf, dass die Beispiele mit dem richtigen Label versehen sind.
  • Wenn die Trainingszeit kurz war (niedrige maximale Anzahl an Knotenstunden), erhalten Sie möglicherweise ein Modell höherer Qualität, indem Sie es für einen längeren Zeitraum trainieren (höhere maximale Anzahl an Knotenstunden).

Tabellarische Daten

Zusätzlich zu den vorherigen Vorschlägen können Sie die folgenden tabellenspezifischen Vorschläge zur Iteration Ihres Modells ausprobieren. Probieren Sie bei Modellen mit schlechter Leistung die folgenden Vorschläge aus:

  • Schließen Sie alle Spalten aus dem Training aus, die nicht vorhersagbar sind, z. B. ID-Spalten.
  • Prüfen Sie die Transformationen und achten Sie darauf, dass für alle Spalten die richtige Transformation festgelegt ist. Weitere Informationen
  • Prüfen Sie, ob die Daten zu viele Fehler enthalten. Wenn beispielsweise Werte in Spalten fehlen, in denen kein Nullwert zugelassen ist, wird die jeweilige Zeile ignoriert oder unterstellt. Weitere Informationen
  • Exportieren und untersuchen Sie das Test-Dataset. Analysieren Sie, wann das Modell falsche Vorhersagen macht, um zu ermitteln, ob mehr Trainingsdaten für ein bestimmtes Ergebnis benötigt werden oder ob Datenlecks aufgetreten sind.
  • Probieren Sie bei Prognosemodellen Folgendes:
    • Vergrößern Sie das Kontextfenster, das bestimmt, wie weit zurück das Modell nach Prognosemustern sucht. Weitere Informationen finden Sie unter Überlegungen zum Festlegen des Kontextfensters und des Prognosehorizonts.
    • Prüfen Sie in den Trainingsoptionen, ob zeitabhängige Spalten, deren Werte zur Zeit der Vorhersage nicht verfügbar oder verfügbar sind, entsprechend gekennzeichnet sind.
    • Fügen Sie den Trainingsdaten weitere Daten mit Beispielen für die Verhaltensweisen hinzu, die Sie modellieren möchten. Sie können beispielsweise ein Modell trainieren, das unterschiedliche Zeitachsen korreliert, z. B. Cannibalization-Effekte, bei denen ein neues Produkt die Nachfrage nach einem vorhandenen Produkt verringert, oder Halo-Effekte, bei denen ein neues Produkt die Nachfrage nach ähnlichen Produkten steigert.

Probieren Sie bei Modellen mit perfekter Leistung die folgenden Vorschläge aus:

  • Prüfen Sie, ob Datenlecks aufgetreten sind. Datenlecks treten auf, wenn die Trainingsdaten ein Merkmal enthalten, das während des Trainings nicht bekannt ist und auf dem Ergebnis basiert. Nehmen wir beispielsweise an, Sie trainieren ein Modell, mit dem ermittelt werden soll, ob ein erstmaliger Nutzer etwas kaufen würde. Wenn Sie einen Wert für Vielkäufer einbeziehen, hat das Modell sehr hohe Bewertungsmesswerte, funktioniert aber schlecht mit echten Daten, da der Wert für Vielkäufer nicht einbezogen werden kann.

    Prüfen Sie das Diagramm Merkmalwichtigkeit auf dem Tab Evaluate (Bewerten) auf Datenlecks. Achten Sie darauf, dass die Spalten mit hoher Wichtigkeit wirklich aussagekräftig sind und nicht zu Datenlecks führen.

  • Bei Klassifizierungs- und Regressionsmodellen sollten Sie, falls das Zeitelement Ihrer Daten wichtig ist, darauf achten, dass Sie eine Zeitspalte oder eine manuelle Aufteilung auf Basis der Zeit verwenden. Andernfalls erhalten Sie möglicherweise verzerrte Bewertungsmesswerte. Weitere Informationen finden Sie unter Zeitspalte auf der Seite zur Vorbereitung tabellarischer Trainingsdaten.

Nächste Schritte