fl_server_core.models.training ¶
Classes:
| Name | Description |
|---|---|
AggregationMethod | Aggregation method choices for a Training. |
Training | Training model class. |
TrainingState | Training state choices for a Training. |
UncertaintyMethod | Uncertainty method choices for a Training. |
Functions:
| Name | Description |
|---|---|
post_save_training | Ensure that the correct |
Classes¶
AggregationMethod ¶
Bases: TextChoices
flowchart TD
fl_server_core.models.training.AggregationMethod[AggregationMethod]
click fl_server_core.models.training.AggregationMethod href "" "fl_server_core.models.training.AggregationMethod"
Aggregation method choices for a Training.
- API Reference
fl_server_apiserializerstraining ClassesCreateTrainingRequest Attributesaggregation_method
Attributes:
| Name | Type | Description |
|---|---|---|
FED_AVG | | |
FED_DC | | |
FED_PROX | |
Source code in fl_server_core/models/training.py
Training ¶
Bases: Model
flowchart TD
fl_server_core.models.training.Training[Training]
click fl_server_core.models.training.Training href "" "fl_server_core.models.training.Training"
Training model class.
- API Reference
fl_server_coremodels
- API Reference
-
fl_server_ai-
uncertainty -
trainer -
notification -
aggregation
-
-
fl_server_apiserializersgeneric -
fl_server_coremodelstraining Functionspost_save_training
-
Attributes:
| Name | Type | Description |
|---|---|---|
actor | ForeignKey | User who is the actor of the training. |
aggregation_method | CharField | Aggregation method used in the training. |
id | UUIDField | Unique identifier for the training. |
last_update | Time of the last update. | |
locked | BooleanField | Flag indicating whether the training is locked. |
model | OneToOneField | Model used in the training. |
options | JSONField | Options for the training. |
participants | ManyToManyField | Users who are the participants of the training. |
state | CharField | State of the training. |
target_num_updates | IntegerField | Target number of updates for the training. |
uncertainty_method | CharField | Uncertainty method used in the training. |
Source code in fl_server_core/models/training.py
Attributes¶
actor class-attribute instance-attribute ¶
actor: ForeignKey = ForeignKey(User, on_delete=CASCADE, related_name='actors')
User who is the actor of the training.
aggregation_method class-attribute instance-attribute ¶
aggregation_method: CharField = CharField(max_length=32, choices=choices, default=FED_AVG)
Aggregation method used in the training.
id class-attribute instance-attribute ¶
id: UUIDField = UUIDField(primary_key=True, editable=False, default=uuid4)
Unique identifier for the training.
last_update class-attribute instance-attribute ¶
Time of the last update.
locked class-attribute instance-attribute ¶
Flag indicating whether the training is locked.
model class-attribute instance-attribute ¶
model: OneToOneField = OneToOneField(Model, on_delete=CASCADE)
Model used in the training.
options class-attribute instance-attribute ¶
options: JSONField = JSONField(default=dict, encoder=DjangoJSONEncoder)
Options for the training.
participants class-attribute instance-attribute ¶
participants: ManyToManyField = ManyToManyField(User)
Users who are the participants of the training.
state class-attribute instance-attribute ¶
State of the training.
target_num_updates class-attribute instance-attribute ¶
Target number of updates for the training.
TrainingState ¶
Bases: TextChoices
flowchart TD
fl_server_core.models.training.TrainingState[TrainingState]
click fl_server_core.models.training.TrainingState href "" "fl_server_core.models.training.TrainingState"
Training state choices for a Training.
Attributes:
| Name | Type | Description |
|---|---|---|
COMPLETED | | |
ERROR | | |
INITIAL | | |
ONGOING | | |
SWAG_ROUND | |
Source code in fl_server_core/models/training.py
Attributes¶
UncertaintyMethod ¶
Bases: TextChoices
flowchart TD
fl_server_core.models.training.UncertaintyMethod[UncertaintyMethod]
click fl_server_core.models.training.UncertaintyMethod href "" "fl_server_core.models.training.UncertaintyMethod"
Uncertainty method choices for a Training.
- API Reference
fl_server_apiserializerstraining ClassesCreateTrainingRequest Attributesuncertainty_method
Attributes:
| Name | Type | Description |
|---|---|---|
ENSEMBLE | | |
MC_DROPOUT | | |
NONE | | |
SWAG | |
Source code in fl_server_core/models/training.py
Functions¶
post_save_training ¶
Ensure that the correct target_num_updates is set for every new training.
This method is called after saving a training instance. It is used to set the target_num_updates to the correct value if this training instance is newly created and daisy chaining is enabled.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
| The model class. | required | |
| Training | The actual instance being saved. Defaults to None. | None |
| bool | A boolean; True if a new record was created. Defaults to False. | False |
| Additional arguments. | () | |
| Arbitrary keyword arguments. | {} |