Transaction Model: Create a New Model (Tutorial) - IBM/AMLSim GitHub Wiki
How to create a new AML typology (alert transaction model)
1. Edit a Python script
First, you need to add a function to transaction_graph_generator.py to register a new AML typology.
1.1. Add process codes to generate alert transactions
Add process codes to add_alert_pattern function.
For example, the fan_in pattern is defined as follows:
if typology_name == "fan_in": # fan_in pattern (multiple accounts --> single (main) account)
main_acct, main_bank_id = add_main_acct()
num_neighbors = num_accounts - 1
if is_external:
sub_bank_candidates = [b for b, nbs in self.bank_to_accts.items()
if b != main_bank_id and len(nbs) >= num_neighbors]
if not sub_bank_candidates:
logger.warning("No banks with appropriate number of neighboring accounts found.")
return
sub_bank_id = random.choice(sub_bank_candidates)
else:
sub_bank_id = main_bank_id
sub_accts = random.sample(self.bank_to_accts[sub_bank_id], num_neighbors)
for n in sub_accts:
self.remove_typology_candidate(n)
add_node(n, sub_bank_id)
for orig in sub_accts:
amount = init_amount
date = random.randrange(start_date, end_date)
add_edge(orig, main_acct, amount, date)
2. Create a new Java class
Next, create a Java class extends amlsim.model.aml.AMLTypology.