-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtemplate_model.py
More file actions
37 lines (25 loc) · 900 Bytes
/
template_model.py
File metadata and controls
37 lines (25 loc) · 900 Bytes
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
"""
Model_to_federate is an abstract class defining the template that every ML model used in the FL simulation must follow.
"""
from abc import ABC, abstractmethod
class Model_to_federate(ABC):
def __init__(self) -> None:
super().__init__()
@abstractmethod
def train(self, net, X_train, Y_train, parameters_training, parameters_model = None):
pass
@abstractmethod
def test(self, net, X_test, Y_test, parameters_training, parameters_model = None):
pass
@abstractmethod
def train_pooled_data (self, net, X_train, Y_train, X_val, Y_val, parameters_training, parameters_model = None):
pass
@abstractmethod
def parameter_aggregation_fn(self, net, parameters):
pass
@abstractmethod
def get_parameters(self, net):
pass
@abstractmethod
def set_parameters(self, parameters, net):
pass