p2pfl.learning.frameworks.learner moduleΒΆ
NodeLearning Interface - Template Pattern.
- class p2pfl.learning.frameworks.learner.Learner(model, data, self_addr='unknown-node', aggregator=None)[source]ΒΆ
Bases:
ABC
Template to implement learning processes, including metric monitoring during training.
- Parameters:
model (
P2PFLModel
) β The model of the learner.data (
P2PFLDataset
) β The data of the learner.self_addr (
str
) β The address of the learner.
- add_callback_info_to_model()[source]ΒΆ
Add the additional information from the callbacks to the model.
- Return type:
None
- abstract evaluate()[source]ΒΆ
Evaluate the model with actual parameters.
- Return type:
Dict
[str
,float
]- Returns:
The evaluation results.
- abstract get_framework()[source]ΒΆ
Retrieve the learner name.
- Return type:
str
- Returns:
The name of the learner class.
- set_addr(addr)[source]ΒΆ
Set the address of the learner.
- Parameters:
addr (
str
) β The address of the learner.- Return type:
None
- set_data(data)[source]ΒΆ
Set the data of the learner. It is used to fit the model.
- Parameters:
data (
P2PFLDataset
) β The data of the learner.- Return type:
None
- set_epochs(epochs)[source]ΒΆ
Set the number of epochs of the model.
- Parameters:
epochs (
int
) β The number of epochs of the model.- Return type:
None
- set_model(model)[source]ΒΆ
Set the model of the learner.
- Parameters:
model (
Union
[P2PFLModel
,List
[ndarray
],bytes
]) β The model of the learner.- Return type:
None