p2pfl.learning.frameworks.tensorflow.keras_model moduleΒΆ
Keras model abstraction for P2PFL.
- class p2pfl.learning.frameworks.tensorflow.keras_model.KerasModel(model, params=None, num_samples=None, contributors=None, additional_info=None, compression=None)[source]ΒΆ
Bases:
P2PFLModelP2PFL model abstraction for TensorFlow/Keras.
- Parameters:
model (
Model) β The Keras model to encapsulate.params (
list[ndarray] |bytes|None) β Optional initial parameters (list of NumPy arrays or bytes).num_samples (
int|None) β Optional number of samples used for training.contributors (
list[str] |None) β Optional list of contributor nodes.additional_info (
dict[str,Any] |None) β Optional dictionary for extra information.compression (
dict[str,dict[str,Any]] |None) β Optional dictionary for compression settings.
- get_framework()[source]ΒΆ
Retrieve the model framework name.
- Return type:
str- Returns:
The name of the model framework.
- get_parameters()[source]ΒΆ
Get the parameters of the model.
- Return type:
list[ndarray]- Returns:
The parameters of the model
- set_parameters(params)[source]ΒΆ
Set the parameters of the model.
- Parameters:
params (
list[ndarray] |bytes) β The parameters of the model.- Raises:
ModelNotMatchingError β If parameters donβt match the model.
- Return type:
None