Exemplo n.º 1
0
 def __init__(self, degree, public_key):
     self.degree = degree
     self.public_key = public_key
     M = int(degree * 4)
     poly_degree = M // 2
     self.encoder = CKKSEncoder(poly_degree=poly_degree)
     self.evaluator = CKKSEvaluator(poly_degree=poly_degree)
Exemplo n.º 2
0
 def __init__(self, degree, kernel='linear'):
     M = int(degree * 4)
     poly_degree = M // 2
     scale = 1 << 28
     big_modulus = 1 << 1200
     ciph_modulus = 1 << 600
     self.param = CKKSParameters(poly_degree=poly_degree,
                                 ciph_modulus=ciph_modulus,
                                 big_modulus=big_modulus,
                                 scaling_factor=scale)
     self.model = SVC(kernel=kernel)
     self.keygen = CKKSKeyGenerator(self.param)
     self.public_key = self.keygen.public_key
     self.secret_key = self.keygen.secret_key
     self.encoder = CKKSEncoder(param=self.param)
     self.encryptor = CKKSEncryptor(self.param, self.public_key,
                                    self.secret_key)
     self.decryptor = CKKSDecryptor(self.param, self.secret_key)
Exemplo n.º 3
0
 def __init__(self, degree, multi_class='ovr', solver='liblinear'):
     M = int(degree * 4)
     poly_degree = M // 2
     scale = 1 << 28
     big_modulus = 1 << 1200
     ciph_modulus = 1 << 600
     self.param = CKKSParameters(poly_degree=poly_degree,
                                 ciph_modulus=ciph_modulus,
                                 big_modulus=big_modulus,
                                 scaling_factor=scale)
     self.model = LogisticRegression(multi_class=multi_class, solver=solver)
     self.keygen = CKKSKeyGenerator(self.param)
     self.public_key = self.keygen.public_key
     self.secret_key = self.keygen.secret_key
     self.encoder = CKKSEncoder(param=self.param)
     self.encryptor = CKKSEncryptor(self.param, self.public_key,
                                    self.secret_key)
     self.decryptor = CKKSDecryptor(self.param, self.secret_key)