def test_initializer(self):
     initializer = Initializer()
     data_shape = 10
     init_param_obj = InitParam(init_method=consts.RANDOM_NORMAL,
                                init_const=20,
                                fit_intercept=False
                                )
     model = initializer.init_model(model_shape=data_shape, init_params=init_param_obj)
     model_shape = np.array(model).shape
     self.assertTrue(model_shape == (10,))
Exemple #2
0
 def __init__(self):
     super(BaseLinearModel, self).__init__()
     # attribute:
     self.n_iter_ = 0
     self.classes_ = None
     self.feature_shape = None
     self.gradient_operator = None
     self.initializer = Initializer()
     self.transfer_variable = None
     self.loss_history = []
     self.is_converged = False
     self.header = None
     self.model_name = 'toSet'
     self.model_param_name = 'toSet'
     self.model_meta_name = 'toSet'
     self.role = ''
     self.mode = ''
     self.schema = {}
     self.cipher_operator = None
     self.model_weights = None
     self.validation_freqs = None
     self.need_one_vs_rest = False
     self.need_call_back_loss = True
     self.init_param_obj = None
     self.validation_strategy = None
Exemple #3
0
    def __init__(self):
        super(BaseFactorizationMachine, self).__init__()

        # attribute:
        self.initializer = Initializer()
        self.model_name = 'FactorizationMachine'
        self.model_param_name = 'FactorizationMachineParam'
        self.model_meta_name = 'FactorizationMachineMeta'
        self.n_iter_ = 0
        self.classes_ = None
        self.feature_shape = None
        self.gradient_operator = None
        self.transfer_variable = None
        self.loss_history = []
        self.is_converged = False
        self.header = None
        self.role = ''
        self.mode = ''
        self.schema = {}
        self.cipher_operator = None
        self.model_weights = None
        self.validation_freqs = None

        # one_ve_rest parameter
        self.in_one_vs_rest = False
        self.need_one_vs_rest = None
        self.one_vs_rest_classes = []
        self.one_vs_rest_obj = None
    def __init__(self):
        super(BaseLogisticRegression, self).__init__()
        # attribute:

        self.initializer = Initializer()
        self.model_name = 'LogisticRegression'
        self.model_param_name = 'LogisticRegressionParam'
        self.model_meta_name = 'LogisticRegressionMeta'

        # one_ve_rest parameter
        self.need_one_vs_rest = None
        self.one_vs_rest_classes = []
        self.one_vs_rest_obj = None
Exemple #5
0
    def __init__(self):
        super(BaseLinearRegression, self).__init__()
        self.model_param = LinearParam()
        # attribute:
        self.n_iter_ = 0
        self.feature_shape = None

        self.gradient_operator = None
        self.initializer = Initializer()
        self.transfer_variable = None
        self.loss_history = []
        self.is_converged = False
        self.header = None
        self.model_name = 'LinearRegression'
        self.model_param_name = 'LinearRegressionParam'
        self.model_meta_name = 'LinearRegressionMeta'
        self.role = ''
        self.mode = ''
        self.schema = {}
        self.cipher_operator = PaillierEncrypt()