Skip to main content

Python SDK for Amazon Fraud Detector

Project description

Amazon Fraud Detector Python SDK

product_image

Table of Contents

Overview

The Amazon Fraud Detector Python SDK is an open-source library that allows data scientists and software developers to easily build, train and deploy fraud detection models using Amazon Fraud Detector. The primary function of this utility is to simplify using the Amazon Fraud Detector product in a Python environment.

This SDK packages up the underlying API and provides a simple interface to

  • Configure
  • Train
  • Activate
  • Deploy
  • Predict

An instance of a FraudDector() class can be used to manage the configuration and operations lifecycle of a Fraud Detector. This manages associating rules, outcomes, event-types, labels and variables with a single detector.

This SDK also includes a Profiler() class that profiles a sample of training data to derive the correct input format for initialising a FraudDetector instance. This simplifies the usage the underlying fraud detection service by deriving a schema of variable and label definitions from the raw data sample.

It is not necessary to perform tasks such as feature engineering, model selection or hyperparameter tuning as this is managed automatically by the Amazon Fraud Detector service.

Installation

The Amazon Fraud Detector Python SDK is available on PyPI and can be installed with pip as follows:

pip install frauddetector

Alternatively, you can install from source by cloning this repository and running a pip install command in the root directory of the repository:

git clone https://github.com/aws/amazon-fraud-detector-python-sdk.git
cd amazon-fraud-detector-python-sdk
pip install .

Supported Operating Systems

The Amazon Fraud Detector Python SDK supports Unix/Linux and Mac.

Supported Python Versions

The Amazon Fraud Detector Python SDK is tested on:

  • Python 3.7

Documentation

Sample Notebooks

The Jupyter notebook

  • example/frauddetector_sdk_example.ipynb

provides an example of how to quickly create a running fraud detector using the Amazon Fraud Detector Python SDK. This notebook can either be run locally with access to an AWS cloud service configured in advance, or it can be run from within an Amazon SageMaker environment.

Sample data is also provided in the file

  • example/training_data/registration_data_20K_minimum.csv.zip

This can be used as a training and test resource for familiarisation with the SDK.

Running notebooks locally

  1. Clone this repository or download the example/frauddetector_sdk_example.ipynb file from the repository along with the sample data
  2. Ensure that an AWS session is authorised with access to an AWS cloud account with Amazon Fraud Detector privileges
  3. Start a Jupyter notebook session and run the examples in the notebook.

Running notebooks in SageMaker

In Amazon SageMaker, upload the Jupyter notebook from the example/ folder of this repository.

  1. Run the example Create a Notebook Instance in SageMaker.
  2. Add an inline policy to your Amazon SageMaker role in IAM with the following JSON structure
{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Effect": "Allow",
            "Action": [
                frauddetector:*"
            ],
            "Resource": "*"
        }
    ]
}
  1. Upload the Jupyter notebook and the CSV file from example/ folder.

Permissions

As a managed service, Amazon Fraud Detector performs operations on your behalf on AWS hardware that is managed by Amazon Fraud Detector. Amazon Fraud Detector can perform only operations that the user permits. You can read more about which permissions are necessary in the Amazon Fraud Detector Documentation.

The Amazon Fraud Detector Python SDK should not require any additional permissions aside from what is required for using boto3. However, if you are using an IAM role with a path in it, you should grant permission for iam:GetRole.

Security

See https://github.com/aws-samples/amazon-fraud-detector-python-sdk/blob/main/CONTRIBUTING.md#security-issue-notifications for more information.

Contributing

If you wish to contribute to the project, please see the Contribution Guidelines.

License

Amazon Fraud Detector Python SDK is licensed under the Apache 2.0 License. It is copyright 2021 Amazon.com, Inc. or its affiliates. All Rights Reserved. The license is available at: http://aws.amazon.com/apache2.0/

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

frauddetector-0.1.0.tar.gz (18.0 kB view hashes)

Uploaded Source

Built Distribution

frauddetector-0.1.0-py3-none-any.whl (17.8 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page