Closed SerhatBah closed 1 year ago
The len
function is a bit misleading (I'm thinking of changing it soon), since it doesn't give away information on the number of encrypted data values, but rather on the number of polynomials in use for the ciphertext structure (>2 means you can use relinearization).
Try removing all the calls to len
and replacing them by constants of known value (e.g., num_rows
, num_cols
)
I really really really thank you a lot for your help. I no longer have any errors in this area.
So now I wanted to run the program on a much larger dataset and I made this change:
from this:
# DATA GENERATION
num_rows, num_cols = 10,5
n_elements = num_rows*num_cols
np.random.seed(42) # Fixed seed for reproducibility
data = np.random.randint(0, 5, size=(num_rows, num_cols)) # Generate data
to this:
# load yeast data used in the original Cheng and Church's paper
data = load_yeast_tavazoie().values
# missing value imputation suggested by Cheng and Church
missing = np.where(data < 0.0)
data[missing] = np.random.randint(low=0, high=800, size=len(missing[0]))
And get this error message:
/usr/bin/python3.10 /home/serhat/SeCCA-CKKS/secured_cheng_church_yeast.py
SeCCA Step 2
Number of the Bicluster:2884
Traceback (most recent call last):
File "/home/serhat/SeCCA-CKKS/secured_cheng_church_yeast.py", line 24, in <module>
biclustering = secca.run(data)
File "/home/serhat/SeCCA-CKKS/biclustlib/algorithms/type2.py", line 123, in run
self._multiple_node_deletion(data, rows, cols, msr_thr, HE, t_enc, t_dec)
File "/home/serhat/SeCCA-CKKS/biclustlib/algorithms/type2.py", line 170, in _multiple_node_deletion
msr, row_msr, col_msr = self._calculate_msr(data, rows, cols, HE, t_enc, t_dec)
File "/home/serhat/SeCCA-CKKS/biclustlib/algorithms/type2.py", line 230, in _calculate_msr
arr_sub_data = HE.encryptFrac(sub_data)
File "Pyfhel/Pyfhel.pyx", line 364, in Pyfhel.Pyfhel.Pyfhel.encryptFrac
File "Pyfhel/Pyfhel.pyx", line 388, in Pyfhel.Pyfhel.Pyfhel.encryptFrac
ArithmeticError: <Afseal>: Data vector size is bigger than ckks nSlots
Process finished with exit code 1
So it shows the error in this part:
arr_sub_data = HE.encryptFrac(sub_data)
and says the Data vector size is bigger than ckks nSlots
I haven't found anything about this in the previous posts, unfortunately. How can I increase the size of the slots in CKKS? Or have I implemented something wrong?
Many many thanks
You basically run out of space in your ciphertext. Your only choice is yo adapt the algorithm to work with multiple ciphertexts instead of only one.
Hello Alberto,
I really don't want to bother you unnecessarily, but I just can't get any further. I have to hand in this work soon and only have to encrypt the msr. I'm pretty sure it's due to getting the "rescale" function set correctly. I am writing this as a new Issue, and hope that other people can be helped with this problem as well.
My Code:
I have now tried this approach:
And got this error message:
And I tried this approach:
And got this error message (with results):
But I think the len(..) function is wrong.
Can you help me rescale my function properly?