Python SDK for Amazon Fraud Detector
Project description
Amazon Fraud Detector Python SDK
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
- Instantiate a Fraud Detector instance
- Profiling data
- Train a model
- Create a detector and activate it
- Deploy a detector
- Get predictions from a detector
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
- Clone this repository or download the
example/frauddetector_sdk_example.ipynb
file from the repository along with the sample data - Ensure that an AWS session is authorised with access to an AWS cloud account with Amazon Fraud Detector privileges
- 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.
- Run the example Create a Notebook Instance in SageMaker.
- 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": "*"
}
]
}
- 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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file frauddetector-0.2.0.tar.gz
.
File metadata
- Download URL: frauddetector-0.2.0.tar.gz
- Upload date:
- Size: 19.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.7.1 importlib_metadata/4.6.1 pkginfo/1.8.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.7.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | bed448f4e9415651aa7c84f7532c23d658dd6a19e043324e1dcd93a317430df4 |
|
MD5 | b89be35f0350ec3858813774172675ca |
|
BLAKE2b-256 | 0bd651e0824416a9981fa16c4bebb0f868e4134bca276ce0ee7ade6cd55f844d |
File details
Details for the file frauddetector-0.2.0-py3-none-any.whl
.
File metadata
- Download URL: frauddetector-0.2.0-py3-none-any.whl
- Upload date:
- Size: 19.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.7.1 importlib_metadata/4.6.1 pkginfo/1.8.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.7.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a6538557dc3c86c3bb5eb765eef1c1196b81672d1a741896f2630b6cc06e9f67 |
|
MD5 | 3760d278d46c7a4f18f5cf3778802c81 |
|
BLAKE2b-256 | e29c27d0e36616a5d2a7aea03411713107ea40412c643f0e1123857cbf5a5946 |