Skip to content

pycape#

codecov

pycape is a set of Python modules for interacting with your Cape Privacy data. Using pycape, you can:

  • Create and query dataviews, or pointers to the data that you want to use to train a model using Cape's encrypted learning protocol.
  • Submit and track jobs, which are computational sessions which contain instructions for how to train your model.

Short Tutorial#

Access your Cape projects by creating an instance of the main Cape class:

from pycape import Cape

c = Cape()
c.login()

my_projects = c.list_projects()

Add dataviews to your project, review dataviews added by other organizations collaborating with you in the project, and submit your job.

from pycape import VerticallyPartitionedLinearRegression

my_project = c.get_project("project_123")

my_project.create_dataview(name="my-data", uri="s3://my-data.csv" owner_label="my-org")

dvs = my_project.list_dataviews()

vlr_job = VerticallyPartitionedLinearRegression(
    train_dataview_x=dvs[0],
    train_dataview_y=dvs[1],
    model_owner="org_123",
)

my_project.submit_job(vlr_job)
See our example usage or a more in-depth tutorial.

Installation#

Prerequisites#

  • Python 3.6+
  • pip

Install via pip#

We recommend that you use a Python "Virtual Environment" when running applications with pycape.

Also ensure that your developement enviroment can access the Python Package Index (PyPI) via https.

Once you've activated your virtual enviroment, use pip to install pycape and it's dependencies:

$ pip install pycape

License#

Licensed under Apache License, Version 2.0.

See LICENSE or http://www.apache.org/licenses/LICENSE-2.0.