def __init__(self): super().__init__() self.model_param = IntersectParam() self.transfer_variable = None self._guest_id = None self._host_id = None self._host_id_list = None
def setUp(self): self.jobid = str(uuid.uuid1()) session.init(self.jobid) from federatedml.statistic.intersect.intersect_host import RsaIntersectionHost from federatedml.statistic.intersect.intersect_host import RawIntersectionHost intersect_param = IntersectParam() self.rsa_operator = RsaIntersectionHost(intersect_param) self.raw_operator = RawIntersectionHost(intersect_param)
def setUp(self): self.jobid = str(uuid.uuid1()) session.init(self.jobid) from federatedml.statistic.intersect_deprecated.intersect_guest import RsaIntersectionGuest from federatedml.statistic.intersect_deprecated.intersect import RsaIntersect intersect_param = IntersectParam() self.rsa_operator = RsaIntersectionGuest(intersect_param) self.rsa_op2 = RsaIntersect(intersect_param)
def __init__(self): super().__init__() self.intersection_obj = None self.intersect_num = -1 self.intersect_rate = -1 self.intersect_ids = None self.metric_name = "intersection" self.metric_namespace = "train" self.metric_type = "INTERSECTION" self.model_param = IntersectParam() self.role = None
def _init_model(self, param: SecureInformationRetrievalParam): self._init_base_model(param) self.intersection_obj = DhIntersectionGuest() self.intersection_obj.role = consts.GUEST intersect_param = IntersectParam(dh_params=self.dh_params) self.intersection_obj.load_params(intersect_param) self.intersection_obj.host_party_id_list = self.component_properties.host_party_idlist self.intersection_obj.guest_party_id = self.component_properties.guest_partyid if self.model_param.oblivious_transfer_protocol == consts.OT_HAUCK.lower(): self.oblivious_transfer = HauckObliviousTransferReceiver() else: raise ValueError("SIR only supports Hauck's OT")
def __init__(self): super().__init__() self.cache_id = None self.model_param = IntersectParam() self.transfer_variable = None self.cache_transfer_variable = IntersectionFuncTransferVariable( ).cache_id_from_host self.filter = None self.intersect_num = None self.cache = None self.model_param_name = "IntersectModelParam" self.model_meta_name = "IntersectModelMeta" self._guest_id = None self._host_id = None self._host_id_list = None
def __init__(self): super().__init__() self.intersection_obj = None self.intersect_num = -1 self.intersect_rate = -1 self.intersect_ids = None self.metric_name = "intersection" self.metric_namespace = "train" self.metric_type = "INTERSECTION" self.model_param = IntersectParam() self.role = None self.guest_party_id = None self.host_party_id = None self.host_party_id_list = None self.transfer_variable = IntersectionFuncTransferVariable()
def __init__(self): super().__init__() self.intersection_obj = None self.proc_obj = None self.intersect_num = -1 self.intersect_rate = -1 self.unmatched_num = -1 self.unmatched_rate = -1 self.intersect_ids = None self.metric_name = "intersection" self.metric_namespace = "train" self.metric_type = "INTERSECTION" self.model_param_name = "IntersectModelParam" self.model_meta_name = "IntersectModelMeta" self.model_param = IntersectParam() self.use_match_id_process = False self.role = None self.guest_party_id = None self.host_party_id = None self.host_party_id_list = None self.transfer_variable = IntersectionFuncTransferVariable()
def __init__(self, alpha=1, tol=0.000001, n_iter_no_change=False, validation_freqs=None, optimizer={ 'optimizer': 'Adam', 'learning_rate': 0.01 }, nn_define={}, epochs=1, intersect_param=IntersectParam(consts.RSA), config_type='keras', batch_size=-1, encrypte_param=EncryptParam(), encrypted_mode_calculator_param=EncryptedModeCalculatorParam( mode="confusion_opt"), predict_param=PredictParam(), mode='plain', communication_efficient=False, local_round=5, callback_param=CallbackParam()): """ Parameters ---------- alpha : float a loss coefficient defined in paper, it defines the importance of alignment loss tol : float loss tolerance n_iter_no_change : bool check loss convergence or not validation_freqs : None or positive integer or container object in python Do validation in training process or Not. if equals None, will not do validation in train process; if equals positive integer, will validate data every validation_freqs epochs passes; if container object in python, will validate data if epochs belong to this container. e.g. validation_freqs = [10, 15], will validate data when epoch equals to 10 and 15. The default value is None, 1 is suggested. You can set it to a number larger than 1 in order to speed up training by skipping validation rounds. When it is larger than 1, a number which is divisible by "epochs" is recommended, otherwise, you will miss the validation scores of last training epoch. optimizer : str or dict optimizer method, accept following types: 1. a string, one of "Adadelta", "Adagrad", "Adam", "Adamax", "Nadam", "RMSprop", "SGD" 2. a dict, with a required key-value pair keyed by "optimizer", with optional key-value pairs such as learning rate. defaults to "SGD" nn_define : dict a dict represents the structure of neural network, it can be output by tf-keras epochs : int epochs num intersect_param define the intersect method config_type : {'tf-keras'} config type batch_size : int batch size when computing transformed feature embedding, -1 use full data. encrypte_param encrypted param encrypted_mode_calculator_param encrypted mode calculator param: predict_param predict param mode: {"plain", "encrypted"} plain: will not use any encrypt algorithms, data exchanged in plaintext encrypted: use paillier to encrypt gradients communication_efficient: bool will use communication efficient or not. when communication efficient is enabled, FTL model will update gradients by several local rounds using intermediate data local_round: int local update round when using communication efficient """ super(FTLParam, self).__init__() self.alpha = alpha self.tol = tol self.n_iter_no_change = n_iter_no_change self.validation_freqs = validation_freqs self.optimizer = optimizer self.nn_define = nn_define self.epochs = epochs self.intersect_param = copy.deepcopy(intersect_param) self.config_type = config_type self.batch_size = batch_size self.encrypted_mode_calculator_param = copy.deepcopy( encrypted_mode_calculator_param) self.encrypt_param = copy.deepcopy(encrypte_param) self.predict_param = copy.deepcopy(predict_param) self.mode = mode self.communication_efficient = communication_efficient self.local_round = local_round self.callback_param = copy.deepcopy(callback_param)