MEDfl 0.1.24__py3-none-any.whl → 0.1.25__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {Medfl-0.1.24.dist-info → MEDfl-0.1.25.dist-info}/METADATA +2 -2
- {Medfl-0.1.24.dist-info → MEDfl-0.1.25.dist-info}/RECORD +10 -10
- Medfl/LearningManager/server.py +4 -2
- Medfl/NetManager/net_helper.py +19 -35
- Medfl/NetManager/network.py +10 -4
- Medfl/NetManager/node.py +11 -17
- scripts/create_db.py +2 -0
- {Medfl-0.1.24.data → MEDfl-0.1.25.data}/scripts/setup_mysql.sh +0 -0
- {Medfl-0.1.24.dist-info → MEDfl-0.1.25.dist-info}/WHEEL +0 -0
- {Medfl-0.1.24.dist-info → MEDfl-0.1.25.dist-info}/top_level.txt +0 -0
@@ -1,3 +1,4 @@
|
|
1
|
+
MEDfl-0.1.25.data/scripts/setup_mysql.sh,sha256=PXl271yvYBrXwrZ7P0tsYHnGkOubKvRaFee4MnzsSko,560
|
1
2
|
Medfl/__init__.py,sha256=wamSaVIS4RoIHcTCLQPKQ5f8odcy87mRCKyRR7-Qpu4,57
|
2
3
|
Medfl/LearningManager/__init__.py,sha256=DZZl9wUCY4vzA8ulmBL4EaFR8yVDYNdvur2mk4BJQnA,358
|
3
4
|
Medfl/LearningManager/client.py,sha256=ik-0qImV6nrk1Iw70dEMKaN_r7NxvcyVl5nAWqjzmQY,6083
|
@@ -8,25 +9,24 @@ Medfl/LearningManager/model.py,sha256=DA7HP34Eq1Ra65OlkBmjH9d2MD7OEbsOhfxD48l4QO
|
|
8
9
|
Medfl/LearningManager/params.yaml,sha256=5I-NljhnSaqzjkWVNzrOtrB8z7tnHBKiBmY-mKGhBQM,450
|
9
10
|
Medfl/LearningManager/params_optimiser.py,sha256=Pg_I5n_sPz-7ZqOsJGmnVM9ye7c5aPp5szBPmHsWKhE,18060
|
10
11
|
Medfl/LearningManager/plot.py,sha256=iPqMV9rVd7hquoFixDL20OzXI5bMpBW41bkVmTKIWtE,7927
|
11
|
-
Medfl/LearningManager/server.py,sha256=
|
12
|
+
Medfl/LearningManager/server.py,sha256=7edxPkZ9Ju3Mep_BSHQpUNgW9HKfCui3_l996buJVlU,7258
|
12
13
|
Medfl/LearningManager/strategy.py,sha256=n0asQajkHfGLDX3QbbV5qntQA-xuJZU8Z92XccZENsA,3517
|
13
14
|
Medfl/LearningManager/utils.py,sha256=7iJiA-v7mM4SuvvwxA9oAP8i15MvNpkMyCv6uC6lLoQ,9342
|
14
15
|
Medfl/NetManager/__init__.py,sha256=htCEy8g7lrKKeZJ-cH9-YCTyWfIOLwKtoj_dlNasOuM,246
|
15
16
|
Medfl/NetManager/database_connector.py,sha256=rooasWBSNtZZmqQvLPS0IimHQqWeCMyyGFRFzNM8Dlw,1538
|
16
17
|
Medfl/NetManager/dataset.py,sha256=NpbmfSKJdtqIsShvjsb_z8W1vqlpYoFyZp8Wzsx_aEc,2869
|
17
18
|
Medfl/NetManager/flsetup.py,sha256=IPWdZcz13PZic5OQyCiMyJ34cQPegKwkKEJSAqjjnqg,11754
|
18
|
-
Medfl/NetManager/net_helper.py,sha256=
|
19
|
+
Medfl/NetManager/net_helper.py,sha256=sDGDfrYqY4MUoAE2gcNcyJFBXPRoAupdUibVSnspAn0,6860
|
19
20
|
Medfl/NetManager/net_manager_queries.py,sha256=2dfhba0iuh40kVoC7am-vC4Hlrvr-zfJ5ESymsI1Kps,4327
|
20
|
-
Medfl/NetManager/network.py,sha256=
|
21
|
-
Medfl/NetManager/node.py,sha256=
|
22
|
-
Medfl-0.1.24.data/scripts/setup_mysql.sh,sha256=PXl271yvYBrXwrZ7P0tsYHnGkOubKvRaFee4MnzsSko,560
|
21
|
+
Medfl/NetManager/network.py,sha256=X5uKHna_CnskYGYZ2DjmIDEwri7srggjHc0PUIypls0,5730
|
22
|
+
Medfl/NetManager/node.py,sha256=foOpIC3bsrOw3E-UCVQ87sy2Kp_2syd-KFijxnbYPiY,6344
|
23
23
|
alembic/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
24
24
|
alembic/env.py,sha256=a4zJAzPNLHnIrUlXCqf_8vuAlFu0pceFJJKM1PQaOI4,1649
|
25
25
|
scripts/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
26
26
|
scripts/base.py,sha256=pR7StIt3PpX30aoh53gMkpeNJMHytAPhdc7N09tCITA,781
|
27
27
|
scripts/config.ini,sha256=tDQQlpwZbCFQuSS017yjEiLglLihp6wETbWtNrSWeAA,82
|
28
|
-
scripts/create_db.py,sha256=
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
28
|
+
scripts/create_db.py,sha256=iWE1z33rU_KbIeqoVzdWLhDRLk00TcRf2iYuqpDzOjw,4494
|
29
|
+
MEDfl-0.1.25.dist-info/METADATA,sha256=qijvMc_6sl1N2UaGR173E3QQryvOqsofUKebI3ZSxrU,5580
|
30
|
+
MEDfl-0.1.25.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
|
31
|
+
MEDfl-0.1.25.dist-info/top_level.txt,sha256=CmLt1TC7PJj-V55rhffMZ9LSOiuSaaEbz9FJm_zOw_E,22
|
32
|
+
MEDfl-0.1.25.dist-info/RECORD,,
|
Medfl/LearningManager/server.py
CHANGED
@@ -115,10 +115,11 @@ class FlowerServer:
|
|
115
115
|
f"cuda:{int(cid) % 4}" if torch.cuda.is_available() else "cpu"
|
116
116
|
)
|
117
117
|
client_model = copy.deepcopy(self.global_model)
|
118
|
-
|
118
|
+
|
119
119
|
trainloader = self.fed_dataset.trainloaders[int(cid)]
|
120
120
|
valloader = self.fed_dataset.valloaders[int(cid)]
|
121
121
|
# this helps in making plots
|
122
|
+
|
122
123
|
client = FlowerClient(
|
123
124
|
cid, client_model, trainloader, valloader, self.diff_priv
|
124
125
|
)
|
@@ -165,7 +166,8 @@ class FlowerServer:
|
|
165
166
|
ray_init_args = {"include_dashboard": False
|
166
167
|
, "object_store_memory": 78643200
|
167
168
|
}
|
168
|
-
|
169
|
+
self.fed_dataset.eng = None
|
170
|
+
|
169
171
|
history = fl.simulation.start_simulation(
|
170
172
|
client_fn=self.client_fn,
|
171
173
|
num_clients=self.num_clients,
|
Medfl/NetManager/net_helper.py
CHANGED
@@ -133,11 +133,8 @@ def get_nodeid_from_name(name):
|
|
133
133
|
db_manager.connect()
|
134
134
|
my_eng = db_manager.get_connection()
|
135
135
|
|
136
|
-
NodeId =
|
137
|
-
|
138
|
-
text(f"SELECT NodeId FROM Nodes WHERE NodeName = '{name}'"), my_eng
|
139
|
-
).iloc[0, 0]
|
140
|
-
)
|
136
|
+
result_proxy = my_eng.execute(f"SELECT NodeId FROM Nodes WHERE NodeName = '{name}'")
|
137
|
+
NodeId = int(result_proxy.fetchone()[0])
|
141
138
|
return NodeId
|
142
139
|
|
143
140
|
|
@@ -156,12 +153,8 @@ def get_netid_from_name(name):
|
|
156
153
|
my_eng = db_manager.get_connection()
|
157
154
|
|
158
155
|
try:
|
159
|
-
NetId =
|
160
|
-
|
161
|
-
text(f"SELECT NetId FROM Networks WHERE NetName = '{name}'"),
|
162
|
-
my_eng,
|
163
|
-
).iloc[0, 0]
|
164
|
-
)
|
156
|
+
result_proxy = my_eng.execute(f"SELECT NetId FROM Networks WHERE NetName = '{name}'")
|
157
|
+
NetId = int(result_proxy.fetchone()[0])
|
165
158
|
except:
|
166
159
|
NetId = None
|
167
160
|
return NetId
|
@@ -182,12 +175,10 @@ def get_flsetupid_from_name(name):
|
|
182
175
|
my_eng = db_manager.get_connection()
|
183
176
|
|
184
177
|
try:
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
).iloc[0, 0]
|
190
|
-
)
|
178
|
+
|
179
|
+
result_proxy = my_eng.execute(f"SELECT FLsetupId FROM FLsetup WHERE name = '{name}'")
|
180
|
+
id = int(result_proxy.fetchone()[0])
|
181
|
+
|
191
182
|
except:
|
192
183
|
id = None
|
193
184
|
return id
|
@@ -208,12 +199,9 @@ def get_flpipeline_from_name(name):
|
|
208
199
|
my_eng = db_manager.get_connection()
|
209
200
|
|
210
201
|
try:
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
my_eng,
|
215
|
-
).iloc[0, 0]
|
216
|
-
)
|
202
|
+
|
203
|
+
result_proxy = my_eng.execute(f"SELECT id FROM FLpipeline WHERE name = '{name}'")
|
204
|
+
id = int(result_proxy.fetchone()[0])
|
217
205
|
except:
|
218
206
|
id = None
|
219
207
|
return id
|
@@ -234,12 +222,9 @@ def get_feddataset_id_from_name(name):
|
|
234
222
|
my_eng = db_manager.get_connection()
|
235
223
|
|
236
224
|
try:
|
237
|
-
|
238
|
-
|
239
|
-
|
240
|
-
my_eng,
|
241
|
-
).iloc[0, 0]
|
242
|
-
)
|
225
|
+
|
226
|
+
result_proxy = my_eng.execute(f"SELECT FedId FROM FedDatasets WHERE name = '{name}'")
|
227
|
+
id = int(result_proxy.fetchone()[0])
|
243
228
|
except:
|
244
229
|
id = None
|
245
230
|
return id
|
@@ -256,9 +241,8 @@ def master_table_exists():
|
|
256
241
|
db_manager.connect()
|
257
242
|
my_eng = db_manager.get_connection()
|
258
243
|
|
259
|
-
|
260
|
-
|
261
|
-
|
262
|
-
|
263
|
-
|
264
|
-
).values[0][0]
|
244
|
+
|
245
|
+
sql_query = text("SELECT EXISTS (SELECT TABLE_NAME FROM information_schema.TABLES WHERE TABLE_NAME = 'MasterDataset')")
|
246
|
+
result = my_eng.execute(sql_query)
|
247
|
+
exists = result.scalar()
|
248
|
+
return exists
|
Medfl/NetManager/network.py
CHANGED
@@ -12,6 +12,8 @@ from .node import Node
|
|
12
12
|
import pandas as pd
|
13
13
|
from Medfl.LearningManager.utils import params
|
14
14
|
|
15
|
+
from sqlalchemy import text
|
16
|
+
|
15
17
|
|
16
18
|
class Network:
|
17
19
|
"""
|
@@ -104,9 +106,10 @@ class Network:
|
|
104
106
|
DataFrame: A DataFrame containing information about all nodes in the network.
|
105
107
|
|
106
108
|
"""
|
107
|
-
|
108
|
-
|
109
|
-
)
|
109
|
+
query = text(LIST_ALL_NODES_QUERY.format(name=self.name))
|
110
|
+
result_proxy = self.eng.execute(query)
|
111
|
+
result_df = pd.DataFrame(result_proxy.fetchall(), columns=result_proxy.keys())
|
112
|
+
return result_df
|
110
113
|
|
111
114
|
def create_master_dataset(self, path_to_csv: str = params['path_to_master_csv']):
|
112
115
|
"""
|
@@ -165,4 +168,7 @@ class Network:
|
|
165
168
|
db_manager.connect() ;
|
166
169
|
my_eng = db_manager.get_connection() ;
|
167
170
|
|
168
|
-
|
171
|
+
result_proxy = my_eng.execute("SELECT * FROM Networks")
|
172
|
+
result = result_proxy.fetchall()
|
173
|
+
return result
|
174
|
+
|
Medfl/NetManager/node.py
CHANGED
@@ -74,10 +74,12 @@ class Node:
|
|
74
74
|
print("MasterDataset doesn't exist")
|
75
75
|
else:
|
76
76
|
columns = data_df.columns.tolist()
|
77
|
+
|
77
78
|
# get master_dataset columns
|
78
|
-
|
79
|
-
|
80
|
-
|
79
|
+
result_proxy = self.engine.execute(SELECT_MASTER_COLUMNS_QUERY)
|
80
|
+
master_table_columns = result_proxy.keys()
|
81
|
+
|
82
|
+
|
81
83
|
assert [x == y for x, y in zip(master_table_columns, columns)]
|
82
84
|
|
83
85
|
def update_node(self):
|
@@ -94,21 +96,13 @@ class Node:
|
|
94
96
|
"""
|
95
97
|
NodeId = get_nodeid_from_name(self.name)
|
96
98
|
if column_name is not None:
|
97
|
-
|
98
|
-
node_dataset = pd.read_sql(
|
99
|
-
text(
|
100
|
-
SELECT_DATASET_BY_COLUMN_QUERY.format(
|
101
|
-
column_name, self.name
|
102
|
-
)
|
103
|
-
),
|
104
|
-
self.engine,
|
105
|
-
)
|
106
|
-
|
99
|
+
query = text(SELECT_DATASET_BY_COLUMN_QUERY.format(column_name, self.name))
|
107
100
|
else:
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
101
|
+
query = text(SELECT_DATASET_BY_NODE_ID_QUERY.format(NodeId))
|
102
|
+
|
103
|
+
result_proxy = self.engine.execute(query)
|
104
|
+
node_dataset = pd.DataFrame(result_proxy.fetchall(), columns=result_proxy.keys())
|
105
|
+
|
112
106
|
return node_dataset
|
113
107
|
|
114
108
|
def upload_dataset(self, dataset_name: str, path_to_csv: str = params['path_to_test_csv']):
|
scripts/create_db.py
CHANGED
@@ -18,6 +18,8 @@ def main(csv_file_path):
|
|
18
18
|
config.read(config_file_path)
|
19
19
|
mysql_config = config['mysql']
|
20
20
|
|
21
|
+
print('Im here !')
|
22
|
+
|
21
23
|
mydb = mysql.connector.connect(host=mysql_config['host'], user=mysql_config['user'], password=mysql_config['password'])
|
22
24
|
mycursor = mydb.cursor()
|
23
25
|
|
File without changes
|
File without changes
|
File without changes
|