2022/01/26 - Amazon Fraud Detector - 2 new api methods
Changes Added new APIs for viewing past predictions and obtaining prediction metadata including prediction explanations: ListEventPredictions and GetEventPredictionMetadata
Gets a list of past predictions. The list can be filtered by detector ID, detector version ID, event ID, event type, or by specifying a time period. If filter is not specified, the most recent prediction is returned.
For example, the following filter lists all past predictions for xyz event type - { "eventType":{ "value": "xyz" }” }
This is a paginated API. If you provide a null maxResults , this action will retrieve a maximum of 10 records per page. If you provide a maxResults , the value must be between 50 and 100. To get the next page results, provide the nextToken from the response as part of your request. A null nextToken fetches the records from the beginning.
See also: AWS API Documentation
Request Syntax
client.list_event_predictions( eventId={ 'value': 'string' }, eventType={ 'value': 'string' }, detectorId={ 'value': 'string' }, detectorVersionId={ 'value': 'string' }, predictionTimeRange={ 'startTime': 'string', 'endTime': 'string' }, nextToken='string', maxResults=123 )
dict
The event ID.
value (string) --
A statement containing a resource property and a value to specify filter condition.
dict
The event type associated with the detector.
value (string) --
A statement containing a resource property and a value to specify filter condition.
dict
The detector ID.
value (string) --
A statement containing a resource property and a value to specify filter condition.
dict
The detector version ID.
value (string) --
A statement containing a resource property and a value to specify filter condition.
dict
The time period for when the predictions were generated.
startTime (string) -- [REQUIRED]
The start time of the time period for when the predictions were generated.
endTime (string) -- [REQUIRED]
The end time of the time period for when the predictions were generated.
string
Identifies the next page of results to return. Use the token to make the call again to retrieve the next page. Keep all other arguments unchanged. Each pagination token expires after 24 hours.
integer
The maximum number of predictions to return for the request.
dict
Response Syntax
{ 'eventPredictionSummaries': [ { 'eventId': 'string', 'eventTypeName': 'string', 'eventTimestamp': 'string', 'predictionTimestamp': 'string', 'detectorId': 'string', 'detectorVersionId': 'string' }, ], 'nextToken': 'string' }
Response Structure
(dict) --
eventPredictionSummaries (list) --
The summary of the past predictions.
(dict) --
Information about the summary of an event prediction.
eventId (string) --
The event ID.
eventTypeName (string) --
The event type.
eventTimestamp (string) --
The timestamp of the event.
predictionTimestamp (string) --
The timestamp when the prediction was generated.
detectorId (string) --
The detector ID.
detectorVersionId (string) --
The detector version ID.
nextToken (string) --
Identifies the next page of results to return. Use the token to make the call again to retrieve the next page. Keep all other arguments unchanged. Each pagination token expires after 24 hours.
Gets details of the past fraud predictions for the specified event ID, event type, detector ID, and detector version ID that was generated in the specified time period.
See also: AWS API Documentation
Request Syntax
client.get_event_prediction_metadata( eventId='string', eventTypeName='string', detectorId='string', detectorVersionId='string', predictionTimestamp='string' )
string
[REQUIRED]
The event ID.
string
[REQUIRED]
The event type associated with the detector specified for the prediction.
string
[REQUIRED]
The detector ID.
string
[REQUIRED]
The detector version ID.
string
[REQUIRED]
The timestamp that defines when the prediction was generated.
dict
Response Syntax
{ 'eventId': 'string', 'eventTypeName': 'string', 'entityId': 'string', 'entityType': 'string', 'eventTimestamp': 'string', 'detectorId': 'string', 'detectorVersionId': 'string', 'detectorVersionStatus': 'string', 'eventVariables': [ { 'name': 'string', 'value': 'string', 'source': 'string' }, ], 'rules': [ { 'ruleId': 'string', 'ruleVersion': 'string', 'expression': 'string', 'expressionWithValues': 'string', 'outcomes': [ 'string', ], 'evaluated': True|False, 'matched': True|False }, ], 'ruleExecutionMode': 'ALL_MATCHED'|'FIRST_MATCHED', 'outcomes': [ 'string', ], 'evaluatedModelVersions': [ { 'modelId': 'string', 'modelVersion': 'string', 'modelType': 'string', 'evaluations': [ { 'outputVariableName': 'string', 'evaluationScore': 'string', 'predictionExplanations': { 'variableImpactExplanations': [ { 'eventVariableName': 'string', 'relativeImpact': 'string', 'logOddsImpact': ... }, ] } }, ] }, ], 'evaluatedExternalModels': [ { 'modelEndpoint': 'string', 'useEventVariables': True|False, 'inputVariables': { 'string': 'string' }, 'outputVariables': { 'string': 'string' } }, ], 'predictionTimestamp': 'string' }
Response Structure
(dict) --
eventId (string) --
The event ID.
eventTypeName (string) --
The event type associated with the detector specified for this prediction.
entityId (string) --
The entity ID.
entityType (string) --
The entity type.
eventTimestamp (string) --
The timestamp for when the prediction was generated for the associated event ID.
detectorId (string) --
The detector ID.
detectorVersionId (string) --
The detector version ID.
detectorVersionStatus (string) --
The status of the detector version.
eventVariables (list) --
A list of event variables that influenced the prediction scores.
(dict) --
Information about the summary of an event variable that was evaluated for generating prediction.
name (string) --
The event variable name.
value (string) --
The value of the event variable.
source (string) --
The event variable source.
rules (list) --
List of rules associated with the detector version that were used for evaluating variable values.
(dict) --
The details of the rule used for evaluating variable values.
ruleId (string) --
The rule ID.
ruleVersion (string) --
The rule version.
expression (string) --
The rule expression.
expressionWithValues (string) --
The rule expression value.
outcomes (list) --
The rule outcome.
(string) --
evaluated (boolean) --
Indicates whether the rule was evaluated.
matched (boolean) --
Indicates whether the rule matched.
ruleExecutionMode (string) --
The execution mode of the rule used for evaluating variable values.
outcomes (list) --
The outcomes of the matched rule, based on the rule execution mode.
(string) --
evaluatedModelVersions (list) --
Model versions that were evaluated for generating predictions.
(dict) --
The model version evaluated for generating prediction.
modelId (string) --
The model ID.
modelVersion (string) --
The model version.
modelType (string) --
The model type.
Valid values: ONLINE_FRAUD_INSIGHTS | TRANSACTION_FRAUD_INSIGHTS
evaluations (list) --
Evaluations generated for the model version.
(dict) --
The model version evalutions.
outputVariableName (string) --
The output variable name.
evaluationScore (string) --
The evaluation score generated for the model version.
predictionExplanations (dict) --
The prediction explanations generated for the model version.
variableImpactExplanations (list) --
The details of the event variable's impact on the prediction score.
(dict) --
The details of the event variable's impact on the prediction score.
eventVariableName (string) --
The event variable name.
relativeImpact (string) --
The event variable's relative impact in terms of magnitude on the prediction scores. The relative impact values consist of a numerical rating (0-5, 5 being the highest) and direction (increased/decreased) impact of the fraud risk.
logOddsImpact (float) --
The raw, uninterpreted value represented as log-odds of the fraud. These values are usually between -10 to +10, but range from - infinity to + infinity.
A positive value indicates that the variable drove the risk score up.
A negative value indicates that the variable drove the risk score down.
evaluatedExternalModels (list) --
External (Amazon SageMaker) models that were evaluated for generating predictions.
(dict) --
The details of the external (Amazon Sagemaker) model evaluated for generating predictions.
modelEndpoint (string) --
The endpoint of the external (Amazon Sagemaker) model.
useEventVariables (boolean) --
Indicates whether event variables were used to generate predictions.
inputVariables (dict) --
Input variables use for generating predictions.
(string) --
(string) --
outputVariables (dict) --
Output variables.
(string) --
(string) --
predictionTimestamp (string) --
The timestamp that defines when the prediction was generated.