-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.py
72 lines (59 loc) · 2.23 KB
/
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
from algorithms.SoftMaxRegression import SoftMaxRegression
from peernet.helpers import bold
from peernet.network.arch import random_network, static_network
from algorithms.LogisticRegression import LogisticRegression
import expirements
from lib.graph.generator.erdos_renyi import ErdosRenyi
from pre_processing import load_banknotes, load_mnist_12, load_mnist
def model_propagation():
iterations = {'type': "iterations", 'iterations': (0, 50, 1)}
unbalancedness = {'type': "unbalancedness", "SC": 20}
sparsity = {'type': "sparsity", "SC": 10}
communication = {'type': "communication", "SC": 100}
# for i in range(55, 105, 5):
mnist_12__mp = {
"model": LogisticRegression,
"config": (10, 40000), # number of clients
"network": ErdosRenyi,
"dataset": ["mnist.data", True, 0, ';', load_mnist_12],
"confidence": True,
"analysis": sparsity
}
# Experiment MP x Iterations analysis
# expirements.experiment_mp_iter(**mnist_12__mp)
# expirements.experiment_mp_unbalancedness(**mnist_12__mp)
# expirements.experiment_mp_data(**mnist_12__mp)
expirements.experiment_mp_graph_sparsity(**mnist_12__mp)
# expirements.experiment_mp_communication(**mnist_12__mp)
def collaborative_learning():
iterations = {'type': "iterations", 'iterations': (0, 10, 1)}
empty = {'type': None}
mnist_12__mp = {
"model": LogisticRegression,
"config": (10, 40000),
"network": random_network,
"dataset": ["mnist.data", True, 0, ';', load_mnist_12],
"analysis": iterations
}
# Experiment
expirements.experiment_cl_iter(**mnist_12__mp)
def local_learning():
mnist_12__mp = {
"model": LogisticRegression,
"config": (10, 40000),
"network": random_network,
"dataset": ["mnist.data", True, 0, ';', load_mnist],
"confidence": True,
"analysis": {'type': "none"}
}
# Experiment MP x Iterations analysis
expirements.experiment_ll(**mnist_12__mp)
if __name__ == '__main__':
print(bold('Starting simulation ...'))
model_propagation()
# collaborative_learning()
# local_learning()
print(bold('Done ...'))
# OPENBLAS_NUM_THREADS=1
# GOTO_NUM_THREADS=1
# OMP_NUM_THREADS=1