Amazon Fraud Detector

2020/04/17 - Amazon Fraud Detector - 2 new4 updated api methods

Changes  Update frauddetector client to latest version

DeleteDetector (new) Link ¶

Deletes the detector. Before deleting a detector, you must first delete all detector versions and rule versions associated with the detector.

See also: AWS API Documentation

Request Syntax

client.delete_detector(
    detectorId='string'
)
type detectorId:

string

param detectorId:

[REQUIRED]

The ID of the detector to delete.

rtype:

dict

returns:

Response Syntax

{}

Response Structure

  • (dict) --

DeleteRuleVersion (new) Link ¶

Deletes the rule version. You cannot delete a rule version if it is used by an ACTIVE or INACTIVE detector version.

See also: AWS API Documentation

Request Syntax

client.delete_rule_version(
    detectorId='string',
    ruleId='string',
    ruleVersion='string'
)
type detectorId:

string

param detectorId:

[REQUIRED]

The ID of the detector that includes the rule version to delete.

type ruleId:

string

param ruleId:

[REQUIRED]

The rule ID of the rule version to delete.

type ruleVersion:

string

param ruleVersion:

[REQUIRED]

The rule version to delete.

rtype:

dict

returns:

Response Syntax

{}

Response Structure

  • (dict) --

CreateDetectorVersion (updated) Link ¶
Changes (request)
{'ruleExecutionMode': 'ALL_MATCHED | FIRST_MATCHED'}

Creates a detector version. The detector version starts in a DRAFT status.

See also: AWS API Documentation

Request Syntax

client.create_detector_version(
    detectorId='string',
    description='string',
    externalModelEndpoints=[
        'string',
    ],
    rules=[
        {
            'detectorId': 'string',
            'ruleId': 'string',
            'ruleVersion': 'string'
        },
    ],
    modelVersions=[
        {
            'modelId': 'string',
            'modelType': 'ONLINE_FRAUD_INSIGHTS',
            'modelVersionNumber': 'string'
        },
    ],
    ruleExecutionMode='ALL_MATCHED'|'FIRST_MATCHED'
)
type detectorId:

string

param detectorId:

[REQUIRED]

The ID of the detector under which you want to create a new version.

type description:

string

param description:

The description of the detector version.

type externalModelEndpoints:

list

param externalModelEndpoints:

The Amazon Sagemaker model endpoints to include in the detector version.

  • (string) --

type rules:

list

param rules:

[REQUIRED]

The rules to include in the detector version.

  • (dict) --

    A rule.

    • detectorId (string) -- [REQUIRED]

      The detector for which the rule is associated.

    • ruleId (string) -- [REQUIRED]

      The rule ID.

    • ruleVersion (string) -- [REQUIRED]

      The rule version.

type modelVersions:

list

param modelVersions:

The model versions to include in the detector version.

  • (dict) --

    The model version.

    • modelId (string) -- [REQUIRED]

      The parent model ID.

    • modelType (string) -- [REQUIRED]

      The model type.

    • modelVersionNumber (string) -- [REQUIRED]

      The model version.

type ruleExecutionMode:

string

param ruleExecutionMode:

The rule execution mode for the rules included in the detector version.

You can define and edit the rule mode at the detector version level, when it is in draft status.

If you specify FIRST_MATCHED, Amazon Fraud Detector evaluates rules sequentially, first to last, stopping at the first matched rule. Amazon Fraud dectector then provides the outcomes for that single rule.

If you specifiy ALL_MATCHED, Amazon Fraud Detector evaluates all rules and returns the outcomes for all matched rules.

The default behavior is FIRST_MATCHED.

rtype:

dict

returns:

Response Syntax

{
    'detectorId': 'string',
    'detectorVersionId': 'string',
    'status': 'DRAFT'|'ACTIVE'|'INACTIVE'
}

Response Structure

  • (dict) --

    • detectorId (string) --

      The ID for the created version's parent detector.

    • detectorVersionId (string) --

      The ID for the created detector.

    • status (string) --

      The status of the detector version.

GetDetectorVersion (updated) Link ¶
Changes (response)
{'ruleExecutionMode': 'ALL_MATCHED | FIRST_MATCHED'}

Gets a particular detector version.

See also: AWS API Documentation

Request Syntax

client.get_detector_version(
    detectorId='string',
    detectorVersionId='string'
)
type detectorId:

string

param detectorId:

[REQUIRED]

The detector ID.

type detectorVersionId:

string

param detectorVersionId:

[REQUIRED]

The detector version ID.

rtype:

dict

returns:

Response Syntax

{
    'detectorId': 'string',
    'detectorVersionId': 'string',
    'description': 'string',
    'externalModelEndpoints': [
        'string',
    ],
    'modelVersions': [
        {
            'modelId': 'string',
            'modelType': 'ONLINE_FRAUD_INSIGHTS',
            'modelVersionNumber': 'string'
        },
    ],
    'rules': [
        {
            'detectorId': 'string',
            'ruleId': 'string',
            'ruleVersion': 'string'
        },
    ],
    'status': 'DRAFT'|'ACTIVE'|'INACTIVE',
    'lastUpdatedTime': 'string',
    'createdTime': 'string',
    'ruleExecutionMode': 'ALL_MATCHED'|'FIRST_MATCHED'
}

Response Structure

  • (dict) --

    • detectorId (string) --

      The detector ID.

    • detectorVersionId (string) --

      The detector version ID.

    • description (string) --

      The detector version description.

    • externalModelEndpoints (list) --

      The Amazon SageMaker model endpoints included in the detector version.

      • (string) --

    • modelVersions (list) --

      The model versions included in the detector version.

      • (dict) --

        The model version.

        • modelId (string) --

          The parent model ID.

        • modelType (string) --

          The model type.

        • modelVersionNumber (string) --

          The model version.

    • rules (list) --

      The rules included in the detector version.

      • (dict) --

        A rule.

        • detectorId (string) --

          The detector for which the rule is associated.

        • ruleId (string) --

          The rule ID.

        • ruleVersion (string) --

          The rule version.

    • status (string) --

      The status of the detector version.

    • lastUpdatedTime (string) --

      The timestamp when the detector version was last updated.

    • createdTime (string) --

      The timestamp when the detector version was created.

    • ruleExecutionMode (string) --

      The execution mode of the rule in the dectector

      FIRST_MATCHED indicates that Amazon Fraud Detector evaluates rules sequentially, first to last, stopping at the first matched rule. Amazon Fraud dectector then provides the outcomes for that single rule.

      ALL_MATCHED indicates that Amazon Fraud Detector evaluates all rules and returns the outcomes for all matched rules. You can define and edit the rule mode at the detector version level, when it is in draft status.

GetPrediction (updated) Link ¶
Changes (response)
{'ruleResults': [{'outcomes': ['string'], 'ruleId': 'string'}]}

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

See also: AWS API Documentation

Request Syntax

client.get_prediction(
    detectorId='string',
    detectorVersionId='string',
    eventId='string',
    eventAttributes={
        'string': 'string'
    },
    externalModelEndpointDataBlobs={
        'string': {
            'byteBuffer': b'bytes',
            'contentType': 'string'
        }
    }
)
type detectorId:

string

param detectorId:

[REQUIRED]

The detector ID.

type detectorVersionId:

string

param detectorVersionId:

The detector version ID.

type eventId:

string

param eventId:

[REQUIRED]

The unique ID used to identify the event.

type eventAttributes:

dict

param eventAttributes:

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

  • (string) --

    • (string) --

type externalModelEndpointDataBlobs:

dict

param externalModelEndpointDataBlobs:

The Amazon SageMaker model endpoint input data blobs.

  • (string) --

    • (dict) --

      A pre-formed Amazon SageMaker model input you can include if your detector version includes an imported Amazon SageMaker model endpoint with pass-through input configuration.

      • byteBuffer (bytes) --

        The byte buffer of the Amazon SageMaker model endpoint input data blob.

      • contentType (string) --

        The content type of the Amazon SageMaker model endpoint input data blob.

rtype:

dict

returns:

Response Syntax

{
    'outcomes': [
        'string',
    ],
    'modelScores': [
        {
            'modelVersion': {
                'modelId': 'string',
                'modelType': 'ONLINE_FRAUD_INSIGHTS',
                'modelVersionNumber': 'string'
            },
            'scores': {
                'string': ...
            }
        },
    ],
    'ruleResults': [
        {
            'ruleId': 'string',
            'outcomes': [
                'string',
            ]
        },
    ]
}

Response Structure

  • (dict) --

    • outcomes (list) --

      The prediction outcomes.

      • (string) --

    • modelScores (list) --

      The model scores for models used in the detector version.

      • (dict) --

        The fraud prediction scores.

        • modelVersion (dict) --

          The model version.

          • modelId (string) --

            The parent model ID.

          • modelType (string) --

            The model type.

          • modelVersionNumber (string) --

            The model version.

        • scores (dict) --

          The model's fraud prediction scores.

          • (string) --

            • (float) --

    • ruleResults (list) --

      The rule results in the prediction.

      • (dict) --

        The rule results.

        • ruleId (string) --

          The rule ID that was matched, based on the rule execution mode.

        • outcomes (list) --

          The outcomes of the matched rule, based on the rule execution mode.

          • (string) --

UpdateDetectorVersion (updated) Link ¶
Changes (request)
{'ruleExecutionMode': 'ALL_MATCHED | FIRST_MATCHED'}

Updates a detector version. The detector version attributes that you can update include models, external model endpoints, rules, and description. You can only update a DRAFT detector version.

See also: AWS API Documentation

Request Syntax

client.update_detector_version(
    detectorId='string',
    detectorVersionId='string',
    externalModelEndpoints=[
        'string',
    ],
    rules=[
        {
            'detectorId': 'string',
            'ruleId': 'string',
            'ruleVersion': 'string'
        },
    ],
    description='string',
    modelVersions=[
        {
            'modelId': 'string',
            'modelType': 'ONLINE_FRAUD_INSIGHTS',
            'modelVersionNumber': 'string'
        },
    ],
    ruleExecutionMode='ALL_MATCHED'|'FIRST_MATCHED'
)
type detectorId:

string

param detectorId:

[REQUIRED]

The parent detector ID for the detector version you want to update.

type detectorVersionId:

string

param detectorVersionId:

[REQUIRED]

The detector version ID.

type externalModelEndpoints:

list

param externalModelEndpoints:

[REQUIRED]

The Amazon SageMaker model endpoints to include in the detector version.

  • (string) --

type rules:

list

param rules:

[REQUIRED]

The rules to include in the detector version.

  • (dict) --

    A rule.

    • detectorId (string) -- [REQUIRED]

      The detector for which the rule is associated.

    • ruleId (string) -- [REQUIRED]

      The rule ID.

    • ruleVersion (string) -- [REQUIRED]

      The rule version.

type description:

string

param description:

The detector version description.

type modelVersions:

list

param modelVersions:

The model versions to include in the detector version.

  • (dict) --

    The model version.

    • modelId (string) -- [REQUIRED]

      The parent model ID.

    • modelType (string) -- [REQUIRED]

      The model type.

    • modelVersionNumber (string) -- [REQUIRED]

      The model version.

type ruleExecutionMode:

string

param ruleExecutionMode:

The rule execution mode to add to the detector.

If you specify FIRST_MATCHED, Amazon Fraud Detector evaluates rules sequentially, first to last, stopping at the first matched rule. Amazon Fraud dectector then provides the outcomes for that single rule.

If you specifiy ALL_MATCHED, Amazon Fraud Detector evaluates all rules and returns the outcomes for all matched rules. You can define and edit the rule mode at the detector version level, when it is in draft status.

The default behavior is FIRST_MATCHED.

rtype:

dict

returns:

Response Syntax

{}

Response Structure

  • (dict) --