Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Create_clients.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def create_clients(num, dir):
for k in range(num_classes):
temp = []
for j in range(num / 100):
temp = np.hstack((temp, k * num_examples/10 + np.random.permutation(num_examples/10)))
temp = np.hstack((temp, k * num_examples/10 + np.random.permutation(int(num_examples/10))))
buckets = np.hstack((buckets, temp))
shards = 2 * num
perm = np.random.permutation(shards)
Expand All @@ -35,7 +35,7 @@ def create_clients(num, dir):
# perm and stacking two shards together using vstack. Each client now holds 250*2 datapoints.
z.append(np.hstack((ind_list[int(perm[j])], ind_list[int(perm[j + 1])])))
# shuffle the data in each element of z, so that each client doesn't have all digits stuck together.
perm_2 = np.random.permutation(2 * len(buckets) / shards)
perm_2 = np.random.permutation(int(2 * len(buckets) / shards))
z[-1] = z[-1][perm_2]
filehandler = open(dir + '/'+str(num)+'_clients.pkl', "wb")
pickle.dump(z, filehandler)
Expand Down