Skip to main content

inference

Algorithm to evaluate a model on remote data.

Classes

ModelInference

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

Algorithm for running inference on a model and returning the predictions.

danger

This algorithm could potentially return the data unfiltered so should only be used when the other party is trusted.

Arguments

  • class_outputs: A list of strings corresponding to prediction outputs. If provided, the model will return a dataframe of results with the class outputs list elements as columns. Defaults to None.
  • model: The model to infer 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.
  • class_outputs: A list of strings corresponding to prediction outputs. If provided, the model will return a dataframe of results with the class outputs list elements as columns. Defaults to None.
  • 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 infer 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 fields_dict : ClassVar[T_FIELDS_DICT]

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.inference._ModellerSide:

Returns the modeller side of the ModelInference algorithm.

worker

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

Returns the worker side of the ModelInference algorithm.

Arguments

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