(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())
Args:
            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.
                Default: None
                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: 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: now only 'tf-keras' is supported
            batch_size: batch size when computing transformed feature embedding, -1 use full data.
            encrypte_param: encrypted param
            encrypted_mode_calculator_param:
            predict_param: predict param
            mode:
                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: local update round when using communication efficient
Args:
            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.
                Default: None
                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: 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: now only 'tf-keras' is supported
            batch_size: batch size when computing transformed feature embedding, -1 use full data.
            encrypte_param: encrypted param
            encrypted_mode_calculator_param:
            predict_param: predict param
            mode:
                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: local update round when using communication efficient
Args : 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 . Default : None 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 : 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 : now only tf - keras is supported batch_size : batch size when computing transformed feature embedding - 1 use full data . encrypte_param : encrypted param encrypted_mode_calculator_param : predict_param : predict param mode : 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 : local update round when using communication efficient
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()):

        """
        Args:
            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.
                Default: None
                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: 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: now only 'tf-keras' is supported
            batch_size: batch size when computing transformed feature embedding, -1 use full data.
            encrypte_param: encrypted param
            encrypted_mode_calculator_param:
            predict_param: predict param
            mode:
                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: 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)
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 ( ) ) : 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 )