utils
Useful objects/functions for federated learning.
This is primarily intended for use by modules outside of the federated
package.
It cannot be imported by most modules in the federated
package because it would
introduce circular imports.
Module
Functions
def hash(record: Any, hash_function: HashAlgorithm) ‑> int:
Compute the hash of an individual record.
Arguments
record
: The record to hash.hash_function
: the hash function to use.
Returns An integer corresponding to the hashed value of the record.
def hash_set( dataset: Union[pd.DataFrame, List[Any], pd.Series], hash_function: HashAlgorithm,) ‑> List[int]:
Hash the dataset with the given hash function.
Returns The hashed dataset as a list of integers.