Skip to main content

Getting started as a user

Overview

If your administrator has already hosted your dataset in AGENT, feel free to follow these steps to learn how to perform basic analysis. If you have yet to host a dataset or you are the administrator, jump over to Getting Started as an Administrator to understand how to manage the AGENT platform.

Quick Start

1
Downloading AGENT
  1. Open Jupyter Notebook or Google Colab, and install the AGENT package using pip.

    !pip install antigranular_enterprise &> /dev/null
  2. Import the AGENT library and connect to the AGENT Server using your client credentials. To find your <Config_URL> and <API Key>, head over to your profile.

    import antigranular_enterprise as ag
    ag.write_config("<Config_URL>", profile='default')
    ag_client = ag.login(api_key="<API key>")
  3. Follow the link to approve the log-in in the AGENT Console.

Users guide

From now on, any code cell that follows %%ag will run on the remote server, which operates under restricted conditions, allowing only methods that guarantee differential privacy.

2
Uploading a Dataset to AGENT
  1. To create a dataset, jump back to the AGENT website and follow the steps below:

    1. Access the Datasets menu on the sidebar.
    2. Click Add Dataset

    You can then continue to follow the steps and upload a dataset to configure it as you wish. For an extended tutorial on how to add or review datasets on the AGENT platform, follow Creating Datasets.

  2. Load a dataset to your AGENT container. This step will allow you to load the uploaded dataset into the variable dataset inside the %%ag enclave.

    %%ag
    from op_pandas import PrivateDataFrame, PrivateSeries

    # Obtaining the dictionary containing private objects
    dataset = load_dataset("<dataset_name>", "<team_name>")
3
Performing a Simple Analysis on AGENT
  1. To perform differentially private analysis on AGENT, you will need to perform a privacy budget request to the Platform Admin. Either yourself or your Team Admin on your behalf, can extend this request. Please follow Managing Requests to request a Privacy Budget. If you are unaware of your role in the platform, please review User Roles and Permissions.

  2. Now that your dataset is uploaded, you can continue to perform regular data analysis. Note that this uses 1 epsilon from your Privacy Budget. If you are not aware of what this means, or want a refresher on differential privacy fundamentals, please review Privacy Budget.

    %%ag
    # Load the dataset train_x table to a variable
    train_x = dataset["train_x"]

    # Describe the dataset (NOTE: This uses 1 epsilon of your budget)
    train_info = train_x.describe(eps=1)
  3. This will store a description of your dataset in train_info, you can now print this information using the ag_print method.

    ag_print(train_info)
4
Performing Analysis Outside of AGENT
  1. If you want to continue performing analysis on any component outside of the enclave, you can continue to export a variable back into your local enviroment. Note that you are only able to export non-private data types.

    # Export the non private information to the local environment
    export(train_info, "local_train_info") # Passes

    # Export the private information to the local environment
    export(dataset["train_x"], "local_train_data") # Yields an exception
  2. Outside of AG (when no %%ag used at the top of a block) you can print the variables that you previously exported and use that data freely without the need of using additional epsilon.

    # Local code block (No %%ag is used)
    print(local_train_info)
    --------------------------------------
    Age Salary
    count 99987.000000 99987.000000
    mean 38.435953 120009.334336
    std 12.167379 46255.486093
    min 18.257448 40048.259037
    25% 27.185189 80057.639960
    50% 38.210860 120380.291216
    75% 49.147724 159835.637091
    max 59.282932 199920.664706
Reference

Now that you have learned how to use AGENT and perform basic analysis, feel free to head over to References to review additional libraries to incorporate into your analysis.