GetEventPrediction - Amazon Fraud Detector

GetEventPrediction

Evaluates an event against a detector version. If a version ID is not provided, the detector’s (ACTIVE) version is used.

Request Syntax

{ "detectorId": "string", "detectorVersionId": "string", "entities": [ { "entityId": "string", "entityType": "string" } ], "eventId": "string", "eventTimestamp": "string", "eventTypeName": "string", "eventVariables": { "string" : "string" }, "externalModelEndpointDataBlobs": { "string" : { "byteBuffer": blob, "contentType": "string" } } }

Request Parameters

For information about the parameters that are common to all actions, see Common Parameters.

The request accepts the following data in JSON format.

detectorId

The detector ID.

Type: String

Required: Yes

detectorVersionId

The detector version ID.

Type: String

Length Constraints: Minimum length of 1. Maximum length of 5.

Pattern: ^([1-9][0-9]*)$

Required: No

entities

The entity type (associated with the detector's event type) and specific entity ID representing who performed the event. If an entity id is not available, use "UNKNOWN."

Type: Array of Entity objects

Required: Yes

eventId

The unique ID used to identify the event.

Type: String

Required: Yes

eventTimestamp

Timestamp that defines when the event under evaluation occurred.

Type: String

Length Constraints: Minimum length of 10. Maximum length of 30.

Required: Yes

eventTypeName

The event type associated with the detector specified for the prediction.

Type: String

Required: Yes

eventVariables

Names of the event type's variables you defined in Amazon Fraud Detector to represent data elements and their corresponding values for the event you are sending for evaluation.

Important
  • You must provide at least one eventVariable

  • If detectorVersion is associated with a modelVersion, you must provide at least one associated eventVariable

To ensure highest possible fraud prediction and to simplify your data preparation, Amazon Fraud Detector will replace all missing variables or values as follows:

For Amazon Fraud Detector trained models:

If a null value is provided explicitly for a variable or if a variable is missing, model will replace the null value or the missing variable (no variable name in the eventVariables map) with calculated default mean/medians for numeric variables and with special values for categorical variables.

For External models ( for example, imported SageMaker):

If a null value is provided explicitly for a variable, the model and rules will use “null” as the value. If a variable is not provided (no variable name in the eventVariables map), model and rules will use the default value that is provided for the variable.

Type: String to string map

Map Entries: Maximum number of items.

Key Length Constraints: Minimum length of 1. Maximum length of 64.

Value Length Constraints: Minimum length of 1. Maximum length of 1024.

Required: Yes

externalModelEndpointDataBlobs

The Amazon SageMaker model endpoint input data blobs.

Type: String to ModelEndpointDataBlob object map

Required: No

Response Syntax

{ "externalModelOutputs": [ { "externalModel": { "modelEndpoint": "string", "modelSource": "string" }, "outputs": { "string" : "string" } } ], "modelScores": [ { "modelVersion": { "arn": "string", "modelId": "string", "modelType": "string", "modelVersionNumber": "string" }, "scores": { "string" : number } } ], "ruleResults": [ { "outcomes": [ "string" ], "ruleId": "string" } ] }

Response Elements

If the action is successful, the service sends back an HTTP 200 response.

The following data is returned in JSON format by the service.

externalModelOutputs

The model scores for Amazon SageMaker models.

Type: Array of ExternalModelOutputs objects

modelScores

The model scores. Amazon Fraud Detector generates model scores between 0 and 1000, where 0 is low fraud risk and 1000 is high fraud risk. Model scores are directly related to the false positive rate (FPR). For example, a score of 600 corresponds to an estimated 10% false positive rate whereas a score of 900 corresponds to an estimated 2% false positive rate.

Type: Array of ModelScores objects

ruleResults

The results from the rules.

Type: Array of RuleResult objects

Errors

For information about the errors that are common to all actions, see Common Errors.

AccessDeniedException

An exception indicating Amazon Fraud Detector does not have the needed permissions. This can occur if you submit a request, such as PutExternalModel, that specifies a role that is not in your account.

HTTP Status Code: 400

ConflictException

An exception indicating there was a conflict during a delete operation. The following delete operations can cause a conflict exception:

  • DeleteDetector: A conflict exception will occur if the detector has associated Rules or DetectorVersions. You can only delete a detector if it has no Rules or DetectorVersions.

  • DeleteDetectorVersion: A conflict exception will occur if the DetectorVersion status is ACTIVE.

  • DeleteRule: A conflict exception will occur if the RuleVersion is in use by an associated ACTIVE or INACTIVE DetectorVersion.

HTTP Status Code: 400

InternalServerException

An exception indicating an internal server error.

HTTP Status Code: 500

ResourceNotFoundException

An exception indicating the specified resource was not found. This can occur if you submit a request, such as CreateBatchPredictionJob, but the detector name or version does not exist.

HTTP Status Code: 400

ResourceUnavailableException

An exception indicating that the attached customer-owned (external) model threw an exception when Amazon Fraud Detector invoked the model.

HTTP Status Code: 400

ThrottlingException

An exception indicating a throttling error.

HTTP Status Code: 400

ValidationException

An exception indicating a specified value is not allowed.

HTTP Status Code: 400

See Also

For more information about using this API in one of the language-specific AWS SDKs, see the following: