Hi!
I am trying to apply pymc_smc to my Approximate Bayesian Pipeline.
My script runs fine on command line, but when I submit the same script (with the same environment) to a HPC…
I keep getting this error:
StD = float(StD)
^^^^^^^^^^
TypeError: float() argument must be a string or a real number, not 'numpy.random._generator.Generator'
I have made several attempts in my script to ensure everytime I pass the variable StD to pymc I am passing a float or integer :
def mutInStemCells(num_stem, t, mu_0, Genom, st_d): #Num_of_stemcells, Num_of_division_in_elongation, mutation_rate, Genom_size, Num_of_stemcells - gamma
# Ensure st_d is an integer
st_d = int(st_d)
...
def sample_prior():
StD_value = float(pm.draw(pm.Uniform("StD", lower=0, upper=5)))
biasVar_value = float(pm.draw(pm.Uniform("biasVar", lower=0.5, upper=10)))
input_mut_value = float(pm.draw(pm.Uniform("input_mut", lower=1.16E-10, upper=1.12E-09)))
return StD_value, biasVar_value, input_mut_value
...
def abc_likelihood(StD, biasVar, input_mut, epsilon1, *args, **kwargs):
# Ensure these are floats
StD = float(StD)
biasVar = float(biasVar)
input_mut = float(input_mut)
unique_mutations, output_mut_rate, variants = run_simulation(StD, biasVar, input_mut)
dist1 = calculate_distance(unique_mutations)
# Return the distance check and the additional outputs (output_mut_rate and variants)
return dist1 < epsilon1, output_mut_rate, variants
...
I am unsure where this error keeps coming from, and why it seems to occur only when I submit my script to HPC? I also consulted the HPC and they see no errors regarding the environmnent/ HPC. Both are using the same version:
pymc 5.16.2 pypi_0 pypi
pymc-base 5.16.2 pyhd8ed1ab_0 conda-forge
I attached full script below for reference.
Any help would be much appreciated.
Kind Regards,
Andrea
abc_pipeline (4).py (35.3 KB)