(self, num_epochs=1, batch_size=10, minibatch=None)
return comp, num_train_samples, update
Trains on self.model using the client's train_data.

        Args:
            num_epochs: Number of epochs to train. Unsupported if minibatch is provided (minibatch has only 1 epoch)
            batch_size: Size of training batches.
            minibatch: fraction of client's data to apply minibatch sgd,
                None to use FedAvg
        Return:
            comp: number of FLOPs executed in training process
            num_samples: number of samples used in training
            update: set of weights
            update_size: number of bytes in update
Trains on self.model using the client's train_data.
Trains on self . model using the client s train_data .
def train(self, num_epochs=1, batch_size=10, minibatch=None):
        """Trains on self.model using the client's train_data.

        Args:
            num_epochs: Number of epochs to train. Unsupported if minibatch is provided (minibatch has only 1 epoch)
            batch_size: Size of training batches.
            minibatch: fraction of client's data to apply minibatch sgd,
                None to use FedAvg
        Return:
            comp: number of FLOPs executed in training process
            num_samples: number of samples used in training
            update: set of weights
            update_size: number of bytes in update
        """
        if minibatch is None:
            data = self.train_data
            comp, update = self.model.train(data, num_epochs, batch_size)
        else:
            frac = min(1.0, minibatch)
            num_data = max(1, int(frac*len(self.train_data["x"])))
            xs, ys = zip(*random.sample(list(zip(self.train_data["x"], self.train_data["y"])), num_data))
            data = {'x': xs, 'y': ys}

            # Minibatch trains for only 1 epoch - multiple local epochs don't make sense!
            num_epochs = 1
            comp, update = self.model.train(data, num_epochs, num_data)
        num_train_samples = len(data['y'])
        return comp, num_train_samples, update
def train ( self , num_epochs = 1 , batch_size = 10 , minibatch = None ) : if minibatch is None : data = self . train_data comp , update = self . model . train ( data , num_epochs , batch_size ) else : frac = min ( 1.0 , minibatch ) num_data = max ( 1 , int ( frac * len ( self . train_data [ "x" ] ) ) ) xs , ys = zip ( * random . sample ( list ( zip ( self . train_data [ "x" ] , self . train_data [ "y" ] ) ) , num_data ) ) data = { 'x' : xs , 'y' : ys } # Minibatch trains for only 1 epoch - multiple local epochs don't make sense! num_epochs = 1 comp , update = self . model . train ( data , num_epochs , num_data ) num_train_samples = len ( data [ 'y' ] ) return comp , num_train_samples , update