def __init__(self, penalty='L2', tol=1e-4, alpha=1.0, optimizer='rmsprop', batch_size=-1, learning_rate=0.01, init_param=InitParam(), max_iter=20, early_stop='diff', exposure_colname = None, predict_param=PredictParam(), encrypt_param=EncryptParam(), encrypted_mode_calculator_param=EncryptedModeCalculatorParam(), cv_param=CrossValidationParam(), stepwise_param=StepwiseParam(), decay=1, decay_sqrt=True, validation_freqs=None, early_stopping_rounds=None, metrics=None, use_first_metric_only=False, floating_point_precision=23): super(PoissonParam, self).__init__() self.penalty = penalty self.tol = tol self.alpha = alpha self.optimizer = optimizer self.batch_size = batch_size self.learning_rate = learning_rate self.init_param = copy.deepcopy(init_param) self.max_iter = max_iter self.early_stop = early_stop self.encrypt_param = encrypt_param self.encrypted_mode_calculator_param = copy.deepcopy(encrypted_mode_calculator_param) self.cv_param = copy.deepcopy(cv_param) self.predict_param = copy.deepcopy(predict_param) self.decay = decay self.decay_sqrt = decay_sqrt self.exposure_colname = exposure_colname self.validation_freqs = validation_freqs self.stepwise_param = stepwise_param self.early_stopping_rounds = early_stopping_rounds self.metrics = metrics or [] self.use_first_metric_only = use_first_metric_only self.floating_point_precision = floating_point_precision
def __init__(self, penalty='L2', tol=1e-4, alpha=1.0, optimizer='rmsprop', batch_size=-1, learning_rate=0.01, init_param=InitParam(), max_iter=100, early_stop='diff', encrypted_mode_calculator_param=EncryptedModeCalculatorParam(), predict_param=PredictParam(), cv_param=CrossValidationParam(), decay=1, decay_sqrt=True, sqn_param=StochasticQuasiNewtonParam(), multi_class='ovr', validation_freqs=None, early_stopping_rounds=None, metrics=['auc', 'ks'], use_first_metric_only=False, stepwise_param=StepwiseParam() ): super(HeteroLogisticParam, self).__init__(penalty=penalty, tol=tol, alpha=alpha, optimizer=optimizer, batch_size=batch_size, learning_rate=learning_rate, init_param=init_param, max_iter=max_iter, early_stop=early_stop, predict_param=predict_param, cv_param=cv_param, decay=decay, decay_sqrt=decay_sqrt, multi_class=multi_class, validation_freqs=validation_freqs, early_stopping_rounds=early_stopping_rounds, metrics=metrics, use_first_metric_only=use_first_metric_only, stepwise_param=stepwise_param) self.encrypted_mode_calculator_param = copy.deepcopy(encrypted_mode_calculator_param) self.sqn_param = copy.deepcopy(sqn_param)
def __init__(self, penalty='L2', tol=1e-5, alpha=1.0, optimizer='sgd', batch_size=-1, learning_rate=0.01, init_param=InitParam(), max_iter=100, early_stop='diff', encrypt_param=EncryptParam(), predict_param=PredictParam(), cv_param=CrossValidationParam(), decay=1, decay_sqrt=True, multi_class='ovr', validation_freqs=None): super(LogisticParam, self).__init__() self.penalty = penalty self.tol = tol self.alpha = alpha self.optimizer = optimizer self.batch_size = batch_size self.learning_rate = learning_rate self.init_param = copy.deepcopy(init_param) self.max_iter = max_iter self.early_stop = early_stop self.encrypt_param = encrypt_param self.predict_param = copy.deepcopy(predict_param) self.cv_param = copy.deepcopy(cv_param) self.decay = decay self.decay_sqrt = decay_sqrt self.multi_class = multi_class self.validation_freqs = validation_freqs
def __init__(self, penalty=None, tol=1e-4, alpha=1.0, optimizer='sgd', batch_size=-1, learning_rate=0.01, init_param=InitParam(), max_iter=100, early_stop='diff', encrypt_param=EncryptParam(), predict_param=PredictParam(), cv_param=CrossValidationParam(), decay=1, decay_sqrt=True, multi_class='ovr', use_mix_rand=True, reveal_strategy="respectively", reveal_every_iter=True, callback_param=CallbackParam(), encrypted_mode_calculator_param=EncryptedModeCalculatorParam() ): super(LogisticRegressionParam, self).__init__() self.penalty = penalty self.tol = tol self.alpha = alpha self.optimizer = optimizer self.batch_size = batch_size self.learning_rate = learning_rate self.init_param = copy.deepcopy(init_param) self.max_iter = max_iter self.early_stop = early_stop self.encrypt_param = encrypt_param self.predict_param = copy.deepcopy(predict_param) self.decay = decay self.decay_sqrt = decay_sqrt self.multi_class = multi_class self.use_mix_rand = use_mix_rand self.reveal_strategy = reveal_strategy self.reveal_every_iter = reveal_every_iter self.callback_param = copy.deepcopy(callback_param) self.cv_param = copy.deepcopy(cv_param) self.encrypted_mode_calculator_param = copy.deepcopy(encrypted_mode_calculator_param)
def __init__(self, penalty='L2', tol=1e-4, alpha=1.0, optimizer='sgd', batch_size=-1, learning_rate=0.01, init_param=InitParam(), max_iter=20, early_stop='diff', predict_param=PredictParam(), encrypt_param=EncryptParam(), sqn_param=StochasticQuasiNewtonParam(), encrypted_mode_calculator_param=EncryptedModeCalculatorParam(), cv_param=CrossValidationParam(), decay=1, decay_sqrt=True, validation_freqs=None, early_stopping_rounds=None, stepwise_param=StepwiseParam(), metrics=None, use_first_metric_only=False): super(LinearParam, self).__init__() self.penalty = penalty self.tol = tol self.alpha = alpha self.optimizer = optimizer self.batch_size = batch_size self.learning_rate = learning_rate self.init_param = copy.deepcopy(init_param) self.max_iter = max_iter self.early_stop = early_stop self.encrypt_param = encrypt_param self.encrypted_mode_calculator_param = copy.deepcopy(encrypted_mode_calculator_param) self.cv_param = copy.deepcopy(cv_param) self.predict_param = copy.deepcopy(predict_param) self.decay = decay self.decay_sqrt = decay_sqrt self.validation_freqs = validation_freqs self.sqn_param = copy.deepcopy(sqn_param) self.early_stopping_rounds = early_stopping_rounds self.stepwise_param = copy.deepcopy(stepwise_param) self.metrics = metrics or [] self.use_first_metric_only = use_first_metric_only
def __init__(self, penalty='L2', tol=1e-4, alpha=1.0, optimizer='rmsprop', batch_size=-1, learning_rate=0.01, init_param=InitParam(), max_iter=100, early_stop='diff', encrypt_param=EncryptParam(), re_encrypt_batches=2, predict_param=PredictParam(), cv_param=CrossValidationParam(), decay=1, decay_sqrt=True, aggregate_iters=1, multi_class='ovr', validation_freqs=None, early_stopping_rounds=None, metrics=['auc', 'ks'], use_first_metric_only=False, use_proximal=False, mu=0.1 ): super(HomoLogisticParam, self).__init__(penalty=penalty, tol=tol, alpha=alpha, optimizer=optimizer, batch_size=batch_size, learning_rate=learning_rate, init_param=init_param, max_iter=max_iter, early_stop=early_stop, encrypt_param=encrypt_param, predict_param=predict_param, cv_param=cv_param, multi_class=multi_class, validation_freqs=validation_freqs, decay=decay, decay_sqrt=decay_sqrt, early_stopping_rounds=early_stopping_rounds, metrics=metrics, use_first_metric_only=use_first_metric_only) self.re_encrypt_batches = re_encrypt_batches self.aggregate_iters = aggregate_iters self.use_proximal = use_proximal self.mu = mu
def __init__(self, penalty='L2', tol=1e-4, alpha=1.0, optimizer='rmsprop', batch_size=-1, learning_rate=0.01, init_param=InitParam(), max_iter=100, early_stop='diff', encrypt_param=EncryptParam(), predict_param=PredictParam(), cv_param=CrossValidationParam(), decay=1, decay_sqrt=True, multi_class='ovr', validation_freqs=None, early_stopping_rounds=None, stepwise_param=StepwiseParam(), metrics=None, use_first_metric_only=False ): super(LogisticParam, self).__init__() self.penalty = penalty self.tol = tol self.alpha = alpha self.optimizer = optimizer self.batch_size = batch_size self.learning_rate = learning_rate self.init_param = copy.deepcopy(init_param) self.max_iter = max_iter self.early_stop = early_stop self.encrypt_param = encrypt_param self.predict_param = copy.deepcopy(predict_param) self.cv_param = copy.deepcopy(cv_param) self.decay = decay self.decay_sqrt = decay_sqrt self.multi_class = multi_class self.validation_freqs = validation_freqs self.stepwise_param = copy.deepcopy(stepwise_param) self.early_stopping_rounds = early_stopping_rounds self.metrics = metrics or [] self.use_first_metric_only = use_first_metric_only
def load_model(self, model_dict): LOGGER.debug("Start Loading model") result_obj = list(model_dict.get('model').values())[0].get(self.model_param_name) meta_obj = list(model_dict.get('model').values())[0].get(self.model_meta_name) if self.init_param_obj is None: self.init_param_obj = InitParam() self.init_param_obj.fit_intercept = meta_obj.fit_intercept self.model_param.reveal_strategy = meta_obj.reveal_strategy LOGGER.debug(f"reveal_strategy: {self.model_param.reveal_strategy}, {self.is_respectively_reveal}") self.header = list(result_obj.header) return result_obj, meta_obj
def __init__( self, penalty='L2', tol=1e-4, alpha=1.0, optimizer='sgd', batch_size=-1, learning_rate=0.01, init_param=InitParam(), max_iter=20, early_stop='diff', encrypt_param=EncryptParam(), sqn_param=StochasticQuasiNewtonParam(), encrypted_mode_calculator_param=EncryptedModeCalculatorParam(), cv_param=CrossValidationParam(), decay=1, decay_sqrt=True, validation_freqs=None, early_stopping_rounds=None, stepwise_param=StepwiseParam(), metrics=None, use_first_metric_only=False, floating_point_precision=23, callback_param=CallbackParam()): super(LinearParam, self).__init__(penalty=penalty, tol=tol, alpha=alpha, optimizer=optimizer, batch_size=batch_size, learning_rate=learning_rate, init_param=init_param, max_iter=max_iter, early_stop=early_stop, encrypt_param=encrypt_param, cv_param=cv_param, decay=decay, decay_sqrt=decay_sqrt, validation_freqs=validation_freqs, early_stopping_rounds=early_stopping_rounds, stepwise_param=stepwise_param, metrics=metrics, use_first_metric_only=use_first_metric_only, floating_point_precision=floating_point_precision, callback_param=callback_param) self.sqn_param = copy.deepcopy(sqn_param) self.encrypted_mode_calculator_param = copy.deepcopy( encrypted_mode_calculator_param)
def __init__( self, penalty='L2', tol=1e-4, alpha=1.0, optimizer='sgd', batch_size=-1, learning_rate=0.01, init_param=InitParam(), max_iter=100, early_stop='diff', encrypt_param=EncryptParam(), predict_param=PredictParam(), cv_param=CrossValidationParam(), decay=1, decay_sqrt=True, multi_class='ovr', use_mix_rand=True, reveal_strategy="respectively", reveal_every_iter=False, callback_param=CallbackParam(), encrypted_mode_calculator_param=EncryptedModeCalculatorParam()): super(HeteroSSHELRParam, self).__init__(penalty=penalty, tol=tol, alpha=alpha, optimizer=optimizer, batch_size=batch_size, learning_rate=learning_rate, init_param=init_param, max_iter=max_iter, early_stop=early_stop, predict_param=predict_param, cv_param=cv_param, decay=decay, decay_sqrt=decay_sqrt, multi_class=multi_class, encrypt_param=encrypt_param, callback_param=callback_param) self.use_mix_rand = use_mix_rand self.reveal_strategy = reveal_strategy self.reveal_every_iter = reveal_every_iter self.encrypted_mode_calculator_param = copy.deepcopy( encrypted_mode_calculator_param)
def __init__(self, penalty='L2', tol=1e-4, alpha=1.0, optimizer='sgd', batch_size=-1, learning_rate=0.01, init_param=InitParam(), max_iter=100, early_stop='diff', encrypt_param=EncryptParam(), cv_param=CrossValidationParam(), decay=1, decay_sqrt=True, validation_freqs=None, early_stopping_rounds=None, stepwise_param=StepwiseParam(), metrics=None, use_first_metric_only=False, floating_point_precision=23, callback_param=CallbackParam()): super(LinearModelParam, self).__init__() self.penalty = penalty self.tol = tol self.alpha = alpha self.optimizer = optimizer self.batch_size = batch_size self.learning_rate = learning_rate self.init_param = copy.deepcopy(init_param) self.max_iter = max_iter self.early_stop = early_stop self.encrypt_param = encrypt_param self.cv_param = copy.deepcopy(cv_param) self.decay = decay self.decay_sqrt = decay_sqrt self.validation_freqs = validation_freqs self.early_stopping_rounds = early_stopping_rounds self.stepwise_param = copy.deepcopy(stepwise_param) self.metrics = metrics or [] self.use_first_metric_only = use_first_metric_only self.floating_point_precision = floating_point_precision self.callback_param = copy.deepcopy(callback_param)
def __init__( self, penalty='L2', tol=1e-5, alpha=1.0, optimizer='sgd', batch_size=-1, learning_rate=0.01, init_param=InitParam(), max_iter=100, early_stop='diff', exposure_colname=None, predict_param=PredictParam(), encrypt_param=EncryptParam(), encrypted_mode_calculator_param=EncryptedModeCalculatorParam(), cv_param=CrossValidationParam(), decay=1, decay_sqrt=True, validation_freqs=None): super(PoissonParam, self).__init__() self.penalty = penalty self.tol = tol self.alpha = alpha self.optimizer = optimizer self.batch_size = batch_size self.learning_rate = learning_rate self.init_param = copy.deepcopy(init_param) self.max_iter = max_iter self.early_stop = early_stop self.encrypt_param = encrypt_param self.encrypted_mode_calculator_param = copy.deepcopy( encrypted_mode_calculator_param) self.cv_param = copy.deepcopy(cv_param) self.predict_param = copy.deepcopy(predict_param) self.decay = decay self.decay_sqrt = decay_sqrt self.exposure_colname = exposure_colname self.validation_freqs = validation_freqs
def __init__(self, penalty='L2', tol=1e-5, alpha=1.0, optimizer='sgd', batch_size=-1, learning_rate=0.01, init_param=InitParam(), max_iter=100, early_stop='diff', encrypt_param=EncryptParam(), re_encrypt_batches=2, predict_param=PredictParam(), cv_param=CrossValidationParam(), decay=1, decay_sqrt=True, aggregate_iters=1, multi_class='ovr', validation_freqs=None): super(HomoLogisticParam, self).__init__(penalty=penalty, tol=tol, alpha=alpha, optimizer=optimizer, batch_size=batch_size, learning_rate=learning_rate, init_param=init_param, max_iter=max_iter, early_stop=early_stop, encrypt_param=encrypt_param, predict_param=predict_param, cv_param=cv_param, multi_class=multi_class, validation_freqs=validation_freqs, decay=decay, decay_sqrt=decay_sqrt) self.re_encrypt_batches = re_encrypt_batches self.aggregate_iters = aggregate_iters
def __init__( self, penalty='L2', tol=1e-5, alpha=1.0, optimizer='sgd', batch_size=-1, learning_rate=0.01, init_param=InitParam(), max_iter=100, early_stop='diff', encrypted_mode_calculator_param=EncryptedModeCalculatorParam(), predict_param=PredictParam(), cv_param=CrossValidationParam(), decay=1, decay_sqrt=True, sqn_param=StochasticQuasiNewtonParam(), multi_class='ovr', validation_freqs=None): super(HeteroLogisticParam, self).__init__(penalty=penalty, tol=tol, alpha=alpha, optimizer=optimizer, batch_size=batch_size, learning_rate=learning_rate, init_param=init_param, max_iter=max_iter, early_stop=early_stop, predict_param=predict_param, cv_param=cv_param, decay=decay, decay_sqrt=decay_sqrt, multi_class=multi_class, validation_freqs=validation_freqs) self.encrypted_mode_calculator_param = copy.deepcopy( encrypted_mode_calculator_param) self.sqn_param = copy.deepcopy(sqn_param)