risk_propagation.player module¶
Configuration of a bank
- class risk_propagation.player.Player(name, accounts, transactions, pool, paillier, delta_func=<function Player.<lambda>>)[source]¶
Bases:
object
Player class performing steps in protocol
- COMPENSATION_FACTOR = 1000000000000¶
- __init__(name, accounts, transactions, pool, paillier, delta_func=<function Player.<lambda>>)[source]¶
Initializes a player instance
- Parameters:
name (
str
) – the name of the playeraccounts (
ndarray
[Any
,dtype
[object_
]]) – an array of accounts containing an initial risk score per accounttransactions (
Union
[ndarray
[Any
,dtype
[object_
]],List
[ndarray
[Any
,dtype
[object_
]]]]) – an array containing arrays of transactions corresponding to periodspool (
Pool
) – the communication pool to usepaillier (
DistributedPaillier
) – an instance of DistributedPaillierdelta_func (
Callable
[[int
],float
]) – Callable function which uses the iteration index to determine the delta value (must be between [0 and 1)).
- async decrypt()[source]¶
Decryption of the risk scores per bank, compensating for the COMPENSATION_FACTOR
- Return type:
None
- property delta: float¶
The delta value for the current iteration
- Returns:
Float in the range of [0,1)
- Raises:
AssertionError – raised when the delta is not within the range [0..1)
- encrypt_initial_risk_scores()[source]¶
Encrypt the initialised risk scores of this player’s accounts
- Return type:
None
- property other_banks: Tuple[Bank, ...]¶
The other banks in the protocol
- Returns:
the other banks in the protocol
- property risk_scores: Dict[str, FixedPoint]¶
The plaintext risk scores belonging to this player’s bank
- Returns:
plaintext dictionary of risk scores
- Raises:
AttributeError – raised when risk scores are not available
- async run_protocol(iterations)[source]¶
Runs the entire protocol
- Parameters:
iterations (
int
) – the number of iterations to perform- Return type:
None