Skip to main content

types

Type hints, enums and protocols for the Bitfount libraries.

Classes

DistributedModelProtocol

class DistributedModelProtocol(*args, **kwargs):

Federated Model structural type.

This protocol should be implemented by classes that inherit from either BitfountModel, or both of _BaseModel and DistributedModelMixIn.

Methods


def apply_weight_updates(    self, weight_updates: Sequence[_Weights],)> Mapping[str, bitfount.types._TensorLike]:

Defined in DistributedModelMixIn.

def deserialize(self, filename: Union[str, os.PathLike])> None:

Defined in _BaseModel.

def deserialize_params(    self, serialized_weights: _SerializedWeights,)> Mapping[str, bitfount.types._TensorLike]:

Defined in DistributedModelMixIn.

def diff_params(    self, old_params: _Weights, new_params: _Weights,)> Mapping[str, bitfount.types._TensorLike]:

Defined in DistributedModelMixIn.

def evaluate(    self,    test_dl: Optional[_BitfountDataLoader] = None,    pod_identifiers: Optional[List[str]] = None,    **kwargs: Any,)> Union[Tuple[np.ndarray, np.ndarray], Dict[str, float]]:

Defined in _BaseModel.

def fit(    self,    data: Optional[BaseSource] = None,    metrics: Optional[Dict[str, Metric]] = None,    pod_identifiers: Optional[List[str]] = None,    **kwargs: Any,)> Optional[Dict[str, str]]:

Defined in DistributedModelMixIn.

def get_param_states(self)> Mapping[str, bitfount.types._TensorLike]:

Defined in DistributedModelMixIn.

def initialise_model(    self, data: Optional[BaseSource] = None, context: Optional[ModelContext] = None,)> None:

Defined in _BaseModel.

def log_(self, name: str, value: Any, **kwargs: Any)> Any:

Defined in DistributedModelMixIn.

def reset_trainer(self)> None:

Defined in DistributedModelMixIn.

def serialize(self, filename: Union[str, os.PathLike])> None:

Defined in _BaseModel.

def serialize_params(self, weights: _Weights)> Mapping[str, List[float]]:

Defined in DistributedModelMixIn.

def set_model_training_iterations(self, iterations: int)> None:

Defined in DistributedModelMixIn.

def set_pod_identifier(self, pod_identifier: str)> None:

Defined in DistributedModelMixIn.

def tensor_precision(self)> +T_DTYPE:

Defined in DistributedModelMixIn.

def update_params(self, new_model_params: _Weights)> None:

Defined in DistributedModelMixIn.

Variables

  • static class_name : str
  • static datastructure : DataStructure
  • static epochs : Optional[int]
  • static fields_dict : ClassVar[T_FIELDS_DICT]
  • static nested_fields : ClassVar[T_NESTED_FIELDS]
  • static param_clipping : Optional[Dict[str, int]]
  • static pod_identifier : Optional[str]
  • static schema : BitfountSchema
  • static steps : Optional[int]
  • initialised : bool - Defined in _BaseModel.