Die vorliegende Übersetzung wurde maschinell erstellt. Im Falle eines Konflikts oder eines Widerspruchs zwischen dieser übersetzten Fassung und der englischen Fassung (einschließlich infolge von Verzögerungen bei der Übersetzung) ist die englische Fassung maßgeblich.
k-NN-Anforderungs- und Antwortformate
Alle integrierten Algorithmen von Amazon SageMaker AI halten sich an das gemeinsame Eingabe-Inferenzformat, das unter Common Data Formats — Inference beschrieben ist. Dieses Thema enthält eine Liste der verfügbaren Ausgabeformate für den SageMaker KI-Algorithmus k-nearest-Neighbor.
EINGABE: CSV-Anforderungsformat
Inhaltstyp: text/csv
1.2,1.3,9.6,20.3
Dieser Parameter akzeptiert eine label_size oder einen Codierungsparameter. Es setzt eine label_size von 0 und eine UTF-8-Codierung voraus.
EINGABE: JSON-Anforderungsformat
Inhaltstyp: application/json
{ "instances": [ {"data": {"features": {"values": [-3, -1, -4, 2]}}}, {"features": [3.0, 0.1, 0.04, 0.002]}] }
EINGABE: JSONLINES-Anforderungsformat
Inhaltstyp: application/jsonlines
{"features": [1.5, 16.0, 14.0, 23.0]} {"data": {"features": {"values": [1.5, 16.0, 14.0, 23.0]}}
EINGABE: RECORDIO-Anforderungsformat
Inhaltstyp: -recordio-protobuf application/x
[ Record = { features = { 'values': { values: [-3, -1, -4, 2] # float32 } }, label = {} }, Record = { features = { 'values': { values: [3.0, 0.1, 0.04, 0.002] # float32 } }, label = {} }, ]
AUSGABE: JSON-Antwortformat
akzeptiere: application/json
{ "predictions": [ {"predicted_label": 0.0}, {"predicted_label": 2.0} ] }
AUSGABE: JSONLINES-Antwortformat
akzeptieren: application/jsonlines
{"predicted_label": 0.0} {"predicted_label": 2.0}
AUSGABE: VERBOSE-JSON-Antwortformat
Im Verbose-Modus stellt die API die Suchergebnisse mit dem Entfernungsvektor aufsteigend sortiert und die entsprechenden Elemente im Bezeichnungsvektor bereit. In diesem Beispiel wird "k" auf 3 festgelegt.
akzeptieren: application/json; verbose=true
{ "predictions": [ { "predicted_label": 0.0, "distances": [3.11792408, 3.89746071, 6.32548437], "labels": [0.0, 1.0, 0.0] }, { "predicted_label": 2.0, "distances": [1.08470316, 3.04917915, 5.25393973], "labels": [2.0, 2.0, 0.0] } ] }
AUSGABE: Antwortformat RECORDIO-PROTOBUF
Inhaltstyp: -recordio-protobuf application/x
[ Record = { features = {}, label = { 'predicted_label': { values: [0.0] # float32 } } }, Record = { features = {}, label = { 'predicted_label': { values: [2.0] # float32 } } } ]
AUSGABE: AUSFÜHRLICHES Antwortformat RECORDIO-PROTOBUF
Im Verbose-Modus stellt die API die Suchergebnisse mit dem Entfernungsvektor aufsteigend sortiert und die entsprechenden Elemente im Bezeichnungsvektor bereit. In diesem Beispiel wird "k" auf 3 festgelegt.
akzeptiere: application/x -recordio-protobuf; verbose=true
[ Record = { features = {}, label = { 'predicted_label': { values: [0.0] # float32 }, 'distances': { values: [3.11792408, 3.89746071, 6.32548437] # float32 }, 'labels': { values: [0.0, 1.0, 0.0] # float32 } } }, Record = { features = {}, label = { 'predicted_label': { values: [0.0] # float32 }, 'distances': { values: [1.08470316, 3.04917915, 5.25393973] # float32 }, 'labels': { values: [2.0, 2.0, 0.0] # float32 } } } ]
BEISPIELAUSGABE für den k-NN-Algorithmus
Für regressor-Aufgaben:
[06/08/2018 20:15:33 INFO 140026520049408] #test_score (algo-1) : ('mse', 0.013333333333333334)
Für classifier-Aufgaben:
[06/08/2018 20:15:46 INFO 140285487171328] #test_score (algo-1) : ('accuracy', 0.98666666666666669)