Skip to main content

types

Type hints, enums and protocols for the Bitfount libraries.

Classes

DistributedModelProtocol

class DistributedModelProtocol(*args):

Federated Model structural type.

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

Variables

  • static class_name : str
  • static datastructure : DataStructure
  • static epochs : Optional[int]
  • static fields_dict : ClassVar[T_FIELDS_DICT]
  • static metrics : Optional[MutableMapping[str, Metric]]
  • 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.

Methods


apply_weight_updates

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

Defined in DistributedModelMixIn.

deserialize

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

Defined in _BaseModel.

deserialize_params

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

Defined in DistributedModelMixIn.

diff_params

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

Defined in DistributedModelMixIn.

evaluate

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.

fit

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.

get_param_states

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

Defined in DistributedModelMixIn.

initialise_model

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

Defined in _BaseModel.

log_

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

Defined in DistributedModelMixIn.

predict

def predict(    self,    data: Optional[BaseSource] = None,    pod_identifiers: Optional[List[str]] = None,    **kwargs: Any,)> Union[List[np.ndarray], Dict[str, List[np.ndarray]]]:

Defined in _BaseModel.

reset_trainer

def reset_trainer(self)> None:

Defined in DistributedModelMixIn.

serialize

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

Defined in _BaseModel.

serialize_params

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

Defined in DistributedModelMixIn.

set_model_training_iterations

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

Defined in DistributedModelMixIn.

set_pod_identifier

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

Defined in DistributedModelMixIn.

tensor_precision

def tensor_precision(self)> +T_DTYPE:

Defined in DistributedModelMixIn.

update_params

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

Defined in DistributedModelMixIn.