federated/data/data_preprocessing.py
def create_tff_dataset(clients_data: Dict) -> tff.simulation.ClientData:
    """Function converts dictionary to tensorflow federated dataset.

    Args:
        clients_data (Dict): Inputs.

    Returns:
        tff.simulation.ClientData: Returns federated data distribution.
    """
    client_dataset = collections.OrderedDict()

    for client in clients_data:
        data = collections.OrderedDict(
            (
                ("label", np.array(clients_data[client][1], dtype=np.int32)),
                ("datapoints", np.array(clients_data[client][0], dtype=np.float32)),
            )
        )
        client_dataset[client] = data

    return tff.simulation.FromTensorSlicesClientData(client_dataset)
Function converts dictionary to tensorflow federated dataset.

    Args:
        clients_data (Dict): Inputs.

    Returns:
        tff.simulation.ClientData: Returns federated data distribution.
    
Function converts dictionary to tensorflow federated dataset.
Function converts dictionary to tensorflow federated dataset .
def create_tff_dataset(clients_data: Dict) -> tff.simulation.ClientData:
    client_dataset = collections.OrderedDict()
    for client in clients_data:
        data = collections.OrderedDict(
            (
                ("label", np.array(clients_data[client][1], dtype=np.int32)),
                ("datapoints", np.array(clients_data[client][0], dtype=np.float32)),
            )
        )
        client_dataset[client] = data
    return tff.simulation.FromTensorSlicesClientData(client_dataset)
def create_tff_dataset ( clients_data : Dict ) -> tff . simulation . ClientData : client_dataset = collections . OrderedDict ( ) for client in clients_data : data = collections . OrderedDict ( ( ( "label" , np . array ( clients_data [ client ] [ 1 ] , dtype = np . int32 ) ) , ( "datapoints" , np . array ( clients_data [ client ] [ 0 ] , dtype = np . float32 ) ) , ) ) client_dataset [ client ] = data return tff . simulation . FromTensorSlicesClientData ( client_dataset )
Function converts dictionary to tensorflow federated dataset.
Function converts dictionary to tensorflow federated dataset .
"""Function converts dictionary to tensorflow federated dataset.

    Args:
        clients_data (Dict): Inputs.

    Returns:
        tff.simulation.ClientData: Returns federated data distribution.
    """
Returns federated data distribution.
Returns federated data distribution .
tff.simulation.ClientData
clients_data
Dict
None