Skip to main content

Predict fraud on new events from a stream

PAT

info
  • Follow the steps mentioned below.
  • Total time taken for this task: 10 Minutes.
  • Pre-requisites: Fraud detection model is built, and input dataset has data from a stream.

Tidbits

  • AWS Fraud Detection service is not natively supported by Amorphic.
  • We are going to run an existing Amorphic job which has all the necessary permissions to access AWS Fraud Detector.
  • Do not try creating a new Amorphic job. You will run into access issues.

Create an output dataset

  • Click on 'DATASETS' --> 'Datasets' from left navigation-bar.
  • Click on ➕ icon at the top right corner.
  • Enter the following information and click on 'Register'.
{
"Dataset Name": "fraud_detection_results_<your_userid>"
"Description": "This dataset is output from fraud detection use-case."
"Domain": "workshop(workshop)"
"Data Classifications":
"Keywords": "S3"
"Connection Type": "API (default)"
"File Type": "csv"
"Target Location": "S3"
"Update Method": "Append"
"Enable Malware Detection": "No"
"Enable AI Services": "No"
"Enable Data Cleanup": "No"
}

Configure Amorphic Job

  • Click on 'ETL' --> 'Jobs' from left navigation-bar.
  • You will see a job finace_fraud_detector.
  • Click on 'View Details'.
  • Click on ✏️ icon at top right corner to edit the job details.
  • Click on 'Datasets, Parameters & Libraries' tab.
  • Do not remove existing datasets.
  • Add fraud_detection_results_<your_userid> to 'Datasets Write Access'.
  • Add stream_2_s3_fraud_detection_<your_userid> to 'Datasets Read Access'.
    • Note: If you were not able to add data to stream_2_s3_fraud_detection_<your_userid>, use stream_2_s3_fraud_detection_ankamv dataset.
  • Click on 'Update Linked Entities'.

Open Job

Update Code and run job

  • Click on 'Edit Script' icon at top right corner.
  • Toggle 'Read mode on' switch.
  • Change username. Replace username in input_ds, output_ds, ENTITY_TYPE, EVENT_TYPE, MODEL_NAME, DETECTOR_NAME, DETECTOR_VER variables as shown below.
    • Note: You may download the backup code finace_fraud_detector.py from fraud_detection_resources dataset.

Open Job

  • Click on 'Save & Exit'.
  • Click on ▶️ icon at the top right corner to run job. Click on Submit.
  • Click on 'Executions' tab.
  • Click the 🔄 icon to refresh the status. It finishes in approximately 4 minutes.

Check output

  • Once the job is finished, status will turn from 🟠 to ✔️.
  • Go to the Amorphic Dataset: fraud_detection_results_<your_userid>. Use the navigator to quickly go to the Dataset page. Press ctrl two times successively and type the dataset name fraud_detection_results_<your_userid>.
  • Click on the files tab.
  • Click on three dots ⋮ in front of the file to download it.
  • Verify the last four columns of the output.

Open Job



Congratulations!!!
  • You have successfully predicted the finance near real-time events.
  • You may add the prediction job to the scheduler to run every six minutes for automation.