protocols
Protocols for inter-machine communication.
Federated protocol plugins can also be imported from this package.
Module
Submodules
- bitfount.federated.protocols.base - Pod communication protocols.
- bitfount.federated.protocols.conversation - Conversation protocol.
- bitfount.federated.protocols.model_protocols - Protocols for remote/federated model training on data.
- bitfount.federated.protocols.ophthalmology - Protocol plugins in this package.
- bitfount.federated.protocols.results_only - Results Only protocol.
Classes
BaseProtocolFactory
class BaseProtocolFactory( *, algorithm: Union[BaseCompatibleAlgoFactory, Sequence[BaseCompatibleAlgoFactory]], **kwargs: Any,):
Base Protocol from which all other protocols must inherit.
Subclasses
Variables
- static
fields_dict : ClassVar[dict[str, marshmallow.fields.Field]]
- static
nested_fields : ClassVar[dict[str, collections.abc.Mapping[str, Any]]]
algorithms : list
- Returns the algorithms in the protocol.
Methods
dump
def dump(self) ‑> SerializedProtocol:
Returns the JSON-serializable representation of the protocol.
modeller
def modeller( self, mailbox: _ModellerMailbox, **kwargs: Any,) ‑> BaseModellerProtocol:
Creates an instance of the modeller-side for this protocol.
run
def run( self, pod_identifiers: Collection[str], session: Optional[BitfountSession] = None, username: Optional[str] = None, hub: Optional[BitfountHub] = None, ms_config: Optional[MessageServiceConfig] = None, message_service: Optional[_MessageService] = None, pod_public_key_paths: Optional[Mapping[str, Path]] = None, identity_verification_method: IdentityVerificationMethod = IdentityVerificationMethod.OIDC_DEVICE_CODE, private_key_or_file: Optional[Union[RSAPrivateKey, Path]] = None, idp_url: Optional[str] = None, require_all_pods: bool = False, run_on_new_data_only: bool = False, model_out: Optional[Union[Path, str]] = None, project_id: Optional[str] = None, batched_execution: Optional[bool] = None,) ‑> Optional[Any]:
Sets up a local Modeller instance and runs the protocol.
Arguments
pod_identifiers
: The BitfountHub pod identifiers to run against.session
: Optional. Session to use for authenticated requests. Created if needed.username
: Username to run as. Defaults to logged in user.hub
: BitfountHub instance. Default: hub.bitfount.com.ms_config
: Message service config. Default: messaging.bitfount.com.message_service
: Message service instance, created from ms_config if not provided. Defaults to "messaging.bitfount.com".pod_public_key_paths
: Public keys of pods to be checked against.identity_verification_method
: The identity verification method to use.private_key_or_file
: Private key (to be removed).idp_url
: The IDP URL.require_all_pods
: If true raise PodResponseError if at least one pod identifier specified rejects or fails to respond to a task request.run_on_new_data_only
: Whether to run the task on new datapoints only. Defaults to False.model_out
: The path to save the model to.project_id
: The project ID to run the task under.batched_execution
: Whether to run the task in batched mode. Defaults to False.
Returns Results of the protocol.
Raises
PodResponseError
: If require_all_pods is true and at least one pod identifier specified rejects or fails to respond to a task request.ValueError
: If attempting to train on multiple pods, and theDataStructure
table name is given as a string.
worker
def worker( self, mailbox: _WorkerMailbox, hub: BitfountHub, **kwargs: Any,) ‑> BaseWorkerProtocol:
Creates an instance of the worker-side for this protocol.
Conversation
class Conversation(*, algorithm: _ConversationCompatibleAlgoFactory):
Conversation protocol.
This protocol is used for a conversation between a modeller and a pod. The pod does not remember the previous prompts and responses.
Attributes
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()}
).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}
)
Ancestors
- BaseProtocolFactory
- abc.ABC
- bitfount.federated.roles._RolesMixIn
- bitfount.types._BaseSerializableObjectMixIn
Variables
- static
algorithm : bitfount.federated.protocols.conversation._ConversationCompatibleAlgoFactory
- static
nested_fields : ClassVar[dict[str, collections.abc.Mapping[str, Any]]]
algorithms : list
- Returns the algorithms in the protocol.
Methods
create
def create(self, role: Union[str, Role], **kwargs: Any) ‑> Any:
Create an instance representing the role specified.
dump
def dump(self) ‑> SerializedProtocol:
Inherited from:
Returns the JSON-serializable representation of the protocol.
modeller
def modeller( self, mailbox: _ModellerMailbox, **kwargs: Any,) ‑> bitfount.federated.protocols.conversation._ModellerSide:
Creates a modeller-side protocol instance.
run
def run( self, pod_identifiers: Collection[str], session: Optional[BitfountSession] = None, username: Optional[str] = None, hub: Optional[BitfountHub] = None, ms_config: Optional[MessageServiceConfig] = None, message_service: Optional[_MessageService] = None, pod_public_key_paths: Optional[Mapping[str, Path]] = None, identity_verification_method: IdentityVerificationMethod = IdentityVerificationMethod.OIDC_DEVICE_CODE, private_key_or_file: Optional[Union[RSAPrivateKey, Path]] = None, idp_url: Optional[str] = None, require_all_pods: bool = False, run_on_new_data_only: bool = False, model_out: Optional[Union[Path, str]] = None, project_id: Optional[str] = None, batched_execution: Optional[bool] = None,) ‑> Optional[Any]:
Inherited from:
Sets up a local Modeller instance and runs the protocol.
Arguments
pod_identifiers
: The BitfountHub pod identifiers to run against.session
: Optional. Session to use for authenticated requests. Created if needed.username
: Username to run as. Defaults to logged in user.hub
: BitfountHub instance. Default: hub.bitfount.com.ms_config
: Message service config. Default: messaging.bitfount.com.message_service
: Message service instance, created from ms_config if not provided. Defaults to "messaging.bitfount.com".pod_public_key_paths
: Public keys of pods to be checked against.identity_verification_method
: The identity verification method to use.private_key_or_file
: Private key (to be removed).idp_url
: The IDP URL.require_all_pods
: If true raise PodResponseError if at least one pod identifier specified rejects or fails to respond to a task request.run_on_new_data_only
: Whether to run the task on new datapoints only. Defaults to False.model_out
: The path to save the model to.project_id
: The project ID to run the task under.batched_execution
: Whether to run the task in batched mode. Defaults to False.
Returns Results of the protocol.
Raises
PodResponseError
: If require_all_pods is true and at least one pod identifier specified rejects or fails to respond to a task request.ValueError
: If attempting to train on multiple pods, and theDataStructure
table name is given as a string.
worker
def worker(self, mailbox: _WorkerMailbox, hub: BitfountHub, **kwargs: Any) ‑> _WorkerSide:
Creates a worker-side protocol instance.
FederatedAveraging
class FederatedAveraging( *, algorithm: _FederatedAveragingCompatibleAlgoFactory, aggregator: Optional[_BaseAggregatorFactory] = None, steps_between_parameter_updates: Optional[int] = None, epochs_between_parameter_updates: Optional[int] = None, auto_eval: bool = True, secure_aggregation: bool = False,):
Original Federated Averaging algorithm by McMahan et al. (2017).
This protocol performs a predetermined number of epochs or steps of training on each remote Pod before sending the updated model parameters to the modeller. These parameters are then averaged and sent back to the Pods for as many federated iterations as the Modeller specifies.
For more information, take a look at the seminal paper: https://arxiv.org/abs/1602.05629
Arguments
aggregator
: The aggregator to use for updating the model parameters across all Pods participating in the task. This argument takes priority over thesecure_aggregation
argument.algorithm
: The algorithm to use for training. This must be compatible with theFederatedAveraging
protocol.auto_eval
: Whether to automatically evaluate the model on the validation dataset. Defaults to True.epochs_between_parameter_updates
: The number of epochs between parameter updates, i.e. the number of rounds of local training before parameters are updated. Ifsteps_between_parameter_updates
is provided,epochs_between_parameter_updates
cannot be provided. Defaults to None.secure_aggregation
: Whether to use secure aggregation. This argument is overridden by theaggregator
argument. Defaults to False.steps_between_parameter_updates
: The number of steps between parameter updates, i.e. the number of rounds of local training before parameters are updated. Ifepochs_between_parameter_updates
is provided,steps_between_parameter_updates
cannot be provided. Defaults to None.
Attributes
aggregator
: The aggregator to use for updating the model parameters.algorithm
: The algorithm to use for trainingauto_eval
: Whether to automatically evaluate the model on the validation dataset.epochs_between_parameter_updates
: The number of epochs between parameter updates.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()}
).name
: The name of the protocol.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}
)steps_between_parameter_updates
: The number of steps between parameter updates.
Raises
TypeError
: If thealgorithm
is not compatible with the protocol.
Ancestors
- BaseProtocolFactory
- abc.ABC
- bitfount.federated.roles._RolesMixIn
- bitfount.types._BaseSerializableObjectMixIn
Variables
- static
algorithm : bitfount.federated.protocols.model_protocols.federated_averaging._FederatedAveragingCompatibleAlgoFactory
- static
fields_dict : ClassVar[dict[str, marshmallow.fields.Field]]
- static
nested_fields : ClassVar[dict[str, collections.abc.Mapping[str, Any]]]
algorithms : list
- Returns the algorithms in the protocol.
Methods
create
def create(self, role: Union[str, Role], **kwargs: Any) ‑> Any:
Create an instance representing the role specified.
dump
def dump(self) ‑> SerializedProtocol:
Inherited from:
Returns the JSON-serializable representation of the protocol.
modeller
def modeller( self, mailbox: _ModellerMailbox, early_stopping: Optional[FederatedEarlyStopping] = None, **kwargs: Any,) ‑> bitfount.federated.protocols.model_protocols.federated_averaging._ModellerSide:
Returns the modeller side of the FederatedAveraging protocol.
run
def run( self, pod_identifiers: Collection[str], session: Optional[BitfountSession] = None, username: Optional[str] = None, hub: Optional[BitfountHub] = None, ms_config: Optional[MessageServiceConfig] = None, message_service: Optional[_MessageService] = None, pod_public_key_paths: Optional[Mapping[str, Path]] = None, identity_verification_method: IdentityVerificationMethod = IdentityVerificationMethod.OIDC_DEVICE_CODE, private_key_or_file: Optional[Union[RSAPrivateKey, Path]] = None, idp_url: Optional[str] = None, require_all_pods: bool = False, run_on_new_data_only: bool = False, model_out: Optional[Union[Path, str]] = None, project_id: Optional[str] = None, batched_execution: Optional[bool] = None,) ‑> Optional[Any]:
Inherited from:
Sets up a local Modeller instance and runs the protocol.
Arguments
pod_identifiers
: The BitfountHub pod identifiers to run against.session
: Optional. Session to use for authenticated requests. Created if needed.username
: Username to run as. Defaults to logged in user.hub
: BitfountHub instance. Default: hub.bitfount.com.ms_config
: Message service config. Default: messaging.bitfount.com.message_service
: Message service instance, created from ms_config if not provided. Defaults to "messaging.bitfount.com".pod_public_key_paths
: Public keys of pods to be checked against.identity_verification_method
: The identity verification method to use.private_key_or_file
: Private key (to be removed).idp_url
: The IDP URL.require_all_pods
: If true raise PodResponseError if at least one pod identifier specified rejects or fails to respond to a task request.run_on_new_data_only
: Whether to run the task on new datapoints only. Defaults to False.model_out
: The path to save the model to.project_id
: The project ID to run the task under.batched_execution
: Whether to run the task in batched mode. Defaults to False.
Returns Results of the protocol.
Raises
PodResponseError
: If require_all_pods is true and at least one pod identifier specified rejects or fails to respond to a task request.ValueError
: If attempting to train on multiple pods, and theDataStructure
table name is given as a string.
worker
def worker( self, mailbox: _WorkerMailbox, hub: BitfountHub, **kwargs: Any,) ‑> bitfount.federated.protocols.model_protocols.federated_averaging._WorkerSide:
Returns the worker side of the FederatedAveraging protocol.
Raises
TypeError
: If the mailbox is not compatible with the aggregator.
GAScreeningProtocolAmethyst
class GAScreeningProtocolAmethyst( *, algorithm: Sequence[Union[ModelInference, GATrialCalculationAlgorithmJade, TrialInclusionCriteriaMatchAlgorithmAmethyst, CSVReportGeneratorOphthalmologyAlgorithm, GATrialPDFGeneratorAlgorithmAmethyst]], results_notification_email: Optional[bool] = False, trial_name: Optional[str] = None, rename_columns: Optional[Mapping[str, str]] = None, **kwargs: Any,):
Protocol for running GA Algorithms sequentially.
Ancestors
- BaseProtocolFactory
- abc.ABC
- bitfount.federated.roles._RolesMixIn
- bitfount.types._BaseSerializableObjectMixIn
Variables
- static
fields_dict : ClassVar[dict[str, marshmallow.fields.Field]]
algorithms : list
- Returns the algorithms in the protocol.
Methods
dump
def dump(self) ‑> SerializedProtocol:
Inherited from:
Returns the JSON-serializable representation of the protocol.
modeller
def modeller( self, mailbox: _ModellerMailbox, **kwargs: Any,) ‑> bitfount.federated.protocols.ophthalmology.ga_screening_protocol_amethyst._ModellerSide:
Returns the Modeller side of the protocol.
run
def run( self, pod_identifiers: Collection[str], session: Optional[BitfountSession] = None, username: Optional[str] = None, hub: Optional[BitfountHub] = None, ms_config: Optional[MessageServiceConfig] = None, message_service: Optional[_MessageService] = None, pod_public_key_paths: Optional[Mapping[str, Path]] = None, identity_verification_method: IdentityVerificationMethod = IdentityVerificationMethod.OIDC_DEVICE_CODE, private_key_or_file: Optional[Union[RSAPrivateKey, Path]] = None, idp_url: Optional[str] = None, require_all_pods: bool = False, run_on_new_data_only: bool = False, model_out: Optional[Union[Path, str]] = None, project_id: Optional[str] = None, batched_execution: Optional[bool] = None,) ‑> Optional[Any]:
Inherited from:
Sets up a local Modeller instance and runs the protocol.
Arguments
pod_identifiers
: The BitfountHub pod identifiers to run against.session
: Optional. Session to use for authenticated requests. Created if needed.username
: Username to run as. Defaults to logged in user.hub
: BitfountHub instance. Default: hub.bitfount.com.ms_config
: Message service config. Default: messaging.bitfount.com.message_service
: Message service instance, created from ms_config if not provided. Defaults to "messaging.bitfount.com".pod_public_key_paths
: Public keys of pods to be checked against.identity_verification_method
: The identity verification method to use.private_key_or_file
: Private key (to be removed).idp_url
: The IDP URL.require_all_pods
: If true raise PodResponseError if at least one pod identifier specified rejects or fails to respond to a task request.run_on_new_data_only
: Whether to run the task on new datapoints only. Defaults to False.model_out
: The path to save the model to.project_id
: The project ID to run the task under.batched_execution
: Whether to run the task in batched mode. Defaults to False.
Returns Results of the protocol.
Raises
PodResponseError
: If require_all_pods is true and at least one pod identifier specified rejects or fails to respond to a task request.ValueError
: If attempting to train on multiple pods, and theDataStructure
table name is given as a string.
worker
def worker(self, mailbox: _WorkerMailbox, hub: BitfountHub, **kwargs: Any) ‑> _WorkerSide:
Returns worker side of the protocol.
GAScreeningProtocolJade
class GAScreeningProtocolJade( *, algorithm: Sequence[Union[ModelInference, GATrialCalculationAlgorithmJade, CSVReportGeneratorOphthalmologyAlgorithm, GATrialPDFGeneratorAlgorithmJade, TrialInclusionCriteriaMatchAlgorithmJade]], results_notification_email: Optional[bool] = False, trial_name: Optional[str] = None, rename_columns: Optional[Mapping[str, str]] = None, **kwargs: Any,):
Protocol for running GA Algorithms sequentially.
Ancestors
- BaseProtocolFactory
- abc.ABC
- bitfount.federated.roles._RolesMixIn
- bitfount.types._BaseSerializableObjectMixIn
Subclasses
Variables
- static
fields_dict : ClassVar[dict[str, marshmallow.fields.Field]]
algorithms : list
- Returns the algorithms in the protocol.
Methods
dump
def dump(self) ‑> SerializedProtocol:
Inherited from:
Returns the JSON-serializable representation of the protocol.
modeller
def modeller( self, mailbox: _ModellerMailbox, **kwargs: Any,) ‑> bitfount.federated.protocols.ophthalmology.ga_screening_protocol_jade._ModellerSide:
Returns the Modeller side of the protocol.
run
def run( self, pod_identifiers: Collection[str], session: Optional[BitfountSession] = None, username: Optional[str] = None, hub: Optional[BitfountHub] = None, ms_config: Optional[MessageServiceConfig] = None, message_service: Optional[_MessageService] = None, pod_public_key_paths: Optional[Mapping[str, Path]] = None, identity_verification_method: IdentityVerificationMethod = IdentityVerificationMethod.OIDC_DEVICE_CODE, private_key_or_file: Optional[Union[RSAPrivateKey, Path]] = None, idp_url: Optional[str] = None, require_all_pods: bool = False, run_on_new_data_only: bool = False, model_out: Optional[Union[Path, str]] = None, project_id: Optional[str] = None, batched_execution: Optional[bool] = None,) ‑> Optional[Any]:
Inherited from:
Sets up a local Modeller instance and runs the protocol.
Arguments
pod_identifiers
: The BitfountHub pod identifiers to run against.session
: Optional. Session to use for authenticated requests. Created if needed.username
: Username to run as. Defaults to logged in user.hub
: BitfountHub instance. Default: hub.bitfount.com.ms_config
: Message service config. Default: messaging.bitfount.com.message_service
: Message service instance, created from ms_config if not provided. Defaults to "messaging.bitfount.com".pod_public_key_paths
: Public keys of pods to be checked against.identity_verification_method
: The identity verification method to use.private_key_or_file
: Private key (to be removed).idp_url
: The IDP URL.require_all_pods
: If true raise PodResponseError if at least one pod identifier specified rejects or fails to respond to a task request.run_on_new_data_only
: Whether to run the task on new datapoints only. Defaults to False.model_out
: The path to save the model to.project_id
: The project ID to run the task under.batched_execution
: Whether to run the task in batched mode. Defaults to False.
Returns Results of the protocol.
Raises
PodResponseError
: If require_all_pods is true and at least one pod identifier specified rejects or fails to respond to a task request.ValueError
: If attempting to train on multiple pods, and theDataStructure
table name is given as a string.
worker
def worker(self, mailbox: _WorkerMailbox, hub: BitfountHub, **kwargs: Any) ‑> _WorkerSide:
Returns worker side of the protocol.
InferenceAndCSVReport
class InferenceAndCSVReport( *, algorithm: Sequence[Union[_InferenceAndCSVReportCompatibleAlgoFactory_, _InferenceAndCSVReportCompatibleModelAlgoFactory, _InferenceAndCSVReportCompatibleHuggingFaceAlgoFactory]], **kwargs: Any,):
Protocol for running a model inference generating a csv report.
Ancestors
- BaseProtocolFactory
- abc.ABC
- bitfount.federated.roles._RolesMixIn
- bitfount.types._BaseSerializableObjectMixIn
Variables
algorithms : list
- Returns the algorithms in the protocol.
Methods
dump
def dump(self) ‑> SerializedProtocol:
Inherited from:
Returns the JSON-serializable representation of the protocol.
modeller
def modeller( self, mailbox: _ModellerMailbox, **kwargs: Any,) ‑> bitfount.federated.protocols.model_protocols.inference_csv_report._ModellerSide:
Returns the Modeller side of the protocol.
run
def run( self, pod_identifiers: Collection[str], session: Optional[BitfountSession] = None, username: Optional[str] = None, hub: Optional[BitfountHub] = None, ms_config: Optional[MessageServiceConfig] = None, message_service: Optional[_MessageService] = None, pod_public_key_paths: Optional[Mapping[str, Path]] = None, identity_verification_method: IdentityVerificationMethod = IdentityVerificationMethod.OIDC_DEVICE_CODE, private_key_or_file: Optional[Union[RSAPrivateKey, Path]] = None, idp_url: Optional[str] = None, require_all_pods: bool = False, run_on_new_data_only: bool = False, model_out: Optional[Union[Path, str]] = None, project_id: Optional[str] = None, batched_execution: Optional[bool] = None,) ‑> Optional[Any]:
Inherited from:
Sets up a local Modeller instance and runs the protocol.
Arguments
pod_identifiers
: The BitfountHub pod identifiers to run against.session
: Optional. Session to use for authenticated requests. Created if needed.username
: Username to run as. Defaults to logged in user.hub
: BitfountHub instance. Default: hub.bitfount.com.ms_config
: Message service config. Default: messaging.bitfount.com.message_service
: Message service instance, created from ms_config if not provided. Defaults to "messaging.bitfount.com".pod_public_key_paths
: Public keys of pods to be checked against.identity_verification_method
: The identity verification method to use.private_key_or_file
: Private key (to be removed).idp_url
: The IDP URL.require_all_pods
: If true raise PodResponseError if at least one pod identifier specified rejects or fails to respond to a task request.run_on_new_data_only
: Whether to run the task on new datapoints only. Defaults to False.model_out
: The path to save the model to.project_id
: The project ID to run the task under.batched_execution
: Whether to run the task in batched mode. Defaults to False.
Returns Results of the protocol.
Raises
PodResponseError
: If require_all_pods is true and at least one pod identifier specified rejects or fails to respond to a task request.ValueError
: If attempting to train on multiple pods, and theDataStructure
table name is given as a string.
worker
def worker(self, mailbox: _WorkerMailbox, hub: BitfountHub, **kwargs: Any) ‑> _WorkerSide:
Returns worker side of the protocol.
InferenceAndReturnCSVReport
class InferenceAndReturnCSVReport( *, algorithm: Sequence[Union[_InferenceAndCSVReportCompatibleAlgoFactory_, _InferenceAndCSVReportCompatibleModelAlgoFactory, _InferenceAndCSVReportCompatibleHuggingFaceAlgoFactory]], **kwargs: Any,):
Protocol that sends runs inference and sends the result as CSV to the modeller.
Extends InferenceAndCSVReport to send the number of records output to CSV.
Ancestors
- InferenceAndCSVReport
- BaseProtocolFactory
- abc.ABC
- bitfount.federated.roles._RolesMixIn
- bitfount.types._BaseSerializableObjectMixIn
Variables
algorithms : list
- Returns the algorithms in the protocol.
Methods
dump
def dump(self) ‑> SerializedProtocol:
Inherited from:
Returns the JSON-serializable representation of the protocol.
modeller
def modeller( self, mailbox: _ModellerMailbox, **kwargs: Any,) ‑> bitfount.federated.protocols.model_protocols.inference_csv_report_for_modeller._ModellerSide:
Inherited from:
InferenceAndCSVReport.modeller :
Returns the Modeller side of the protocol.
run
def run( self, pod_identifiers: Collection[str], session: Optional[BitfountSession] = None, username: Optional[str] = None, hub: Optional[BitfountHub] = None, ms_config: Optional[MessageServiceConfig] = None, message_service: Optional[_MessageService] = None, pod_public_key_paths: Optional[Mapping[str, Path]] = None, identity_verification_method: IdentityVerificationMethod = IdentityVerificationMethod.OIDC_DEVICE_CODE, private_key_or_file: Optional[Union[RSAPrivateKey, Path]] = None, idp_url: Optional[str] = None, require_all_pods: bool = False, run_on_new_data_only: bool = False, model_out: Optional[Union[Path, str]] = None, project_id: Optional[str] = None, batched_execution: Optional[bool] = None,) ‑> Optional[Any]:
Inherited from:
Sets up a local Modeller instance and runs the protocol.
Arguments
pod_identifiers
: The BitfountHub pod identifiers to run against.session
: Optional. Session to use for authenticated requests. Created if needed.username
: Username to run as. Defaults to logged in user.hub
: BitfountHub instance. Default: hub.bitfount.com.ms_config
: Message service config. Default: messaging.bitfount.com.message_service
: Message service instance, created from ms_config if not provided. Defaults to "messaging.bitfount.com".pod_public_key_paths
: Public keys of pods to be checked against.identity_verification_method
: The identity verification method to use.private_key_or_file
: Private key (to be removed).idp_url
: The IDP URL.require_all_pods
: If true raise PodResponseError if at least one pod identifier specified rejects or fails to respond to a task request.run_on_new_data_only
: Whether to run the task on new datapoints only. Defaults to False.model_out
: The path to save the model to.project_id
: The project ID to run the task under.batched_execution
: Whether to run the task in batched mode. Defaults to False.
Returns Results of the protocol.
Raises
PodResponseError
: If require_all_pods is true and at least one pod identifier specified rejects or fails to respond to a task request.ValueError
: If attempting to train on multiple pods, and theDataStructure
table name is given as a string.
worker
def worker(self, mailbox: _WorkerMailbox, hub: BitfountHub, **kwargs: Any) ‑> _WorkerSide:
Inherited from:
InferenceAndCSVReport.worker :
Returns worker side of the protocol.
InstrumentedInferenceAndCSVReport
class InstrumentedInferenceAndCSVReport( *, algorithm: Sequence[Union[_InferenceAndCSVReportCompatibleAlgoFactory_, _InferenceAndCSVReportCompatibleModelAlgoFactory, _InferenceAndCSVReportCompatibleHuggingFaceAlgoFactory]], **kwargs: Any,):
Protocol that sends telemetry metrics back to Bitfount.
Extends InferenceAndCSVReport to send the number of records output to CSV.
Ancestors
- InferenceAndCSVReport
- BaseProtocolFactory
- abc.ABC
- bitfount.federated.roles._RolesMixIn
- bitfount.types._BaseSerializableObjectMixIn
Variables
algorithms : list
- Returns the algorithms in the protocol.
Methods
dump
def dump(self) ‑> SerializedProtocol:
Inherited from:
Returns the JSON-serializable representation of the protocol.
modeller
def modeller( self, mailbox: _ModellerMailbox, **kwargs: Any,) ‑> bitfount.federated.protocols.model_protocols.inference_csv_report._ModellerSide:
Inherited from:
InferenceAndCSVReport.modeller :
Returns the Modeller side of the protocol.
run
def run( self, pod_identifiers: Collection[str], session: Optional[BitfountSession] = None, username: Optional[str] = None, hub: Optional[BitfountHub] = None, ms_config: Optional[MessageServiceConfig] = None, message_service: Optional[_MessageService] = None, pod_public_key_paths: Optional[Mapping[str, Path]] = None, identity_verification_method: IdentityVerificationMethod = IdentityVerificationMethod.OIDC_DEVICE_CODE, private_key_or_file: Optional[Union[RSAPrivateKey, Path]] =