Repository: federatedai/fate
Issue: hetero pearson not work when role arbiter configured in conf

**Describe the bug**
hetero pearson not work when role arbiter configured in conf，which makes pearson hard to cooperate with other algorithms in single conf.


Changed files:
federatedml/transfer_variable/base_transfer_variable.py, arch/api/federation.py, federatedml/statistic/correlation/hetero_pearson.py

diff --git a/arch/api/federation.py b/arch/api/federation.py
index 32d2d745e..63c1ede94 100644
--- a/arch/api/federation.py
+++ b/arch/api/federation.py
@@ -65,6 +65,10 @@ def local_party():
     return RuntimeInstance.FEDERATION.local_party
 
 
+def roles_to_parties(roles: list) -> list:
+    return RuntimeInstance.FEDERATION.roles_to_parties(roles)
+
+
 @deprecated.deprecated(version='1.2.0', reason="please use `get` api in transfer_variable instead")
 def get(name, tag: str, idx=-1):
     """
diff --git a/federatedml/statistic/correlation/hetero_pearson.py b/federatedml/statistic/correlation/hetero_pearson.py
index abf06cc75..c148ccd8a 100644
--- a/federatedml/statistic/correlation/hetero_pearson.py
+++ b/federatedml/statistic/correlation/hetero_pearson.py
@@ -35,7 +35,21 @@ class HeteroPearson(ModelBase):
         self.callback_metrics = []
         self.corr = None
         self.local_corr = None
-        self._parties = federation.all_parties()
+
+        # since multi-host not supported yet, we assume parties are one from guest and one from host
+        self._parties = []
+        guest_parties = federation.roles_to_parties(["guest"])
+        if len(guest_parties) != 1:
+            raise ValueError(f"num of guest party should be one, but {len(guest_parties)} provided")
+        self._parties.extend(guest_parties)
+
+        host_parties = federation.roles_to_parties(["host"])
+        if len(host_parties) < 1:
+            raise ValueError(f"no host party found")
+        if len(host_parties) > 1:
+            raise ValueError(f"multi-host not supported yet, {len(host_parties)} provided")
+        self._parties.extend(host_parties)
+
         self._local_party = federation.local_party()
         self._other_party = self._parties[0] if self._parties[0] != self._local_party else self._parties[1]
         self.shapes = []
@@ -92,7 +106,7 @@ class HeteroPearson(ModelBase):
         n, normed = self._standardized(data)
         self.local_corr = table_dot(normed, normed)
 
-        with SPDZ("pearson") as spdz:
+        with SPDZ("pearson", local_party=self._local_party, all_parties=self._parties) as spdz:
             source = [normed, self._other_party]
             if self._local_party.role == "guest":
                 x, y = FixedPointTensor.from_source("x", source[0]), FixedPointTensor.from_source("y", source[1])
diff --git a/federatedml/transfer_variable/base_transfer_variable.py b/federatedml/transfer_variable/base_transfer_variable.py
index 38c6ad020..2fbbfac3f 100644
--- a/federatedml/transfer_variable/base_transfer_variable.py
+++ b/federatedml/transfer_variable/base_transfer_variable.py
@@ -185,3 +185,7 @@ class BaseTransferVariables(object):
     @staticmethod
     def local_party():
         return RuntimeInstance.FEDERATION.local_party
+
+    @staticmethod
+    def roles_to_parties(roles: list) -> list:
+        return RuntimeInstance.FEDERATION.roles_to_parties(roles)