nebula.core.aggregation.blockchainReputation#
Classes#
# BAT-SandrinHunkeler (BlockchainReputation) |
|
Handles interaction with Oracle and Non-Validator Node of Blockchain Network |
Functions#
|
|
|
Prints a title, all values ordered in a table, with the headers as column titles. |
|
Prints a large frame with a title inside |
Module Contents#
- nebula.core.aggregation.blockchainReputation.cossim_euclidean(model1, model2, similarity)#
- class nebula.core.aggregation.blockchainReputation.BlockchainReputation(similarity_metric='CossimEuclid', config=None, **kwargs)#
Bases:
nebula.core.aggregation.aggregator.Aggregator
# BAT-SandrinHunkeler (BlockchainReputation) Weighted FedAvg by using relative reputation of each model’s trainer Returns: aggregated model
- Parameters:
similarity_metric (str)
- ALGORITHM_MAP#
- config#
- node_name#
- run_aggregation(model_buffer)#
- Parameters:
model_buffer (OrderedDict[str, OrderedDict[torch.Tensor, int]])
- Return type:
torch.Tensor
- nebula.core.aggregation.blockchainReputation.print_table(title, values, headers)#
Prints a title, all values ordered in a table, with the headers as column titles. :param title: Title of the table :param values: Rows of table :param headers: Column headers of table
Returns: None, prints output
- Parameters:
title (str)
values (list[Tuple | List])
headers (list[str])
- Return type:
None
- nebula.core.aggregation.blockchainReputation.print_with_frame(message)#
Prints a large frame with a title inside :param message: Title to put into the frame
Returns: None
- Return type:
None
- class nebula.core.aggregation.blockchainReputation.BlockchainHandler(home_address)#
Handles interaction with Oracle and Non-Validator Node of Blockchain Network
- round#
- property oracle_url: str#
- Classmethod:
- Return type:
str
- property rest_header: Mapping[str, str]#
- Classmethod:
- Return type:
Mapping[str, str]
- verify_balance()#
Calls blockchain directly for requesting current balance Returns: None
- Return type:
None
- report_gas_oracle()#
Reports accumulated gas costs of all transactions made to the blockchain Returns: List of all accumulated gas costs per registered node
- Return type:
list
- report_reputation_oracle(records)#
Reports reputations used for aggregation Returns: None
- Parameters:
records (list)
- Return type:
None
- push_opinions(opinion_dict)#
Pushes all locally computed opinions of models to aggregate to the reputation system :param opinion_dict: Dict of all names:opinions for writing to the reputation system
Returns: Json of transaction receipt
- Parameters:
opinion_dict (dict)
- get_reputations(ip_addresses)#
Requests globally aggregated opinions values from reputation system for computing aggregation weights :param ip_addresses: Names of nodes of which the reputation values should be generated
Returns: Dictionary of name:reputation from the reputation system
- Parameters:
ip_addresses (list)
- Return type:
dict
- verify_registration()#
Verifies the successful registration of the node itself, executes registration again if reputation system returns false Returns: None
- Return type:
None
- report_time_oracle(start)#
Reports time used for aggregation Returns: None
- Parameters:
start (float)
- Return type:
None