Skip to content

Quick Introduction to AMLSim

Hiroki Kanezashi edited this page Jul 10, 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,

Transaction Network Generator (Python)

Package requirements

  • NetworkX 1.10 (2.0 or later will not work)

Launch the Python script

python scripts/transaction_graph_generator.py [PropFile] [DegreeFile] [TransactionTypeFile]
  • PropFile: Configuration file path (prop.ini) of the transaction graph generator
  • DegreeFile: Degree distribution parameter file
  • TransactionTypeFile: Transaction type parameter file

Example:

python scripts/transaction_relationship_generator.py prop.ini paramFiles/deg1K.csv paramFiles/tx_type.csv

Input files

See CSV files under paramFiles directory

  • accounts.csv
    • Account parameter file
  • aletPatterns.csv
    • Alert (fraud) transaction pattern parameter file
  • degree.csv
    • Degree distribution parameter file
  • transactionType.csv
    • Transaction distribution parameter file

Property file

  • prop.ini

Transaction Simulator (Java)

Dependencies

Put all jar files of the following libraries to jars directory.

git clone https://github.com/EdgarLopezPhD/PaySim.git
cd PaySim
git checkout 62a29b77c28bd03e717a67c8ab975c671ba0080d
mkdir bin jars
cp /path/to/commons-math-3-3.6.1*.jar /path/to/mason.18.jar jars/
javac -d bin -cp "jars/*" src/paysim/*.java
cd bin
jar cf paysim.jar paysim

Input data files

All output files of the Python script

  • accounts.csv
  • transactions.csv
  • alertPatterns.csv

Java property file

  • amlsim.properties

Build and launch AMLSim

Commands

sh scripts/build_AMLSim.sh
sh scripts/run_AMLSim.sh [SimulationName] [Steps]
  • SimulationName: Simulation name
  • Steps: Number of steps per simulation

Example:

sh scripts/run_AMLSim.sh sample 150

Example: generate transaction CSV files from small sample parameter files

cd /path/to/AMLSim
python scripts/transaction_relationship_generator.py prop.ini paramFiles/1K/degree.csv paramFiles/transactionType.csv
sh scripts/run_AMLSim.sh sample 150

Visualize a transaction subgraph of the specified alert

python scripts/visualize/plot_transaction_graph.py [TransactionLog] [AlertID]
  • TransactionLog: Log CSV file path from AMLSim (e.g. outputs/sample/sample_log.csv)
  • AlertID: An alert ID to be visualized

Convert Transaction Log into GPML Input Files

python scripts/convert_logs.py [ConfFile] [TransactionLog]
  • ConfFile: Configuration ini file for the data conversion (convert.ini)
  • TransactionLog: Transaction log CSV file under outputs/(name)/ (e.g. outputs/sample/sample_log.csv)

Example:

python scripts/convert_logs.py convert.ini outputs/sample/sample_log.csv

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

sh scripts/clean_logs.sh

Clone this wiki locally