Question about the correct scale and parameters for ckks scheme?

Hello,

I am trying to write an softmax approximation algorithm from scratch which could work with encrypted training data for an academic project. I’m using the TenSEAL library in this example ( I am looking to try OpenFHE as well).

I have used these encryption parameters but they seem to be wrong as I’m getting ‘a scale out of bounds’ error.

# parameters
poly_mod_degree = 8192
coeff_mod_bit_sizes = [40, 21, 21, 21, 21, 21, 21, 40]
# create Context
ctx_training = ts.context(ts.SCHEME_TYPE.CKKS, poly_mod_degree, -1, coeff_mod_bit_sizes)
ctx_training.global_scale = 2 ** 21
ctx_training.generate_galois_keys()

Can anyone on here be knowledgeable enough to give me advice on how to choose the right parameters for the ckks encryption scheme?

here is my code -

thank you.