<jupyter_start><jupyter_text>MPC Tensor - Party 2 With Duet In this tutorial we will show you how to perform secure multiparty computation with data you cannot see. There are two parts/notebooks:* [POC-MPCTensor-Duet-Party1-DS](POC-MPCTensor-Duet-Party1-DS.ipynb). The data-scientist will be the responsible of perform any secure computation.* [POC-MPCTensor-Duet-Party2-DO](POC-MPCTensor-Duet-Party2-DO.ipynb) (this notebook). The Data Owner will store data in his Duet server and will be available for the data-scientist.  0 - Libraries Let's import the main libraries<jupyter_code>import torch  #  tensor computation
import syft as sy  # core library for remote execution

sy.load("sympc")  # openmined library which helps to perform mpc (see https://github.com/OpenMined/SyMPC)<jupyter_output><empty_output><jupyter_text>1 - Duet Server and connection to Data Owner (Party 2)  1.1 - Join to Data Scientist Duet Server (Party 1)<jupyter_code>duet_p1 = sy.join_duet(loopback=True)<jupyter_output><empty_output><jupyter_text>If you see a green message saying CONNECTED!, that means that everything was ok, however there is no data to work with.Now, the Data Owner wiill launch his own Duet server and will publish some data  1.2 - Launch a Duet Server<jupyter_code>duet_p2 = sy.launch_duet(loopback=True)<jupyter_output><empty_output><jupyter_text>Go now to [POC-MPCTensor-Duet-Party1-DS](POC-MPCTensor-Duet-Party1-DS.ipynb), execute Section 1.2 where the data scientist connect with the data owner, and continue with this notebook until the end.  2- Secret data Now the Data Owner will publish some data that he wants to share in a private way Let's check that there is no data at this moment in the server,<jupyter_code>duet_p2.store.pandas<jupyter_output><empty_output><jupyter_text>and let's publish the datasets  2.1 - Publish the secret data<jupyter_code>x = torch.tensor([50])
x.send(duet_p2, pointable=True, tags=["#test_tensor_1"], description= "Dummy tensor to test the sum of tensors")
x = torch.tensor([[1,2],[3,4]])
x.send(duet_p2, pointable=True, tags=["#test_tensor_2"], description= "Dummy tensor to test the matmul of tensors")<jupyter_output><empty_output><jupyter_text>Let's check again the stored data<jupyter_code>duet_p2.store.pandas<jupyter_output><empty_output><jupyter_text>If everything was ok, you should see a pandas dataframe with two rows corresponding to the stored datasets. Now the data-scientist has everything ready to perform remote operations via SMPC.  2.2 -  Automate request response Now the data owner instead of handling the requests manually, he will accept the request of type `reconstruct` automatically.<jupyter_code>duet_p2.requests.add_handler(
    action="accept"
)<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.08597449908925318, 'fraction_numerical': 0.01347905282331512, 'mean_word_length': 5.830845771144278, 'pattern_counts': {'":': 0, '<': 29, '<?xml version=': 0, '>': 29, 'https://': 1, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '7', 'dir': 'jupyter-structured-clean-dedup', 'id': '193604', 'license': 'Apache-1.1', 'n_tokens_mistral': 909, 'n_tokens_neox': 871, 'n_words': 301, 'path': 'packages/syft/examples/secure-multi-party-computation/Duet/1-DS-1-DO/POC-MPCTensor-Duet-Party2-DO.ipynb', 'repo_name': 'sanggusti/PySyft', 'size': '2745'}