Part 5 - Welcome to the Sandbox

In the last tutorials, we've been initializing our hook and all of our workers by hand every time. This can be a bit annoying when you're just playing around / learning about the interfaces. So, from here on out we'll be creating all these same variables using a special convenience function.


In [ ]:
import torch
import syft as sy
sy.create_sandbox(globals())

What does the sandbox give us?

As you can see above, we created several virtual workers and loaded in lots of test dataset, distributing them around the various workers so that we can practice using privacy preserving techniques such as Federated Learning.

We created six workers....


In [ ]:
workers

We also populated lots of global variables which we can use right away!


In [ ]:
hook

In [ ]:
bob

Part 2: Worker Search Functionality

One important aspect of doing remote data science is that we want the ability to search for datasets on a remote machine. Think of a research lab wanting to query hospitals for maybe "radio" datasets.


In [ ]:
x = torch.tensor([1,2,3,4,5]).tag("#fun", "#boston", "#housing").describe("The input datapoints to the boston housing dataset.")
y = torch.tensor([1,2,3,4,5]).tag("#fun", "#boston", "#housing").describe("The input datapoints to the boston housing dataset.")
z = torch.tensor([1,2,3,4,5]).tag("#fun", "#mnist",).describe("The images in the MNIST training dataset.")

In [ ]:
x

In [ ]:
x = x.send(bob)
y = y.send(bob)
z = z.send(bob)

# this searches for exact match within a tag or within the description
results = bob.search(["#boston", "#housing"])

In [ ]:
results

In [ ]:
print(results[0].description)

Part 3: Virtual Grid

A Grid is simply a collection of workers which gives you some convenience functions for when you want to put together a dataset.


In [ ]:
grid = sy.PrivateGridNetwork(*workers)

In [ ]:
results = grid.search("#boston")

In [ ]:
boston_data = grid.search("#boston","#data")

In [ ]:
boston_target = grid.search("#boston","#target")

In [ ]: