vendredi 2 juin 2023

Python - Non Repeating Random Numbers for Multiple Variables

I am trying to create a function that applies random values to a range of parameters that are used in another function where the random sequence does not repeat.

The reason: used for random hyper parameter tuning and to cut down on processing by not repeating sequence.

Example Code:

num_evals = 2500

parameters = {
        'n_parameter_1': range(2,100),
        'n_parameter_2': range(1,20),
        'n_parameter_3': range(2,150),
              }  

for i in range(num_evals):
        n_parameter_1 = random.choice(parameters['n_parameter_1'])
        n_parameter_2 = random.choice(parameters['n_parameter_2'])
        n_parameter_3 = random.choice(parameters['n_parameter_3'])
       
# The results then get populated to a file with the random parameters used to generate.
# The process needs to be able to be stopped and kicked off again where it left off. (maybe import file)        

Thanks for the help in advance.




Aucun commentaire:

Enregistrer un commentaire