Skip to content

Commit

Permalink
TCI
Browse files Browse the repository at this point in the history
  • Loading branch information
TheColdIce committed Sep 2, 2024
1 parent f18c4d4 commit eb5eebc
Show file tree
Hide file tree
Showing 29 changed files with 347,721 additions and 348,819 deletions.
3 changes: 3 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
__pycache__
*.pyc
.vscode
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
datasets
__pycache__
*.pyc
.vscode
.venv
.venv
8 changes: 7 additions & 1 deletion AMLsim/paramFiles/10K_accts/alertPatterns.csv
Original file line number Diff line number Diff line change
@@ -1,2 +1,8 @@
count,type,schedule_id,min_accounts,max_accounts,min_amount,max_amount,min_period,max_period,bank_id,is_sar,source_type
50,stack,2,10,20,100,1000,1,28,bank,True,CASH
1,fan_out,2,5,5,100,1000,2,28,bank,True,TRANSFER
1,fan_in,2,5,5,100,1000,2,28,bank,True,TRANSFER
1,cycle,2,5,5,100,1000,2,28,bank,True,TRANSFER
1,bipartite,2,5,5,100,1000,2,28,bank,True,TRANSFER
1,stack,2,5,5,100,1000,2,28,bank,True,TRANSFER
1,gather_scatter,2,6,6,100,1000,2,28,bank,True,TRANSFER
1,scatter_gather,2,6,6,100,1000,2,28,bank,True,TRANSFER
14 changes: 7 additions & 7 deletions AMLsim/paramFiles/10K_accts/conf.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"max_amount": 150000,
"mean_amount": 637,
"std_amount": 300,
"mean_amount_sar": 643,
"mean_amount_sar": 637,
"std_amount_sar": 300,
"prob_income": 0.0,
"mean_income": 0.0,
Expand All @@ -21,18 +21,18 @@
"std_outcome": 100.0,
"mean_outcome_sar": 500.0,
"std_outcome_sar": 100.0,
"prob_spend_cash": 0.15,
"prob_spend_cash": 0.0,
"n_steps_balance_history": 7,
"mean_phone_change_frequency": 1460,
"std_phone_change_frequency": 365,
"mean_phone_change_frequency_sar": 1330,
"std_phone_change_frequency_sar": 543,
"mean_phone_change_frequency_sar": 1460,
"std_phone_change_frequency_sar": 365,
"mean_bank_change_frequency": 1460,
"std_bank_change_frequency": 365,
"mean_bank_change_frequency_sar": 1414,
"std_bank_change_frequency_sar": 541,
"mean_bank_change_frequency_sar": 1460,
"std_bank_change_frequency_sar": 365,
"margin_ratio": 0.1,
"prob_participate_in_multiple_sars": 0.06
"prob_participate_in_multiple_sars": 0.0
},
"input": {
"directory": "paramFiles/10K_accts",
Expand Down
240 changes: 120 additions & 120 deletions AMLsim/paramFiles/10K_accts/degree.csv
Original file line number Diff line number Diff line change
@@ -1,142 +1,142 @@
Count,In-degree,Out-degree
1427,0,2
453,0,3
108,0,4
27,0,5
14,0,6
7,0,7
1,0,8
4,0,9
1,0,11
1389,0,2
508,0,3
95,0,4
31,0,5
13,0,6
10,0,7
2,0,8
2,0,9
2,0,10
2,0,11
2,0,13
1,0,25
13,1,0
2740,1,1
956,1,2
198,1,3
69,1,4
36,1,5
18,1,6
7,1,7
1,1,8
3,1,9
2,1,10
1,1,22
1,1,37
1423,2,0
949,2,1
185,2,2
61,2,3
34,2,4
17,2,5
3,2,6
1,0,14
50,1,0
2802,1,1
959,1,2
215,1,3
67,1,4
30,1,5
15,1,6
9,1,7
9,1,8
1,1,9
1,1,10
1,1,11
1,1,24
1,1,29
1,1,30
1347,2,0
902,2,1
200,2,2
65,2,3
35,2,4
18,2,5
5,2,6
6,2,7
1,2,8
1,2,9
2,2,10
1,2,12
1,2,11
1,2,13
1,2,14
1,2,21
443,3,0
185,3,1
2,2,14
1,2,16
420,3,0
191,3,1
63,3,2
29,3,3
16,3,4
4,3,5
1,3,6
2,3,7
1,3,8
2,3,9
1,3,10
1,3,12
1,3,13
1,3,17
102,4,0
72,4,1
26,4,2
10,4,3
9,4,4
6,4,5
12,3,4
6,3,5
4,3,6
5,3,8
1,3,9
104,4,0
65,4,1
31,4,2
11,4,3
6,4,4
4,4,5
2,4,6
5,4,7
1,4,9
2,4,7
2,4,10
1,4,13
1,4,14
1,4,18
36,5,0
28,5,1
9,5,2
5,5,3
5,5,4
1,5,5
1,5,6
2,5,10
2,5,13
13,6,0
15,6,1
7,6,2
7,6,3
32,5,1
11,5,2
6,5,3
4,5,4
4,5,5
2,5,6
3,5,7
1,5,9
1,5,11
1,5,17
12,6,0
16,6,1
6,6,2
4,6,3
2,6,4
1,6,5
1,6,6
1,6,7
2,6,8
1,6,9
2,6,10
1,6,17
4,7,0
6,7,1
1,6,10
1,6,28
3,7,0
1,7,1
5,7,2
2,7,3
2,7,5
1,7,8
1,7,10
1,7,27
4,8,0
5,8,1
3,8,2
2,8,3
2,8,5
2,8,8
1,8,11
4,9,0
3,9,1
2,9,2
2,9,3
1,7,3
1,7,4
1,7,5
2,7,9
1,7,11
1,7,16
6,8,0
1,8,1
4,8,2
3,8,3
1,8,4
1,8,5
1,8,8
1,8,15
3,9,0
2,9,1
3,9,2
1,9,3
1,9,4
1,9,5
2,9,6
1,9,11
1,9,14
1,9,16
2,10,0
4,10,1
1,10,2
2,10,4
1,10,7
1,11,0
3,11,1
1,10,1
3,10,2
1,10,13
1,11,2
1,11,3
1,11,6
1,11,11
1,12,6
1,12,8
3,11,3
2,12,1
1,12,4
1,13,1
1,13,14
1,14,2
2,15,1
1,15,11
1,13,2
2,13,3
1,14,4
1,14,5
1,14,9
1,15,2
1,15,12
1,16,1
1,16,4
1,16,57
1,17,1
1,18,1
1,18,4
1,18,5
1,20,10
1,21,2
1,23,8
1,23,99
1,24,21
1,16,29
1,18,0
1,18,8
1,19,0
1,25,0
1,29,12
1,48,12
1,64,150
1,74,67
1,104,64
1,142,11
1,25,13
1,30,30
1,31,10
1,53,69
1,73,0
1,83,58
1,129,24
1,144,24
1,212,2
25 changes: 17 additions & 8 deletions AMLsim/scripts/transaction_graph_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -1229,13 +1229,19 @@ def add_edge(_orig, _bene, _amount, _date):
n_origs = random.randint(1, len(members) - 1)
origs = members[:n_origs]
benes = members[n_origs:]
for orig, bene in zip(origs, benes):
scatter_amount = RandomAmount(min_amount, max_amount).getAmount()
scatter_date = random.randrange(start_date, end_date)
add_edge(orig, mid_acct, scatter_amount, scatter_date)
gather_amount = scatter_amount - scatter_amount * self.margin_ratio
gather_date = random.randrange(scatter_date, end_date)
add_edge(mid_acct, bene, gather_amount, gather_date)
sum_gather = 0.0
last_gather_date = 0
for orig in origs:
gather_amount = RandomAmount(min_amount, max_amount).getAmount()
sum_gather += gather_amount
gather_date = random.randrange(start_date, end_date)
add_edge(orig, mid_acct, gather_amount, gather_date)
last_gather_date = max(last_gather_date, gather_date)
sum_gather *= self.margin_ratio
scatter_amount = sum_gather / len(benes)
for bene in benes:
scatter_date = random.randrange(last_gather_date, end_date)
add_edge(mid_acct, bene, scatter_amount, scatter_date)

# TODO: User-defined typology implementations goes here

Expand Down Expand Up @@ -1320,7 +1326,10 @@ def get_out_edge_attrs(g, vid, name):
for n in sub_g.nodes(): # go over all nodes in the subgraph
is_main = "true" if n == main_id else "false"
is_sar = "true" if sub_g.graph[IS_SAR_KEY] else "false"
min_amt = '{:.2f}'.format(min(get_out_edge_attrs(sub_g, n, "amount")))
try:
min_amt = '{:.2f}'.format(min(get_out_edge_attrs(sub_g, n, "amount")))
except:
pass
max_amt = '{:.2f}'.format(max(get_out_edge_attrs(sub_g, n, "amount")))
min_step = start
max_step = end
Expand Down
Loading

0 comments on commit eb5eebc

Please sign in to comment.