Skip to content

Quick Introduction to AMLSim

hkanezashi edited this page Nov 25, 2019 · 8 revisions

Here is a quick introduction on how you can run a series of processes in AMLSim. To understand each process in more details, you can check out pages for all the relevant components including transaction network generator,


Here is a minimum example to generate transaction CSV files from sample parameter files.

cd /path/to/AMLSim  # Go to the AMLSim working directory
python3 scripts/transaction_graph_generator.py conf.json  # Transaction network generator
sh scripts/run_AMLSim.sh conf.json    # Transaction simulator
python3 scripts/convert_logs.py conf.json  # Transaction log converter

Transaction Network Generator (Python)

Python package requirements

  • Python 3.7 (You can install the following packages with pip3 install -r requirements.txt)
    • NumPy
    • networkx 1.11 (2.x is not supported because of performance issues)
    • matplotlib
    • powerlaw
    • python-dateutil

Launch the Python script

python scripts/transaction_graph_generator.py conf.json

Input files

Please find the following files under paramFiles directory

  • accounts.csv
    • Account parameter file
  • alertPatterns.csv
    • Alert (SAR) typology (transaction pattern) parameter file
  • degree.csv
    • Degree distribution parameter file
  • transactionType.csv
    • Transaction distribution parameter file
  • schema.json
    • Schema definition file for output CSV files

Configuration file (These above directory and file names are defined at the input section in this JSON file)

  • conf.json

Transaction Simulator (Java)

Dependencies

Copy all jar files of the following libraries to just under jars directory except paysim.jar.

  • MASON version 18
    • Download "mason18.zip" from the homepage and extract the jar file.
  • PaySim
    • Please use paysim.jar under jars directory which already exists.
  • Commons-Math version 3.6.1
    • Download "commons-math3-3.6.1-bin.tar.gz" and extract the following jar files.
      • commons-math3-3.6.1.jar
      • commons-math3-3.6.1-tests.jar
      • commons-math3-3.6.1-tools.jar
  • JSON in Java version 20180813
    • The latest jar file is available from here
  • WebGraph version 3.6.1
    • Please download "binary tarball" from the homepage and extract the jar file.
    • It is convenient to download "dependencies tarball" for the following dependencies.
  • MySQL Connector for Java version 5.1

Build and launch AMLSim

Please run the first script to compile Java files if you did not yet.

sh scripts/build_AMLSim.sh  # Compile AMLSim Java files
sh scripts/run_AMLSim.sh conf.json  # Launch an AMLSim Java application

Transaction log converter

It converts generated transaction files into input files of GPML.

python3 scripts/convert_logs.py conf.json

Visualize a transaction subgraph of the specified alert

python3 scripts/visualize/plot_distributions.py [ConfJSON]
  • ConfJSON: Configuration JSON file

Load transaction graph edge list and case account file list to JanusGraph

  1. First, please copy transaction tx.csv and case account ID list case_accts.csv files from the sample data directory to the output directory.
    cp /path/to/sample/1K/*.csv outputs/
  2. Launch JanusGraph server
    cd /path/to/janusgraph-0.1.1-hadoop2/
    ./bin/janusgraph.sh start
  3. Launch Groovy script to load transaction graph edge list and case account file list.
    cd /path/to/AMLSim
    /path/to/janusgraph-0.1.1-hadoop2/bin/gremlin.sh scripts/janusgraph/load_transaction_janusgraph.groovy
  4. Then, run graph analytics on the JanusGraph.
    cd /path/to/janusgraph/scripts
    /path/to/janusgraph-0.1.1-hadoop2/bin/gremlin.sh egonet/ego_test.groovy

Remove all log and image files from outputs directory

With running the below script, all files in the output directory except README.md files will be deleted.

sh scripts/clean_logs.sh