Skip to content

Commit

Permalink
Revert "Merge branch 'Tomas' of https://github.com/aidotse/flib into …
Browse files Browse the repository at this point in the history
…Tomas"

This reverts commit 394efab, reversing
changes made to 2a03ad4.
  • Loading branch information
agnesrosendal committed Feb 27, 2024
1 parent 394efab commit 100b419
Show file tree
Hide file tree
Showing 44 changed files with 64 additions and 4,831 deletions.
22 changes: 11 additions & 11 deletions AMLsim/paramFiles/simulation1/accounts.csv
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
count,min_balance,max_balance,country,business_type,bank_id
2768,10000,20000,SWE,I,swedbank
1347,5000,10000,SWE,I,swedbank
371,5000,10000,SWE,I,swedbank
2694,5000,10000,SWE,I,swedbank
104,5000,10000,SWE,I,swedbank
458,5000,10000,SWE,I,swedbank
748,5000,10000,SWE,I,swedbank
362,5000,10000,SWE,I,swedbank
23,5000,10000,SWE,I,swedbank
224,5000,10000,SWE,I,swedbank
625,5000,10000,SWE,I,swedbank
276,5000,10000,SWE,I,swedbank
1347,5000,10000,SWE,I,handelsbanken
371,5000,10000,SWE,I,seb
2694,5000,10000,SWE,I,nordea
104,5000,10000,SWE,I,danske
458,5000,10000,SWE,I,länsförsäkringar
748,5000,10000,SWE,I,ica
362,5000,10000,SWE,I,sparbanken
23,5000,10000,SWE,I,ålandsbanken
224,5000,10000,SWE,I,marginalen
625,5000,10000,SWE,I,svea
276,5000,10000,SWE,I,skandia
3 changes: 1 addition & 2 deletions AMLsim/scripts/generate_scalefree.py
Original file line number Diff line number Diff line change
Expand Up @@ -247,9 +247,8 @@ def powerlaw_degree_distrubution(n, gamma=2.0, loc=1.0, scale=1.0):
n = 10000
gamma = 2.0
loc = 1.0
scale = 1.0

values, counts = powerlaw_degree_distrubution(n, gamma, loc, scale)
values, counts = powerlaw_degree_distrubution(n, gamma)

with open(deg_file_path, "w") as wf:
writer = csv.writer(wf)
Expand Down
4 changes: 2 additions & 2 deletions AMLsim/scripts/transaction_graph_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -1569,8 +1569,8 @@ def count__patterns(self, threshold=2):
argv = sys.argv

# debug:
PARAM_FILES = '10K_accts'
argv.append(f'paramFiles/{PARAM_FILES}/conf.json')
# PARAM_FILES = '100K_accts'
# argv.append(f'paramFiles/{PARAM_FILES}/conf.json')

argc = len(argv)
if argc < 2:
Expand Down
6 changes: 3 additions & 3 deletions AMLsim/src/main/java/amlsim/AMLSim.java
Original file line number Diff line number Diff line change
Expand Up @@ -634,9 +634,9 @@ public static void main(String[] args) {
*/

// Loading configuration JSON file instead of parsing command line arguments
//String confFile = args[0];
String paramFiles = "10K_accts";
String confFile = "paramFiles/" + paramFiles + "/conf.json"; // debug
String confFile = args[0];
//String paramFiles = "100K_accts";
//String confFile = "paramFiles/" + paramFiles + "/conf.json"; // debug

try {
simProp = new SimProperties(confFile);
Expand Down
Binary file modified AMLsim/target/classes/amlsim/SimProperties.class
Binary file not shown.
Binary file modified AMLsim/target/classes/amlsim/TargetedTransactionAmount.class
Binary file not shown.
Binary file modified AMLsim/target/classes/amlsim/dists/NormalDist.class
Binary file not shown.
Binary file modified AMLsim/target/classes/amlsim/dists/NormalDistQuick.class
Binary file not shown.
Binary file modified AMLsim/target/classes/amlsim/dists/Num.class
Binary file not shown.
Binary file modified AMLsim/target/classes/amlsim/dists/TruncatedNormal.class
Binary file not shown.
Binary file modified AMLsim/target/classes/amlsim/dists/TruncatedNormalQuick.class
Binary file not shown.
Binary file modified AMLsim/target/classes/amlsim/model/aml/RandomTypology.class
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
405 changes: 0 additions & 405 deletions data/simtest/swedbank/test/edges.csv

This file was deleted.

584 changes: 0 additions & 584 deletions data/simtest/swedbank/test/nodes.csv

This file was deleted.

1,122 changes: 0 additions & 1,122 deletions data/simtest/swedbank/train/edges.csv

This file was deleted.

928 changes: 0 additions & 928 deletions data/simtest/swedbank/train/nodes.csv

This file was deleted.

Binary file removed gnn/LIME-results/explanation.png
Binary file not shown.
Binary file removed gnn/__pycache__/criterions.cpython-310.pyc
Binary file not shown.
Binary file removed gnn/__pycache__/data.cpython-310.pyc
Binary file not shown.
Binary file removed gnn/__pycache__/main.cpython-310.pyc
Binary file not shown.
Binary file removed gnn/__pycache__/modules.cpython-310.pyc
Binary file not shown.
26 changes: 10 additions & 16 deletions gnn/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,8 @@ def train_gcn(device):
set_random_seed(42)

# data
traindata = AmlsimDataset(node_file='data/simulation2/swedbank/train/nodes.csv', edge_file='data/simulation2/swedbank/train/edges.csv', node_features=True, node_labels=True).get_data()
testdata = AmlsimDataset(node_file='data/simulation2/swedbank/test/nodes.csv', edge_file='data/simulation2/swedbank/test/edges.csv', node_features=True, node_labels=True).get_data()
print(type(traindata))
print(type(testdata))
traindata = AmlsimDataset(node_file='data/1bank/bank/trainset/nodes.csv', edge_file='data/1bank/bank/trainset/edges.csv').get_data()
testdata = AmlsimDataset(node_file='data/1bank/bank/testset/nodes.csv', edge_file='data/1bank/bank/testset/edges.csv').get_data()
traindata = traindata.to(device)
testdata = testdata.to(device)

Expand Down Expand Up @@ -79,10 +77,10 @@ def train_logistic_regressor():

# set device
device = torch.device('cuda:0')

# data
traindata = AmlsimDataset(node_file='home/agnes/desktop/flib/data/simtest/swedbank/train/nodes.csv', edge_file='home/agnes/desktop/flib/data/simtest/swedbank/train/edges.csv', node_features=True, node_labels=True).get_data()
testdata = AmlsimDataset(node_file='home/agnes/desktop/flib/data/simtest/swedbank/test/nodes.csv', edge_file='home/agnes/desktop/flib/data/simtest/swedbank/test/edges.csv', node_features=True, node_labels=True).get_data()
traindata = AmlsimDataset(node_file='data/1bank/bank/trainset/nodes.csv', edge_file='data/1bank/bank/trainset/edges.csv', node_features=True, node_labels=True).get_data()
testdata = AmlsimDataset(node_file='data/1bank/bank/testset/nodes.csv', edge_file='data/1bank/bank/testset/edges.csv', node_features=True, node_labels=True).get_data()
traindata = traindata.to(device)
testdata = testdata.to(device)

Expand Down Expand Up @@ -126,7 +124,6 @@ def train_logistic_regressor():
recall = recall_score(testdata.y.cpu().numpy(), out.cpu().numpy().argmax(axis=1), zero_division=0)
f1 = f1_score(testdata.y.cpu().numpy(), out.cpu().numpy().argmax(axis=1), zero_division=0)
print(f'epoch: {epoch + 1}, loss: {loss:.4f}, accuracy: {accuracy:.4f}, balanced_accuracy: {balanced_accuracy:.4f}, precision: {precision:.4f}, recall: {recall:.4f}, f1: {f1:.4f}')
return model

def train_graph_sage():
# set seed
Expand All @@ -136,8 +133,8 @@ def train_graph_sage():
device = torch.device('cuda:0')

# data
traindata = AmlsimDataset(node_file='thesis_XAML/data/simulation2/swedbank/train/nodes.csv', edge_file='thesis_XAML/data/simulation2/swedbank/train/edges.csv', node_features=True, node_labels=True).get_data()
testdata = AmlsimDataset(node_file='thesis_XAML/data/simulation2/swedbank/test/nodes.csv', edge_file='thesis_XAML/data/simulation2/swedbank/test/edges.csv', node_features=True, node_labels=True).get_data()
traindata = AmlsimDataset(node_file='data/1bank/bank/trainset/nodes.csv', edge_file='data/1bank/bank/trainset/edges.csv', node_features=True, node_labels=True).get_data()
testdata = AmlsimDataset(node_file='data/1bank/bank/testset/nodes.csv', edge_file='data/1bank/bank/testset/edges.csv', node_features=True, node_labels=True).get_data()
traindata = traindata.to(device)
testdata = testdata.to(device)

Expand All @@ -152,9 +149,6 @@ def train_graph_sage():
trainloader = DataLoader(traindata, batch_size=batch_size, shuffle=True)
testloader = DataLoader(testdata, batch_size=batch_size, shuffle=False)

#print train_loader
print(len(trainloader))

# model
input_dim = 10
hidden_dim = 65
Expand Down Expand Up @@ -491,9 +485,9 @@ def main():
#trainer = GINeTrainer(seed=seed, device=device, train_node_file=train_node_file, train_edge_file=train_edge_file, test_node_file=test_node_file, test_edge_file=test_edge_file)
#trainer.optimize_hyperparameters(direction=direction, n_trials=n_trials)

#print('training logreg')
#train_logistic_regressor()
#print()
print('training logreg')
train_logistic_regressor()
print()

print('training graphsage')
train_graph_sage()
Expand Down
Loading

0 comments on commit 100b419

Please sign in to comment.