Skip to main content

train_and_evaluate

Algorithm to train and evaluate a model on remote data.

Classes

ModelTrainingAndEvaluation

class ModelTrainingAndEvaluation(    *,    model: _DistributedModelTypeOrReference,    pretrained_file: Optional[Union[str, os.PathLike]] = None,    project_id: Optional[str] = None,):

Algorithm for training a model, evaluating it and returning metrics.

note

The metrics cannot currently be specified by the user.

Arguments

  • model: The model to train and evaluate on remote data.
  • pretrained_file: A file path or a string containing a pre-trained model. Defaults to None.

Attributes

  • class_name: The name of the algorithm class.
  • fields_dict: A dictionary mapping all attributes that will be serialized in the class to their marshamllow field type. (e.g. fields_dict = {"class_name": fields.Str()}).
  • model: The model to train and evaluate on remote data.
  • nested_fields: A dictionary mapping all nested attributes to a registry that contains class names mapped to the respective classes. (e.g. nested_fields = {"datastructure": datastructure.registry})
  • pretrained_file: A file path or a string containing a pre-trained model. Defaults to None.

Ancestors

  • bitfount.federated.algorithms.model_algorithms.base._BaseModelAlgorithmFactory
  • BaseAlgorithmFactory
  • abc.ABC
  • bitfount.federated.roles._RolesMixIn
  • bitfount.types._BaseSerializableObjectMixIn

Variables

  • static nested_fields : ClassVar[Dict[str, Mapping[str, Any]]]

Methods


create

def create(self, role: Union[str, Role], **kwargs: Any)> Any:

Create an instance representing the role specified.

modeller

def modeller(    self, **kwargs: Any,)> bitfount.federated.algorithms.model_algorithms.train_and_evaluate._ModellerSide:

Returns the modeller side of the ModelTrainingAndEvaluation algorithm.

worker

def worker(    self, hub: BitfountHub, **kwargs: Any,)> bitfount.federated.algorithms.model_algorithms.train_and_evaluate._WorkerSide:

Returns the worker side of the ModelTrainingAndEvaluation algorithm.

Arguments

  • hub: BitfountHub object to use for communication with the hub.