def partition_dataset(data, labels, nb_teachers, teacher_id):
 assert (len(data) == len(labels))
 assert (int(teacher_id) < int(nb_teachers))
 batch_len = int((len(data) / nb_teachers))
 start = (teacher_id * batch_len)
 end = ((teacher_id + 1) * batch_len)
 partition_data = data[start:end]
 partition_labels = labels[start:end]
 return (partition_data, partition_labels)

def partition_dataset ( data , labels , nb_teachers , teacher_id ) : assert ( len ( data ) == len ( labels ) ) assert ( int ( teacher_id ) < int ( nb_teachers ) ) batch_len = int ( ( len ( data ) / nb_teachers ) ) start = ( teacher_id * batch_len ) end = ( ( teacher_id + 1 ) * batch_len ) partition_data = data [ start : end ] partition_labels = labels [ start : end ] return ( partition_data , partition_labels )
simple partitioning algorithm that returns the right portion of the data needed by a given teacher out of a certain nb of teachers .