p2pfl.experiment moduleΒΆ

Experiment class.

class p2pfl.experiment.Experiment(exp_name, total_rounds, round=0, dataset_name=None, model_name=None, aggregator_name=None, framework_name=None, learning_rate=None, batch_size=None, epochs_per_round=None)[source]ΒΆ

Bases: object

Class to represent an experiment.

Parameters:
  • exp_name (str) – The name of the experiment.

  • total_rounds (int) – The total rounds of the experiment.

  • round (int) – The current round.

  • dataset_name (str | None) – The name of the dataset.

  • model_name (str | None) – The name of the model.

  • aggregator_name (str | None) – The name of the aggregator.

  • framework_name (str | None) – The name of the framework.

  • learning_rate (float | None) – The learning rate.

  • batch_size (int | None) – The batch size.

  • epochs_per_round (int | None) – The number of epochs per round.

aggregator_name: str | None = NoneΒΆ
batch_size: int | None = NoneΒΆ
dataset_name: str | None = NoneΒΆ
epochs_per_round: int | None = NoneΒΆ
exp_name: strΒΆ
framework_name: str | None = NoneΒΆ
increase_round()[source]ΒΆ

Increase the round number.

Raises:

ValueError – If the round is not initialized.

Return type:

None

learning_rate: float | None = NoneΒΆ
model_name: str | None = NoneΒΆ
round: int = 0ΒΆ
self(param_name, param_val=None)[source]ΒΆ

Getter and setter for the experiment parameters.

Parameters:
  • param_name – The parameter name.

  • param_val – The parameter value.

Returns:

The parameter value if param_val is None, or the parameter value if param_val is not None.

to_dict(exclude_none=True)[source]ΒΆ

Convert the experiment to a dictionary.

Parameters:

exclude_none (bool) – If True, exclude fields with None values.

Return type:

dict

Returns:

Dictionary representation of the experiment.

total_rounds: intΒΆ