Amazon Fraud Detector

2020/07/20 - Amazon Fraud Detector - 16 new 24 updated api methods

Changes  Introduced flexible model training dataset requirements for Online Fraud Insights so that customers can choose any two inputs to train a model instead of being required to use 'email' and 'IP address' at minimum. Added support for resource ARNs, resource tags, resource-based IAM policies and identity-based policies that limit access to a resource based on tags. Added support for customer-managed customer master key (CMK) data encryption. Added new Event Type, Entity Type, and Label APIs. An event type defines the structure for an event sent to Amazon Fraud Detector, including the variables sent as part of the event, the entity performing the event, and the labels that classify the event. Introduced the GetEventPrediction API.

GetKMSEncryptionKey (new) Link ¶

Gets the encryption key if a Key Management Service (KMS) customer master key (CMK) has been specified to be used to encrypt content in Amazon Fraud Detector.

See also: AWS API Documentation

Request Syntax

client.get_kms_encryption_key()
rtype

dict

returns

Response Syntax

{
    'kmsKey': {
        'kmsEncryptionKeyArn': 'string'
    }
}

Response Structure

  • (dict) --

    • kmsKey (dict) --

      The KMS encryption key.

      • kmsEncryptionKeyArn (string) --

        The encryption key ARN.

CreateModel (new) Link ¶

Creates a model using the specified model type.

See also: AWS API Documentation

Request Syntax

client.create_model(
    modelId='string',
    modelType='ONLINE_FRAUD_INSIGHTS',
    description='string',
    eventTypeName='string',
    tags=[
        {
            'key': 'string',
            'value': 'string'
        },
    ]
)
type modelId

string

param modelId

[REQUIRED]

The model ID.

type modelType

string

param modelType

[REQUIRED]

The model type.

type description

string

param description

The model description.

type eventTypeName

string

param eventTypeName

[REQUIRED]

The name of the event type.

type tags

list

param tags

A collection of key and value pairs.

  • (dict) --

    A key and value pair.

    • key (string) -- [REQUIRED]

      A tag key.

    • value (string) -- [REQUIRED]

      A value assigned to a tag key.

rtype

dict

returns

Response Syntax

{}

Response Structure

  • (dict) --

DeleteRule (new) Link ¶

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

See also: AWS API Documentation

Request Syntax

client.delete_rule(
    rule={
        'detectorId': 'string',
        'ruleId': 'string',
        'ruleVersion': 'string'
    }
)
type rule

dict

param rule

[REQUIRED]

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.

rtype

dict

returns

Response Syntax

{}

Response Structure

  • (dict) --

UpdateModelVersionStatus (new) Link ¶

Updates the status of a model version.

You can perform the following status updates:

  • Change the TRAINING_COMPLETE status to ACTIVE .

  • Change ACTIVE to INACTIVE .

See also: AWS API Documentation

Request Syntax

client.update_model_version_status(
    modelId='string',
    modelType='ONLINE_FRAUD_INSIGHTS',
    modelVersionNumber='string',
    status='TRAINING_IN_PROGRESS'|'TRAINING_COMPLETE'|'ACTIVATE_REQUESTED'|'ACTIVATE_IN_PROGRESS'|'ACTIVE'|'INACTIVATE_IN_PROGRESS'|'INACTIVE'|'DELETE_REQUESTED'|'DELETE_IN_PROGRESS'|'ERROR'
)
type modelId

string

param modelId

[REQUIRED]

The model ID of the model version to update.

type modelType

string

param modelType

[REQUIRED]

The model type.

type modelVersionNumber

string

param modelVersionNumber

[REQUIRED]

The model version number.

type status

string

param status

[REQUIRED]

The model version status.

rtype

dict

returns

Response Syntax

{}

Response Structure

  • (dict) --

GetEntityTypes (new) Link ¶

Gets all entity types or a specific entity type if a name is specified. This is a paginated API. If you provide a null maxResults , this action retrieves a maximum of 10 records per page. If you provide a maxResults , the value must be between 5 and 10. To get the next page results, provide the pagination token from the GetEntityTypesResponse as part of your request. A null pagination token fetches the records from the beginning.

See also: AWS API Documentation

Request Syntax

client.get_entity_types(
    name='string',
    nextToken='string',
    maxResults=123
)
type name

string

param name

The name.

type nextToken

string

param nextToken

The next token for the subsequent request.

type maxResults

integer

param maxResults

The maximum number of objects to return for the request.

rtype

dict

returns

Response Syntax

{
    'entityTypes': [
        {
            'name': 'string',
            'description': 'string',
            'lastUpdatedTime': 'string',
            'createdTime': 'string',
            'arn': 'string'
        },
    ],
    'nextToken': 'string'
}

Response Structure

  • (dict) --

    • entityTypes (list) --

      An array of entity types.

      • (dict) --

        The entity type details.

        • name (string) --

          The entity type name.

        • description (string) --

          The entity type description.

        • lastUpdatedTime (string) --

          Timestamp of when the entity type was last updated.

        • createdTime (string) --

          Timestamp of when the entity type was created.

        • arn (string) --

          The entity type ARN.

    • nextToken (string) --

      The next page token.

UntagResource (new) Link ¶

Removes tags from a resource.

See also: AWS API Documentation

Request Syntax

client.untag_resource(
    resourceARN='string',
    tagKeys=[
        'string',
    ]
)
type resourceARN

string

param resourceARN

[REQUIRED]

The ARN of the resource from which to remove the tag.

type tagKeys

list

param tagKeys

[REQUIRED]

The resource ARN.

  • (string) --

rtype

dict

returns

Response Syntax

{}

Response Structure

  • (dict) --

GetLabels (new) Link ¶

Gets all labels or a specific label if name is provided. This is a paginated API. If you provide a null maxResults , this action retrieves a maximum of 50 records per page. If you provide a maxResults , the value must be between 10 and 50. To get the next page results, provide the pagination token from the GetGetLabelsResponse as part of your request. A null pagination token fetches the records from the beginning.

See also: AWS API Documentation

Request Syntax

client.get_labels(
    name='string',
    nextToken='string',
    maxResults=123
)
type name

string

param name

The name of the label or labels to get.

type nextToken

string

param nextToken

The next token for the subsequent request.

type maxResults

integer

param maxResults

The maximum number of objects to return for the request.

rtype

dict

returns

Response Syntax

{
    'labels': [
        {
            'name': 'string',
            'description': 'string',
            'lastUpdatedTime': 'string',
            'createdTime': 'string',
            'arn': 'string'
        },
    ],
    'nextToken': 'string'
}

Response Structure

  • (dict) --

    • labels (list) --

      An array of labels.

      • (dict) --

        The label details.

        • name (string) --

          The label name.

        • description (string) --

          The label description.

        • lastUpdatedTime (string) --

          Timestamp of when the label was last updated.

        • createdTime (string) --

          Timestamp of when the event type was created.

        • arn (string) --

          The label ARN.

    • nextToken (string) --

      The next page token.

PutLabel (new) Link ¶

Creates or updates label. A label classifies an event as fraudulent or legitimate. Labels are associated with event types and used to train supervised machine learning models in Amazon Fraud Detector.

See also: AWS API Documentation

Request Syntax

client.put_label(
    name='string',
    description='string',
    tags=[
        {
            'key': 'string',
            'value': 'string'
        },
    ]
)
type name

string

param name

[REQUIRED]

The label name.

type description

string

param description

The label description.

type tags

list

param tags
  • (dict) --

    A key and value pair.

    • key (string) -- [REQUIRED]

      A tag key.

    • value (string) -- [REQUIRED]

      A value assigned to a tag key.

rtype

dict

returns

Response Syntax

{}

Response Structure

  • (dict) --

PutEventType (new) Link ¶

Creates or updates an event type. An event is a business activity that is evaluated for fraud risk. With Amazon Fraud Detector, you generate fraud predictions for events. An event type defines the structure for an event sent to Amazon Fraud Detector. This includes the variables sent as part of the event, the entity performing the event (such as a customer), and the labels that classify the event. Example event types include online payment transactions, account registrations, and authentications.

See also: AWS API Documentation

Request Syntax

client.put_event_type(
    name='string',
    description='string',
    eventVariables=[
        'string',
    ],
    labels=[
        'string',
    ],
    entityTypes=[
        'string',
    ],
    tags=[
        {
            'key': 'string',
            'value': 'string'
        },
    ]
)
type name

string

param name

[REQUIRED]

The name.

type description

string

param description

The description of the event type.

type eventVariables

list

param eventVariables

[REQUIRED]

The event type variables.

  • (string) --

type labels

list

param labels

The event type labels.

  • (string) --

type entityTypes

list

param entityTypes

[REQUIRED]

The entity type for the event type. Example entity types: customer, merchant, account.

  • (string) --

type tags

list

param tags

A collection of key and value pairs.

  • (dict) --

    A key and value pair.

    • key (string) -- [REQUIRED]

      A tag key.

    • value (string) -- [REQUIRED]

      A value assigned to a tag key.

rtype

dict

returns

Response Syntax

{}

Response Structure

  • (dict) --

UpdateModel (new) Link ¶

Updates a model. You can update the description attribute using this action.

See also: AWS API Documentation

Request Syntax

client.update_model(
    modelId='string',
    modelType='ONLINE_FRAUD_INSIGHTS',
    description='string'
)
type modelId

string

param modelId

[REQUIRED]

The model ID.

type modelType

string

param modelType

[REQUIRED]

The model type.

type description

string

param description

The new model description.

rtype

dict

returns

Response Syntax

{}

Response Structure

  • (dict) --

PutKMSEncryptionKey (new) Link ¶

Specifies the Key Management Service (KMS) customer master key (CMK) to be used to encrypt content in Amazon Fraud Detector.

See also: AWS API Documentation

Request Syntax

client.put_kms_encryption_key(
    kmsEncryptionKeyArn='string'
)
type kmsEncryptionKeyArn

string

param kmsEncryptionKeyArn

[REQUIRED]

The KMS encryption key ARN.

rtype

dict

returns

Response Syntax

{}

Response Structure

  • (dict) --

TagResource (new) Link ¶

Assigns tags to a resource.

See also: AWS API Documentation

Request Syntax

client.tag_resource(
    resourceARN='string',
    tags=[
        {
            'key': 'string',
            'value': 'string'
        },
    ]
)
type resourceARN

string

param resourceARN

[REQUIRED]

The resource ARN.

type tags

list

param tags

[REQUIRED]

The tags to assign to the resource.

  • (dict) --

    A key and value pair.

    • key (string) -- [REQUIRED]

      A tag key.

    • value (string) -- [REQUIRED]

      A value assigned to a tag key.

rtype

dict

returns

Response Syntax

{}

Response Structure

  • (dict) --

GetEventPrediction (new) Link ¶

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_event_prediction(
    detectorId='string',
    detectorVersionId='string',
    eventId='string',
    eventTypeName='string',
    entities=[
        {
            'entityType': 'string',
            'entityId': 'string'
        },
    ],
    eventTimestamp='string',
    eventVariables={
        '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 eventTypeName

string

param eventTypeName

[REQUIRED]

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

type entities

list

param entities

[REQUIRED]

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."

  • (dict) --

    The entity details.

    • entityType (string) --

      The entity type.

    • entityId (string) --

      The entity ID. If you do not know the entityId , you can pass unknown , which is areserved string literal.

type eventTimestamp

string

param eventTimestamp

[REQUIRED]

Timestamp that defines when the event under evaluation occurred.

type eventVariables

dict

param eventVariables

[REQUIRED]

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.

  • (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

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

Response Structure

  • (dict) --

    • modelScores (list) --

      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.

      • (dict) --

        The fraud prediction scores.

        • modelVersion (dict) --

          The model version.

          • modelId (string) --

            The model ID.

          • modelType (string) --

            The model type.

          • modelVersionNumber (string) --

            The model version number.

          • arn (string) --

            The model version ARN.

        • scores (dict) --

          The model's fraud prediction scores.

          • (string) --

            • (float) --

    • ruleResults (list) --

      The results.

      • (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) --

ListTagsForResource (new) Link ¶

Lists all tags associated with the resource. This is a paginated API. To get the next page results, provide the pagination token from the response as part of your request. A null pagination token fetches the records from the beginning.

See also: AWS API Documentation

Request Syntax

client.list_tags_for_resource(
    resourceARN='string',
    nextToken='string',
    maxResults=123
)
type resourceARN

string

param resourceARN

[REQUIRED]

The ARN that specifies the resource whose tags you want to list.

type nextToken

string

param nextToken

The next token from the previous results.

type maxResults

integer

param maxResults

The maximum number of objects to return for the request.

rtype

dict

returns

Response Syntax

{
    'tags': [
        {
            'key': 'string',
            'value': 'string'
        },
    ],
    'nextToken': 'string'
}

Response Structure

  • (dict) --

    • tags (list) --

      A collection of key and value pairs.

      • (dict) --

        A key and value pair.

        • key (string) --

          A tag key.

        • value (string) --

          A value assigned to a tag key.

    • nextToken (string) --

      The next token for subsequent requests.

PutEntityType (new) Link ¶

Creates or updates an entity type. An entity represents who is performing the event. As part of a fraud prediction, you pass the entity ID to indicate the specific entity who performed the event. An entity type classifies the entity. Example classifications include customer, merchant, or account.

See also: AWS API Documentation

Request Syntax

client.put_entity_type(
    name='string',
    description='string',
    tags=[
        {
            'key': 'string',
            'value': 'string'
        },
    ]
)
type name

string

param name

[REQUIRED]

The name of the entity type.

type description

string

param description

The description.

type tags

list

param tags

A collection of key and value pairs.

  • (dict) --

    A key and value pair.

    • key (string) -- [REQUIRED]

      A tag key.

    • value (string) -- [REQUIRED]

      A value assigned to a tag key.

rtype

dict

returns

Response Syntax

{}

Response Structure

  • (dict) --

GetEventTypes (new) Link ¶

Gets all event types or a specific event type if name is provided. This is a paginated API. If you provide a null maxResults , this action retrieves a maximum of 10 records per page. If you provide a maxResults , the value must be between 5 and 10. To get the next page results, provide the pagination token from the GetEventTypesResponse as part of your request. A null pagination token fetches the records from the beginning.

See also: AWS API Documentation

Request Syntax

client.get_event_types(
    name='string',
    nextToken='string',
    maxResults=123
)
type name

string

param name

The name.

type nextToken

string

param nextToken

The next token for the subsequent request.

type maxResults

integer

param maxResults

The maximum number of objects to return for the request.

rtype

dict

returns

Response Syntax

{
    'eventTypes': [
        {
            'name': 'string',
            'description': 'string',
            'eventVariables': [
                'string',
            ],
            'labels': [
                'string',
            ],
            'entityTypes': [
                'string',
            ],
            'lastUpdatedTime': 'string',
            'createdTime': 'string',
            'arn': 'string'
        },
    ],
    'nextToken': 'string'
}

Response Structure

  • (dict) --

    • eventTypes (list) --

      An array of event types.

      • (dict) --

        The event type details.

        • name (string) --

          The event type name.

        • description (string) --

          The event type description.

        • eventVariables (list) --

          The event type event variables.

          • (string) --

        • labels (list) --

          The event type labels.

          • (string) --

        • entityTypes (list) --

          The event type entity types.

          • (string) --

        • lastUpdatedTime (string) --

          Timestamp of when the event type was last updated.

        • createdTime (string) --

          Timestamp of when the event type was created.

        • arn (string) --

          The entity type ARN.

    • nextToken (string) --

      The next page token.

BatchCreateVariable (updated) Link ¶
Changes (request)
{'tags': [{'key': 'string', 'value': 'string'}]}

Creates a batch of variables.

See also: AWS API Documentation

Request Syntax

client.batch_create_variable(
    variableEntries=[
        {
            'name': 'string',
            'dataType': 'string',
            'dataSource': 'string',
            'defaultValue': 'string',
            'description': 'string',
            'variableType': 'string'
        },
    ],
    tags=[
        {
            'key': 'string',
            'value': 'string'
        },
    ]
)
type variableEntries

list

param variableEntries

[REQUIRED]

The list of variables for the batch create variable request.

  • (dict) --

    A variable in the list of variables for the batch create variable request.

    • name (string) --

      The name of the variable.

    • dataType (string) --

      The data type of the variable.

    • dataSource (string) --

      The data source of the variable.

    • defaultValue (string) --

      The default value of the variable.

    • description (string) --

      The description of the variable.

    • variableType (string) --

      The type of the variable.

      Valid Values: AUTH_CODE | AVS | BILLING_ADDRESS_L1 | BILLING_ADDRESS_L2 | BILLING_CITY | BILLING_COUNTRY | BILLING_NAME | BILLING_PHONE | BILLING_STATE | BILLING_ZIP | CARD_BIN | CATEGORICAL | CURRENCY_CODE | EMAIL_ADDRESS | FINGERPRINT | FRAUD_LABEL | FREE_FORM_TEXT | IP_ADDRESS | NUMERIC | ORDER_ID | PAYMENT_TYPE | PHONE_NUMBER | PRICE | PRODUCT_CATEGORY | SHIPPING_ADDRESS_L1 | SHIPPING_ADDRESS_L2 | SHIPPING_CITY | SHIPPING_COUNTRY | SHIPPING_NAME | SHIPPING_PHONE | SHIPPING_STATE | SHIPPING_ZIP | USERAGENT | SHIPPING_ZIP | USERAGENT

type tags

list

param tags

A collection of key and value pairs.

  • (dict) --

    A key and value pair.

    • key (string) -- [REQUIRED]

      A tag key.

    • value (string) -- [REQUIRED]

      A value assigned to a tag key.

rtype

dict

returns

Response Syntax

{
    'errors': [
        {
            'name': 'string',
            'code': 123,
            'message': 'string'
        },
    ]
}

Response Structure

  • (dict) --

    • errors (list) --

      Provides the errors for the BatchCreateVariable request.

      • (dict) --

        Provides the error of the batch create variable API.

        • name (string) --

          The name.

        • code (integer) --

          The error code.

        • message (string) --

          The error message.

BatchGetVariable (updated) Link ¶
Changes (response)
{'variables': {'arn': 'string'}}

Gets a batch of variables.

See also: AWS API Documentation

Request Syntax

client.batch_get_variable(
    names=[
        'string',
    ]
)
type names

list

param names

[REQUIRED]

The list of variable names to get.

  • (string) --

rtype

dict

returns

Response Syntax

{
    'variables': [
        {
            'name': 'string',
            'dataType': 'STRING'|'INTEGER'|'FLOAT'|'BOOLEAN',
            'dataSource': 'EVENT'|'MODEL_SCORE'|'EXTERNAL_MODEL_SCORE',
            'defaultValue': 'string',
            'description': 'string',
            'variableType': 'string',
            'lastUpdatedTime': 'string',
            'createdTime': 'string',
            'arn': 'string'
        },
    ],
    'errors': [
        {
            'name': 'string',
            'code': 123,
            'message': 'string'
        },
    ]
}

Response Structure

  • (dict) --

    • variables (list) --

      The returned variables.

      • (dict) --

        The variable.

        • name (string) --

          The name of the variable.

        • dataType (string) --

          The data type of the variable.

        • dataSource (string) --

          The data source of the variable.

        • defaultValue (string) --

          The default value of the variable.

        • description (string) --

          The description of the variable.

        • variableType (string) --

          The variable type of the variable.

          Valid Values: AUTH_CODE | AVS | BILLING_ADDRESS_L1 | BILLING_ADDRESS_L2 | BILLING_CITY | BILLING_COUNTRY | BILLING_NAME | BILLING_PHONE | BILLING_STATE | BILLING_ZIP | CARD_BIN | CATEGORICAL | CURRENCY_CODE | EMAIL_ADDRESS | FINGERPRINT | FRAUD_LABEL | FREE_FORM_TEXT | IP_ADDRESS | NUMERIC | ORDER_ID | PAYMENT_TYPE | PHONE_NUMBER | PRICE | PRODUCT_CATEGORY | SHIPPING_ADDRESS_L1 | SHIPPING_ADDRESS_L2 | SHIPPING_CITY | SHIPPING_COUNTRY | SHIPPING_NAME | SHIPPING_PHONE | SHIPPING_STATE | SHIPPING_ZIP | USERAGENT | SHIPPING_ZIP | USERAGENT

        • lastUpdatedTime (string) --

          The time when variable was last updated.

        • createdTime (string) --

          The time when the variable was created.

        • arn (string) --

          The ARN of the variable.

    • errors (list) --

      The errors from the request.

      • (dict) --

        Provides the error of the batch get variable API.

        • name (string) --

          The error name.

        • code (integer) --

          The error code.

        • message (string) --

          The error message.

CreateDetectorVersion (updated) Link ¶
Changes (request)
{'modelVersions': {'arn': 'string'},
 'tags': [{'key': 'string', 'value': 'string'}]}

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',
            'arn': 'string'
        },
    ],
    ruleExecutionMode='ALL_MATCHED'|'FIRST_MATCHED',
    tags=[
        {
            'key': 'string',
            'value': 'string'
        },
    ]
)
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 model ID.

    • modelType (string) -- [REQUIRED]

      The model type.

    • modelVersionNumber (string) -- [REQUIRED]

      The model version number.

    • arn (string) --

      The model version ARN.

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 .

type tags

list

param tags

A collection of key and value pairs.

  • (dict) --

    A key and value pair.

    • key (string) -- [REQUIRED]

      A tag key.

    • value (string) -- [REQUIRED]

      A value assigned to a tag key.

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.

CreateModelVersion (updated) Link ¶
Changes (request)
{'externalEventsDetail': {'dataAccessRoleArn': 'string',
                          'dataLocation': 'string'},
 'tags': [{'key': 'string', 'value': 'string'}],
 'trainingDataSchema': {'labelSchema': {'labelMapper': {'string': ['string']}},
                        'modelVariables': ['string']},
 'trainingDataSource': 'EXTERNAL_EVENTS'}

Creates a version of the model using the specified model type and model id.

See also: AWS API Documentation

Request Syntax

client.create_model_version(
    modelId='string',
    modelType='ONLINE_FRAUD_INSIGHTS',
    trainingDataSource='EXTERNAL_EVENTS',
    trainingDataSchema={
        'modelVariables': [
            'string',
        ],
        'labelSchema': {
            'labelMapper': {
                'string': [
                    'string',
                ]
            }
        }
    },
    externalEventsDetail={
        'dataLocation': 'string',
        'dataAccessRoleArn': 'string'
    },
    tags=[
        {
            'key': 'string',
            'value': 'string'
        },
    ]
)
type modelId

string

param modelId

[REQUIRED]

The model ID.

type modelType

string

param modelType

[REQUIRED]

The model type.

type trainingDataSource

string

param trainingDataSource

[REQUIRED]

The training data source location in Amazon S3.

type trainingDataSchema

dict

param trainingDataSchema

[REQUIRED]

The training data schema.

  • modelVariables (list) -- [REQUIRED]

    The training data schema variables.

    • (string) --

  • labelSchema (dict) -- [REQUIRED]

    The label schema.

    • labelMapper (dict) -- [REQUIRED]

      The label mapper maps the Amazon Fraud Detector supported model classification labels ( FRAUD , LEGIT ) to the appropriate event type labels. For example, if " FRAUD " and " LEGIT " are Amazon Fraud Detector supported labels, this mapper could be: {"FRAUD" => ["0"] , "LEGIT" => ["1"]} or {"FRAUD" => ["false"] , "LEGIT" => ["true"]} or {"FRAUD" => ["fraud", "abuse"] , "LEGIT" => ["legit", "safe"]} . The value part of the mapper is a list, because you may have multiple label variants from your event type for a single Amazon Fraud Detector label.

      • (string) --

        • (list) --

          • (string) --

type externalEventsDetail

dict

param externalEventsDetail

Details for the external events data used for model version training. Required if trainingDataSource is EXTERNAL_EVENTS .

  • dataLocation (string) -- [REQUIRED]

    The Amazon S3 bucket location for the data.

  • dataAccessRoleArn (string) -- [REQUIRED]

    The ARN of the role that provides Amazon Fraud Detector access to the data location.

type tags

list

param tags

A collection of key and value pairs.

  • (dict) --

    A key and value pair.

    • key (string) -- [REQUIRED]

      A tag key.

    • value (string) -- [REQUIRED]

      A value assigned to a tag key.

rtype

dict

returns

Response Syntax

{
    'modelId': 'string',
    'modelType': 'ONLINE_FRAUD_INSIGHTS',
    'modelVersionNumber': 'string',
    'status': 'string'
}

Response Structure

  • (dict) --

    • modelId (string) --

      The model ID.

    • modelType (string) --

      The model type.

    • modelVersionNumber (string) --

      The model version number of the model version created.

    • status (string) --

      The model version status.

CreateRule (updated) Link ¶
Changes (request)
{'tags': [{'key': 'string', 'value': 'string'}]}

Creates a rule for use with the specified detector.

See also: AWS API Documentation

Request Syntax

client.create_rule(
    ruleId='string',
    detectorId='string',
    description='string',
    expression='string',
    language='DETECTORPL',
    outcomes=[
        'string',
    ],
    tags=[
        {
            'key': 'string',
            'value': 'string'
        },
    ]
)
type ruleId

string

param ruleId

[REQUIRED]

The rule ID.

type detectorId

string

param detectorId

[REQUIRED]

The detector ID for the rule's parent detector.

type description

string

param description

The rule description.

type expression

string

param expression

[REQUIRED]

The rule expression.

type language

string

param language

[REQUIRED]

The language of the rule.

type outcomes

list

param outcomes

[REQUIRED]

The outcome or outcomes returned when the rule expression matches.

  • (string) --

type tags

list

param tags

A collection of key and value pairs.

  • (dict) --

    A key and value pair.

    • key (string) -- [REQUIRED]

      A tag key.

    • value (string) -- [REQUIRED]

      A value assigned to a tag key.

rtype

dict

returns

Response Syntax

{
    'rule': {
        'detectorId': 'string',
        'ruleId': 'string',
        'ruleVersion': 'string'
    }
}

Response Structure

  • (dict) --

    • rule (dict) --

      The created rule.

      • detectorId (string) --

        The detector for which the rule is associated.

      • ruleId (string) --

        The rule ID.

      • ruleVersion (string) --

        The rule version.

CreateVariable (updated) Link ¶
Changes (request)
{'tags': [{'key': 'string', 'value': 'string'}]}

Creates a variable.

See also: AWS API Documentation

Request Syntax

client.create_variable(
    name='string',
    dataType='STRING'|'INTEGER'|'FLOAT'|'BOOLEAN',
    dataSource='EVENT'|'MODEL_SCORE'|'EXTERNAL_MODEL_SCORE',
    defaultValue='string',
    description='string',
    variableType='string',
    tags=[
        {
            'key': 'string',
            'value': 'string'
        },
    ]
)
type name

string

param name

[REQUIRED]

The name of the variable.

type dataType

string

param dataType

[REQUIRED]

The data type.

type dataSource

string

param dataSource

[REQUIRED]

The source of the data.

type defaultValue

string

param defaultValue

[REQUIRED]

The default value for the variable when no value is received.

type description

string

param description

The description.

type variableType

string

param variableType

The variable type.

Valid Values: AUTH_CODE | AVS | BILLING_ADDRESS_L1 | BILLING_ADDRESS_L2 | BILLING_CITY | BILLING_COUNTRY | BILLING_NAME | BILLING_PHONE | BILLING_STATE | BILLING_ZIP | CARD_BIN | CATEGORICAL | CURRENCY_CODE | EMAIL_ADDRESS | FINGERPRINT | FRAUD_LABEL | FREE_FORM_TEXT | IP_ADDRESS | NUMERIC | ORDER_ID | PAYMENT_TYPE | PHONE_NUMBER | PRICE | PRODUCT_CATEGORY | SHIPPING_ADDRESS_L1 | SHIPPING_ADDRESS_L2 | SHIPPING_CITY | SHIPPING_COUNTRY | SHIPPING_NAME | SHIPPING_PHONE | SHIPPING_STATE | SHIPPING_ZIP | USERAGENT | SHIPPING_ZIP | USERAGENT

type tags

list

param tags

A collection of key and value pairs.

  • (dict) --

    A key and value pair.

    • key (string) -- [REQUIRED]

      A tag key.

    • value (string) -- [REQUIRED]

      A value assigned to a tag key.

rtype

dict

returns

Response Syntax

{}

Response Structure

  • (dict) --

DeleteEvent (updated) Link ¶
Changes (request)
{'eventTypeName': 'string'}

Deletes the specified event.

See also: AWS API Documentation

Request Syntax

client.delete_event(
    eventId='string',
    eventTypeName='string'
)
type eventId

string

param eventId

[REQUIRED]

The ID of the event to delete.

type eventTypeName

string

param eventTypeName

[REQUIRED]

The name of the event type.

rtype

dict

returns

Response Syntax

{}

Response Structure

  • (dict) --

DescribeDetector (updated) Link ¶
Changes (response)
{'arn': 'string'}

Gets all versions for a specified detector.

See also: AWS API Documentation

Request Syntax

client.describe_detector(
    detectorId='string',
    nextToken='string',
    maxResults=123
)
type detectorId

string

param detectorId

[REQUIRED]

The detector ID.

type nextToken

string

param nextToken

The next token from the previous response.

type maxResults

integer

param maxResults

The maximum number of results to return for the request.

rtype

dict

returns

Response Syntax

{
    'detectorId': 'string',
    'detectorVersionSummaries': [
        {
            'detectorVersionId': 'string',
            'status': 'DRAFT'|'ACTIVE'|'INACTIVE',
            'description': 'string',
            'lastUpdatedTime': 'string'
        },
    ],
    'nextToken': 'string',
    'arn': 'string'
}

Response Structure

  • (dict) --

    • detectorId (string) --

      The detector ID.

    • detectorVersionSummaries (list) --

      The status and description for each detector version.

      • (dict) --

        The summary of the detector version.

        • detectorVersionId (string) --

          The detector version ID.

        • status (string) --

          The detector version status.

        • description (string) --

          The detector version description.

        • lastUpdatedTime (string) --

          Timestamp of when the detector version was last updated.

    • nextToken (string) --

      The next token to be used for subsequent requests.

    • arn (string) --

      The detector ARN.

DescribeModelVersions (updated) Link ¶
Changes (response)
{'modelVersionDetails': {'arn': 'string',
                         'externalEventsDetail': {'dataAccessRoleArn': 'string',
                                                  'dataLocation': 'string'},
                         'trainingDataSchema': {'labelSchema': {'labelMapper': {'string': ['string']}},
                                                'modelVariables': ['string']},
                         'trainingResult': {'dataValidationMetrics': {'fieldLevelMessages': [{'content': 'string',
                                                                                              'fieldName': 'string',
                                                                                              'identifier': 'string',
                                                                                              'title': 'string',
                                                                                              'type': 'string'}],
                                                                      'fileLevelMessages': [{'content': 'string',
                                                                                             'title': 'string',
                                                                                             'type': 'string'}]},
                                            'trainingMetrics': {'auc': 'float',
                                                                'metricDataPoints': [{'fpr': 'float',
                                                                                      'precision': 'float',
                                                                                      'threshold': 'float',
                                                                                      'tpr': 'float'}]}}}}

Gets all of the model versions for the specified model type or for the specified model type and model ID. You can also get details for a single, specified model version.

See also: AWS API Documentation

Request Syntax

client.describe_model_versions(
    modelId='string',
    modelVersionNumber='string',
    modelType='ONLINE_FRAUD_INSIGHTS',
    nextToken='string',
    maxResults=123
)
type modelId

string

param modelId

The model ID.

type modelVersionNumber

string

param modelVersionNumber

The model version number.

type modelType

string

param modelType

The model type.

type nextToken

string

param nextToken

The next token from the previous results.

type maxResults

integer

param maxResults

The maximum number of results to return.

rtype

dict

returns

Response Syntax

{
    'modelVersionDetails': [
        {
            'modelId': 'string',
            'modelType': 'ONLINE_FRAUD_INSIGHTS',
            'modelVersionNumber': 'string',
            'status': 'string',
            'trainingDataSource': 'EXTERNAL_EVENTS',
            'trainingDataSchema': {
                'modelVariables': [
                    'string',
                ],
                'labelSchema': {
                    'labelMapper': {
                        'string': [
                            'string',
                        ]
                    }
                }
            },
            'externalEventsDetail': {
                'dataLocation': 'string',
                'dataAccessRoleArn': 'string'
            },
            'trainingResult': {
                'dataValidationMetrics': {
                    'fileLevelMessages': [
                        {
                            'title': 'string',
                            'content': 'string',
                            'type': 'string'
                        },
                    ],
                    'fieldLevelMessages': [
                        {
                            'fieldName': 'string',
                            'identifier': 'string',
                            'title': 'string',
                            'content': 'string',
                            'type': 'string'
                        },
                    ]
                },
                'trainingMetrics': {
                    'auc': ...,
                    'metricDataPoints': [
                        {
                            'fpr': ...,
                            'precision': ...,
                            'tpr': ...,
                            'threshold': ...
                        },
                    ]
                }
            },
            'lastUpdatedTime': 'string',
            'createdTime': 'string',
            'arn': 'string'
        },
    ],
    'nextToken': 'string'
}

Response Structure

  • (dict) --

    • modelVersionDetails (list) --

      The model version details.

      • (dict) --

        The details of the model version.

        • modelId (string) --

          The model ID.

        • modelType (string) --

          The model type.

        • modelVersionNumber (string) --

          The model version number.

        • status (string) --

          The status of the model version.

        • trainingDataSource (string) --

          The model version training data source.

        • trainingDataSchema (dict) --

          The training data schema.

          • modelVariables (list) --

            The training data schema variables.

            • (string) --

          • labelSchema (dict) --

            The label schema.

            • labelMapper (dict) --

              The label mapper maps the Amazon Fraud Detector supported model classification labels ( FRAUD , LEGIT ) to the appropriate event type labels. For example, if " FRAUD " and " LEGIT " are Amazon Fraud Detector supported labels, this mapper could be: {"FRAUD" => ["0"] , "LEGIT" => ["1"]} or {"FRAUD" => ["false"] , "LEGIT" => ["true"]} or {"FRAUD" => ["fraud", "abuse"] , "LEGIT" => ["legit", "safe"]} . The value part of the mapper is a list, because you may have multiple label variants from your event type for a single Amazon Fraud Detector label.

              • (string) --

                • (list) --

                  • (string) --

        • externalEventsDetail (dict) --

          The event details.

          • dataLocation (string) --

            The Amazon S3 bucket location for the data.

          • dataAccessRoleArn (string) --

            The ARN of the role that provides Amazon Fraud Detector access to the data location.

        • trainingResult (dict) --

          The training results.

          • dataValidationMetrics (dict) --

            The validation metrics.

            • fileLevelMessages (list) --

              The file-specific model training validation messages.

              • (dict) --

                The message details.

                • title (string) --

                  The message title.

                • content (string) --

                  The message content.

                • type (string) --

                  The message type.

            • fieldLevelMessages (list) --

              The field-specific model training validation messages.

              • (dict) --

                The message details.

                • fieldName (string) --

                  The field name.

                • identifier (string) --

                  The message ID.

                • title (string) --

                  The message title.

                • content (string) --

                  The message content.

                • type (string) --

                  The message type.

          • trainingMetrics (dict) --

            The training metric details.

            • auc (float) --

              The area under the curve. This summarizes true positive rate (TPR) and false positive rate (FPR) across all possible model score thresholds. A model with no predictive power has an AUC of 0.5, whereas a perfect model has a score of 1.0.

            • metricDataPoints (list) --

              The data points details.

              • (dict) --

                Model performance metrics data points.

                • fpr (float) --

                  The false positive rate. This is the percentage of total legitimate events that are incorrectly predicted as fraud.

                • precision (float) --

                  The percentage of fraud events correctly predicted as fraudulent as compared to all events predicted as fraudulent.

                • tpr (float) --

                  The true positive rate. This is the percentage of total fraud the model detects. Also known as capture rate.

                • threshold (float) --

                  The model threshold that specifies an acceptable fraud capture rate. For example, a threshold of 500 means any model score 500 or above is labeled as fraud.

        • lastUpdatedTime (string) --

          The timestamp when the model was last updated.

        • createdTime (string) --

          The timestamp when the model was created.

        • arn (string) --

          The model version ARN.

    • nextToken (string) --

      The next token.

GetDetectorVersion (updated) Link ¶
Changes (response)
{'arn': 'string', 'modelVersions': {'arn': 'string'}}

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',
            'arn': 'string'
        },
    ],
    'rules': [
        {
            'detectorId': 'string',
            'ruleId': 'string',
            'ruleVersion': 'string'
        },
    ],
    'status': 'DRAFT'|'ACTIVE'|'INACTIVE',
    'lastUpdatedTime': 'string',
    'createdTime': 'string',
    'ruleExecutionMode': 'ALL_MATCHED'|'FIRST_MATCHED',
    'arn': 'string'
}

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 model ID.

        • modelType (string) --

          The model type.

        • modelVersionNumber (string) --

          The model version number.

        • arn (string) --

          The model version ARN.

    • 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.

    • arn (string) --

      The detector version ARN.

GetDetectors (updated) Link ¶
Changes (response)
{'detectors': {'arn': 'string', 'eventTypeName': 'string'}}

Gets all detectors or a single detector if a detectorId is specified. This is a paginated API. If you provide a null maxResults , this action retrieves a maximum of 10 records per page. If you provide a maxResults , the value must be between 5 and 10. To get the next page results, provide the pagination token from the GetDetectorsResponse as part of your request. A null pagination token fetches the records from the beginning.

See also: AWS API Documentation

Request Syntax

client.get_detectors(
    detectorId='string',
    nextToken='string',
    maxResults=123
)
type detectorId

string

param detectorId

The detector ID.

type nextToken

string

param nextToken

The next token for the subsequent request.

type maxResults

integer

param maxResults

The maximum number of objects to return for the request.

rtype

dict

returns

Response Syntax

{
    'detectors': [
        {
            'detectorId': 'string',
            'description': 'string',
            'eventTypeName': 'string',
            'lastUpdatedTime': 'string',
            'createdTime': 'string',
            'arn': 'string'
        },
    ],
    'nextToken': 'string'
}

Response Structure

  • (dict) --

    • detectors (list) --

      The detectors.

      • (dict) --

        The detector.

        • detectorId (string) --

          The detector ID.

        • description (string) --

          The detector description.

        • eventTypeName (string) --

          The name of the event type.

        • lastUpdatedTime (string) --

          Timestamp of when the detector was last updated.

        • createdTime (string) --

          Timestamp of when the detector was created.

        • arn (string) --

          The detector ARN.

    • nextToken (string) --

      The next page token.

GetExternalModels (updated) Link ¶
Changes (response)
{'externalModels': {'arn': 'string',
                    'eventTypeName': 'string',
                    'inputConfiguration': {'useEventVariables': 'boolean'}}}

Gets the details for one or more Amazon SageMaker models that have been imported into the service. This is a paginated API. If you provide a null maxResults , this actions retrieves a maximum of 10 records per page. If you provide a maxResults , the value must be between 5 and 10. To get the next page results, provide the pagination token from the GetExternalModelsResult as part of your request. A null pagination token fetches the records from the beginning.

See also: AWS API Documentation

Request Syntax

client.get_external_models(
    modelEndpoint='string',
    nextToken='string',
    maxResults=123
)
type modelEndpoint

string

param modelEndpoint

The Amazon SageMaker model endpoint.

type nextToken

string

param nextToken

The next page token for the request.

type maxResults

integer

param maxResults

The maximum number of objects to return for the request.

rtype

dict

returns

Response Syntax

{
    'externalModels': [
        {
            'modelEndpoint': 'string',
            'eventTypeName': 'string',
            'modelSource': 'SAGEMAKER',
            'role': {
                'arn': 'string',
                'name': 'string'
            },
            'inputConfiguration': {
                'format': 'TEXT_CSV'|'APPLICATION_JSON',
                'useEventVariables': True|False,
                'jsonInputTemplate': 'string',
                'csvInputTemplate': 'string'
            },
            'outputConfiguration': {
                'format': 'TEXT_CSV'|'APPLICATION_JSONLINES',
                'jsonKeyToVariableMap': {
                    'string': 'string'
                },
                'csvIndexToVariableMap': {
                    'string': 'string'
                }
            },
            'modelEndpointStatus': 'ASSOCIATED'|'DISSOCIATED',
            'lastUpdatedTime': 'string',
            'createdTime': 'string',
            'arn': 'string'
        },
    ],
    'nextToken': 'string'
}

Response Structure

  • (dict) --

    • externalModels (list) --

      Gets the Amazon SageMaker models.

      • (dict) --

        The Amazon SageMaker model.

        • modelEndpoint (string) --

          The Amazon SageMaker model endpoints.

        • eventTypeName (string) --

          The event type names.

        • modelSource (string) --

          The source of the model.

        • role (dict) --

          The role used to invoke the model.

          • arn (string) --

            The role ARN.

          • name (string) --

            The role name.

        • inputConfiguration (dict) --

          The input configuration.

          • format (string) --

            The format of the model input configuration. The format differs depending on if it is passed through to SageMaker or constructed by Amazon Fraud Detector.

          • useEventVariables (boolean) --

            The event variables.

          • jsonInputTemplate (string) --

            Template for constructing the JSON input-data sent to SageMaker. At event-evaluation, the placeholders for variable names in the template will be replaced with the variable values before being sent to SageMaker.

          • csvInputTemplate (string) --

            Template for constructing the CSV input-data sent to SageMaker. At event-evaluation, the placeholders for variable-names in the template will be replaced with the variable values before being sent to SageMaker.

        • outputConfiguration (dict) --

          The output configuration.

          • format (string) --

            The format of the model output configuration.

          • jsonKeyToVariableMap (dict) --

            A map of JSON keys in response from SageMaker to the Amazon Fraud Detector variables.

            • (string) --

              • (string) --

          • csvIndexToVariableMap (dict) --

            A map of CSV index values in the SageMaker response to the Amazon Fraud Detector variables.

            • (string) --

              • (string) --

        • modelEndpointStatus (string) --

          The Amazon Fraud Detector status for the external model endpoint

        • lastUpdatedTime (string) --

          Timestamp of when the model was last updated.

        • createdTime (string) --

          Timestamp of when the model was last created.

        • arn (string) --

          The model ARN.

    • nextToken (string) --

      The next page token to be used in subsequent requests.

GetModelVersion (updated) Link ¶
Changes (response)
{'arn': 'string',
 'externalEventsDetail': {'dataAccessRoleArn': 'string',
                          'dataLocation': 'string'},
 'trainingDataSchema': {'labelSchema': {'labelMapper': {'string': ['string']}},
                        'modelVariables': ['string']},
 'trainingDataSource': 'EXTERNAL_EVENTS'}

Gets the details of the specified model version.

See also: AWS API Documentation

Request Syntax

client.get_model_version(
    modelId='string',
    modelType='ONLINE_FRAUD_INSIGHTS',
    modelVersionNumber='string'
)
type modelId

string

param modelId

[REQUIRED]

The model ID.

type modelType

string

param modelType

[REQUIRED]

The model type.

type modelVersionNumber

string

param modelVersionNumber

[REQUIRED]

The model version number.

rtype

dict

returns

Response Syntax

{
    'modelId': 'string',
    'modelType': 'ONLINE_FRAUD_INSIGHTS',
    'modelVersionNumber': 'string',
    'trainingDataSource': 'EXTERNAL_EVENTS',
    'trainingDataSchema': {
        'modelVariables': [
            'string',
        ],
        'labelSchema': {
            'labelMapper': {
                'string': [
                    'string',
                ]
            }
        }
    },
    'externalEventsDetail': {
        'dataLocation': 'string',
        'dataAccessRoleArn': 'string'
    },
    'status': 'string',
    'arn': 'string'
}

Response Structure

  • (dict) --

    • modelId (string) --

      The model ID.

    • modelType (string) --

      The model type.

    • modelVersionNumber (string) --

      The model version number.

    • trainingDataSource (string) --

      The training data source.

    • trainingDataSchema (dict) --

      The training data schema.

      • modelVariables (list) --

        The training data schema variables.

        • (string) --

      • labelSchema (dict) --

        The label schema.

        • labelMapper (dict) --

          The label mapper maps the Amazon Fraud Detector supported model classification labels ( FRAUD , LEGIT ) to the appropriate event type labels. For example, if " FRAUD " and " LEGIT " are Amazon Fraud Detector supported labels, this mapper could be: {"FRAUD" => ["0"] , "LEGIT" => ["1"]} or {"FRAUD" => ["false"] , "LEGIT" => ["true"]} or {"FRAUD" => ["fraud", "abuse"] , "LEGIT" => ["legit", "safe"]} . The value part of the mapper is a list, because you may have multiple label variants from your event type for a single Amazon Fraud Detector label.

          • (string) --

            • (list) --

              • (string) --

    • externalEventsDetail (dict) --

      The event details.

      • dataLocation (string) --

        The Amazon S3 bucket location for the data.

      • dataAccessRoleArn (string) --

        The ARN of the role that provides Amazon Fraud Detector access to the data location.

    • status (string) --

      The model version status.

    • arn (string) --

      The model version ARN.

GetModels (updated) Link ¶
Changes (response)
{'models': {'arn': 'string', 'eventTypeName': 'string'}}

Gets one or more models. Gets all models for the AWS account if no model type and no model id provided. Gets all models for the AWS account and model type, if the model type is specified but model id is not provided. Gets a specific model if (model type, model id) tuple is specified.

This is a paginated API. If you provide a null maxResults , this action retrieves a maximum of 10 records per page. If you provide a maxResults , the value must be between 1 and 10. To get the next page results, provide the pagination token from the response as part of your request. A null pagination token fetches the records from the beginning.

See also: AWS API Documentation

Request Syntax

client.get_models(
    modelId='string',
    modelType='ONLINE_FRAUD_INSIGHTS',
    nextToken='string',
    maxResults=123
)
type modelId

string

param modelId

The model ID.

type modelType

string

param modelType

The model type.

type nextToken

string

param nextToken

The next token for the subsequent request.

type maxResults

integer

param maxResults

The maximum number of objects to return for the request.

rtype

dict

returns

Response Syntax

{
    'nextToken': 'string',
    'models': [
        {
            'modelId': 'string',
            'modelType': 'ONLINE_FRAUD_INSIGHTS',
            'description': 'string',
            'eventTypeName': 'string',
            'createdTime': 'string',
            'lastUpdatedTime': 'string',
            'arn': 'string'
        },
    ]
}

Response Structure

  • (dict) --

    • nextToken (string) --

      The next page token to be used in subsequent requests.

    • models (list) --

      The array of models.

      • (dict) --

        The model.

        • modelId (string) --

          The model ID.

        • modelType (string) --

          The model type.

        • description (string) --

          The model description.

        • eventTypeName (string) --

          The name of the event type.

        • createdTime (string) --

          Timestamp of when the model was created.

        • lastUpdatedTime (string) --

          Timestamp of last time the model was updated.

        • arn (string) --

          The ARN of the model.

GetOutcomes (updated) Link ¶
Changes (response)
{'outcomes': {'arn': 'string'}}

Gets one or more outcomes. This is a paginated API. If you provide a null maxResults , this actions retrieves a maximum of 100 records per page. If you provide a maxResults , the value must be between 50 and 100. To get the next page results, provide the pagination token from the GetOutcomesResult as part of your request. A null pagination token fetches the records from the beginning.

See also: AWS API Documentation

Request Syntax

client.get_outcomes(
    name='string',
    nextToken='string',
    maxResults=123
)
type name

string

param name

The name of the outcome or outcomes to get.

type nextToken

string

param nextToken

The next page token for the request.

type maxResults

integer

param maxResults

The maximum number of objects to return for the request.

rtype

dict

returns

Response Syntax

{
    'outcomes': [
        {
            'name': 'string',
            'description': 'string',
            'lastUpdatedTime': 'string',
            'createdTime': 'string',
            'arn': 'string'
        },
    ],
    'nextToken': 'string'
}

Response Structure

  • (dict) --

    • outcomes (list) --

      The outcomes.

      • (dict) --

        The outcome.

        • name (string) --

          The outcome name.

        • description (string) --

          The outcome description.

        • lastUpdatedTime (string) --

          The timestamp when the outcome was last updated.

        • createdTime (string) --

          The timestamp when the outcome was created.

        • arn (string) --

          The outcome ARN.

    • nextToken (string) --

      The next page token for subsequent requests.

GetPrediction (updated) Link ¶
Changes (response)
{'modelScores': {'modelVersion': {'arn': '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',
                'arn': '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 model ID.

          • modelType (string) --

            The model type.

          • modelVersionNumber (string) --

            The model version number.

          • arn (string) --

            The model version ARN.

        • 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) --

GetRules (updated) Link ¶
Changes (response)
{'ruleDetails': {'arn': 'string'}}

Get all rules for a detector (paginated) if ruleId and ruleVersion are not specified. Gets all rules for the detector and the ruleId if present (paginated). Gets a specific rule if both the ruleId and the ruleVersion are specified.

This is a paginated API. Providing null maxResults results in retrieving maximum of 100 records per page. If you provide maxResults the value must be between 50 and 100. To get the next page result, a provide a pagination token from GetRulesResult as part of your request. Null pagination token fetches the records from the beginning.

See also: AWS API Documentation

Request Syntax

client.get_rules(
    ruleId='string',
    detectorId='string',
    ruleVersion='string',
    nextToken='string',
    maxResults=123
)
type ruleId

string

param ruleId

The rule ID.

type detectorId

string

param detectorId

[REQUIRED]

The detector ID.

type ruleVersion

string

param ruleVersion

The rule version.

type nextToken

string

param nextToken

The next page token.

type maxResults

integer

param maxResults

The maximum number of rules to return for the request.

rtype

dict

returns

Response Syntax

{
    'ruleDetails': [
        {
            'ruleId': 'string',
            'description': 'string',
            'detectorId': 'string',
            'ruleVersion': 'string',
            'expression': 'string',
            'language': 'DETECTORPL',
            'outcomes': [
                'string',
            ],
            'lastUpdatedTime': 'string',
            'createdTime': 'string',
            'arn': 'string'
        },
    ],
    'nextToken': 'string'
}

Response Structure

  • (dict) --

    • ruleDetails (list) --

      The details of the requested rule.

      • (dict) --

        The details of the rule.

        • ruleId (string) --

          The rule ID.

        • description (string) --

          The rule description.

        • detectorId (string) --

          The detector for which the rule is associated.

        • ruleVersion (string) --

          The rule version.

        • expression (string) --

          The rule expression.

        • language (string) --

          The rule language.

        • outcomes (list) --

          The rule outcomes.

          • (string) --

        • lastUpdatedTime (string) --

          Timestamp of the last time the rule was updated.

        • createdTime (string) --

          The timestamp of when the rule was created.

        • arn (string) --

          The rule ARN.

    • nextToken (string) --

      The next page token to be used in subsequent requests.

GetVariables (updated) Link ¶
Changes (response)
{'variables': {'arn': 'string'}}

Gets all of the variables or the specific variable. This is a paginated API. Providing null maxSizePerPage results in retrieving maximum of 100 records per page. If you provide maxSizePerPage the value must be between 50 and 100. To get the next page result, a provide a pagination token from GetVariablesResult as part of your request. Null pagination token fetches the records from the beginning.

See also: AWS API Documentation

Request Syntax

client.get_variables(
    name='string',
    nextToken='string',
    maxResults=123
)
type name

string

param name

The name of the variable.

type nextToken

string

param nextToken

The next page token of the get variable request.

type maxResults

integer

param maxResults

The max size per page determined for the get variable request.

rtype

dict

returns

Response Syntax

{
    'variables': [
        {
            'name': 'string',
            'dataType': 'STRING'|'INTEGER'|'FLOAT'|'BOOLEAN',
            'dataSource': 'EVENT'|'MODEL_SCORE'|'EXTERNAL_MODEL_SCORE',
            'defaultValue': 'string',
            'description': 'string',
            'variableType': 'string',
            'lastUpdatedTime': 'string',
            'createdTime': 'string',
            'arn': 'string'
        },
    ],
    'nextToken': 'string'
}

Response Structure

  • (dict) --

    • variables (list) --

      The names of the variables returned.

      • (dict) --

        The variable.

        • name (string) --

          The name of the variable.

        • dataType (string) --

          The data type of the variable.

        • dataSource (string) --

          The data source of the variable.

        • defaultValue (string) --

          The default value of the variable.

        • description (string) --

          The description of the variable.

        • variableType (string) --

          The variable type of the variable.

          Valid Values: AUTH_CODE | AVS | BILLING_ADDRESS_L1 | BILLING_ADDRESS_L2 | BILLING_CITY | BILLING_COUNTRY | BILLING_NAME | BILLING_PHONE | BILLING_STATE | BILLING_ZIP | CARD_BIN | CATEGORICAL | CURRENCY_CODE | EMAIL_ADDRESS | FINGERPRINT | FRAUD_LABEL | FREE_FORM_TEXT | IP_ADDRESS | NUMERIC | ORDER_ID | PAYMENT_TYPE | PHONE_NUMBER | PRICE | PRODUCT_CATEGORY | SHIPPING_ADDRESS_L1 | SHIPPING_ADDRESS_L2 | SHIPPING_CITY | SHIPPING_COUNTRY | SHIPPING_NAME | SHIPPING_PHONE | SHIPPING_STATE | SHIPPING_ZIP | USERAGENT | SHIPPING_ZIP | USERAGENT

        • lastUpdatedTime (string) --

          The time when variable was last updated.

        • createdTime (string) --

          The time when the variable was created.

        • arn (string) --

          The ARN of the variable.

    • nextToken (string) --

      The next page token to be used in subsequent requests.

PutDetector (updated) Link ¶
Changes (request)
{'eventTypeName': 'string', 'tags': [{'key': 'string', 'value': 'string'}]}

Creates or updates a detector.

See also: AWS API Documentation

Request Syntax

client.put_detector(
    detectorId='string',
    description='string',
    eventTypeName='string',
    tags=[
        {
            'key': 'string',
            'value': 'string'
        },
    ]
)
type detectorId

string

param detectorId

[REQUIRED]

The detector ID.

type description

string

param description

The description of the detector.

type eventTypeName

string

param eventTypeName

[REQUIRED]

The name of the event type.

type tags

list

param tags

A collection of key and value pairs.

  • (dict) --

    A key and value pair.

    • key (string) -- [REQUIRED]

      A tag key.

    • value (string) -- [REQUIRED]

      A value assigned to a tag key.

rtype

dict

returns

Response Syntax

{}

Response Structure

  • (dict) --

PutExternalModel (updated) Link ¶
Changes (request)
{'eventTypeName': 'string',
 'inputConfiguration': {'useEventVariables': 'boolean'},
 'tags': [{'key': 'string', 'value': 'string'}]}

Creates or updates an Amazon SageMaker model endpoint. You can also use this action to update the configuration of the model endpoint, including the IAM role and/or the mapped variables.

See also: AWS API Documentation

Request Syntax

client.put_external_model(
    modelEndpoint='string',
    eventTypeName='string',
    modelSource='SAGEMAKER',
    role={
        'arn': 'string',
        'name': 'string'
    },
    inputConfiguration={
        'format': 'TEXT_CSV'|'APPLICATION_JSON',
        'useEventVariables': True|False,
        'jsonInputTemplate': 'string',
        'csvInputTemplate': 'string'
    },
    outputConfiguration={
        'format': 'TEXT_CSV'|'APPLICATION_JSONLINES',
        'jsonKeyToVariableMap': {
            'string': 'string'
        },
        'csvIndexToVariableMap': {
            'string': 'string'
        }
    },
    modelEndpointStatus='ASSOCIATED'|'DISSOCIATED',
    tags=[
        {
            'key': 'string',
            'value': 'string'
        },
    ]
)
type modelEndpoint

string

param modelEndpoint

[REQUIRED]

The model endpoints name.

type eventTypeName

string

param eventTypeName

The event type name.

type modelSource

string

param modelSource

[REQUIRED]

The source of the model.

type role

dict

param role

[REQUIRED]

The IAM role used to invoke the model endpoint.

  • arn (string) -- [REQUIRED]

    The role ARN.

  • name (string) -- [REQUIRED]

    The role name.

type inputConfiguration

dict

param inputConfiguration

[REQUIRED]

The model endpoint input configuration.

  • format (string) --

    The format of the model input configuration. The format differs depending on if it is passed through to SageMaker or constructed by Amazon Fraud Detector.

  • useEventVariables (boolean) -- [REQUIRED]

    The event variables.

  • jsonInputTemplate (string) --

    Template for constructing the JSON input-data sent to SageMaker. At event-evaluation, the placeholders for variable names in the template will be replaced with the variable values before being sent to SageMaker.

  • csvInputTemplate (string) --

    Template for constructing the CSV input-data sent to SageMaker. At event-evaluation, the placeholders for variable-names in the template will be replaced with the variable values before being sent to SageMaker.

type outputConfiguration

dict

param outputConfiguration

[REQUIRED]

The model endpoint output configuration.

  • format (string) -- [REQUIRED]

    The format of the model output configuration.

  • jsonKeyToVariableMap (dict) --

    A map of JSON keys in response from SageMaker to the Amazon Fraud Detector variables.

    • (string) --

      • (string) --

  • csvIndexToVariableMap (dict) --

    A map of CSV index values in the SageMaker response to the Amazon Fraud Detector variables.

    • (string) --

      • (string) --

type modelEndpointStatus

string

param modelEndpointStatus

[REQUIRED]

The model endpoint’s status in Amazon Fraud Detector.

type tags

list

param tags

A collection of key and value pairs.

  • (dict) --

    A key and value pair.

    • key (string) -- [REQUIRED]

      A tag key.

    • value (string) -- [REQUIRED]

      A value assigned to a tag key.

rtype

dict

returns

Response Syntax

{}

Response Structure

  • (dict) --

PutOutcome (updated) Link ¶
Changes (request)
{'tags': [{'key': 'string', 'value': 'string'}]}

Creates or updates an outcome.

See also: AWS API Documentation

Request Syntax

client.put_outcome(
    name='string',
    description='string',
    tags=[
        {
            'key': 'string',
            'value': 'string'
        },
    ]
)
type name

string

param name

[REQUIRED]

The name of the outcome.

type description

string

param description

The outcome description.

type tags

list

param tags

A collection of key and value pairs.

  • (dict) --

    A key and value pair.

    • key (string) -- [REQUIRED]

      A tag key.

    • value (string) -- [REQUIRED]

      A value assigned to a tag key.

rtype

dict

returns

Response Syntax

{}

Response Structure

  • (dict) --

UpdateDetectorVersion (updated) Link ¶
Changes (request)
{'modelVersions': {'arn': 'string'}}

Updates a detector version. The detector version attributes that you can update include models, external model endpoints, rules, rule execution mode, 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',
            'arn': '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 model ID.

    • modelType (string) -- [REQUIRED]

      The model type.

    • modelVersionNumber (string) -- [REQUIRED]

      The model version number.

    • arn (string) --

      The model version ARN.

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) --

UpdateModelVersion (updated) Link ¶
Changes (request, response)
Request
{'externalEventsDetail': {'dataAccessRoleArn': 'string',
                          'dataLocation': 'string'},
 'majorVersionNumber': 'string',
 'tags': [{'key': 'string', 'value': 'string'}]}
Response
{'modelId': 'string',
 'modelType': 'ONLINE_FRAUD_INSIGHTS',
 'modelVersionNumber': 'string',
 'status': 'string'}

Updates a model version. Updating a model version retrains an existing model version using updated training data and produces a new minor version of the model. You can update the training data set location and data access role attributes using this action. This action creates and trains a new minor version of the model, for example version 1.01, 1.02, 1.03.

See also: AWS API Documentation

Request Syntax

client.update_model_version(
    modelId='string',
    modelType='ONLINE_FRAUD_INSIGHTS',
    majorVersionNumber='string',
    externalEventsDetail={
        'dataLocation': 'string',
        'dataAccessRoleArn': 'string'
    },
    tags=[
        {
            'key': 'string',
            'value': 'string'
        },
    ]
)
type modelId

string

param modelId

[REQUIRED]

The model ID.

type modelType

string

param modelType

[REQUIRED]

The model type.

type majorVersionNumber

string

param majorVersionNumber

[REQUIRED]

The major version number.

type externalEventsDetail

dict

param externalEventsDetail

The event details.

  • dataLocation (string) -- [REQUIRED]

    The Amazon S3 bucket location for the data.

  • dataAccessRoleArn (string) -- [REQUIRED]

    The ARN of the role that provides Amazon Fraud Detector access to the data location.

type tags

list

param tags

A collection of key and value pairs.

  • (dict) --

    A key and value pair.

    • key (string) -- [REQUIRED]

      A tag key.

    • value (string) -- [REQUIRED]

      A value assigned to a tag key.

rtype

dict

returns

Response Syntax

{
    'modelId': 'string',
    'modelType': 'ONLINE_FRAUD_INSIGHTS',
    'modelVersionNumber': 'string',
    'status': 'string'
}

Response Structure

  • (dict) --

    • modelId (string) --

      The model ID.

    • modelType (string) --

      The model type.

    • modelVersionNumber (string) --

      The model version number of the model version updated.

    • status (string) --

      The status of the updated model version.

UpdateRuleVersion (updated) Link ¶
Changes (request)
{'tags': [{'key': 'string', 'value': 'string'}]}

Updates a rule version resulting in a new rule version. Updates a rule version resulting in a new rule version (version 1, 2, 3 ...).

See also: AWS API Documentation

Request Syntax

client.update_rule_version(
    rule={
        'detectorId': 'string',
        'ruleId': 'string',
        'ruleVersion': 'string'
    },
    description='string',
    expression='string',
    language='DETECTORPL',
    outcomes=[
        'string',
    ],
    tags=[
        {
            'key': 'string',
            'value': 'string'
        },
    ]
)
type rule

dict

param rule

[REQUIRED]

The rule to update.

  • 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 description.

type expression

string

param expression

[REQUIRED]

The rule expression.

type language

string

param language

[REQUIRED]

The language.

type outcomes

list

param outcomes

[REQUIRED]

The outcomes.

  • (string) --

type tags

list

param tags

The tags to assign to the rule version.

  • (dict) --

    A key and value pair.

    • key (string) -- [REQUIRED]

      A tag key.

    • value (string) -- [REQUIRED]

      A value assigned to a tag key.

rtype

dict

returns

Response Syntax

{
    'rule': {
        'detectorId': 'string',
        'ruleId': 'string',
        'ruleVersion': 'string'
    }
}

Response Structure

  • (dict) --

    • rule (dict) --

      The new rule version that was created.

      • detectorId (string) --

        The detector for which the rule is associated.

      • ruleId (string) --

        The rule ID.

      • ruleVersion (string) --

        The rule version.