I wrote a genetic algorithm (at least, I think it is a GA) that attempts to tune hyper parameters for the kaggle.com Housing Prices Competition for Kaggle Learn Users.
I am new to GA so I'd like to get an experienced opinion about how well is my algorithm performing. In the current run it managed to fit a model and get MAE of 16308.82 after 15 generations and about 6 hours. It has been running for 10 more hours now and didn't get better results so I guess this is it for this version (there may be ways to improve the algorithm of course). Is this good performance? can it be improved?
I keep the code in jupyter notebooks on github: https://github.com/ZackYovel/GA-for-Hyper-Parameter-Tuning. Sorry for the horrible code, I like to start quick and dirty and refactor later. I am currently working on a library that will enable me to implement the algorithm using cleaner code.
The algorithm I used in my current run is:
- Produce 150 individuals (individual=set of hyper parameter values) divided into 5 territories (populations)
- Every individual has in addition to the hyper parameter values also a small_step_mutation and a large_step_mutation values (explained ahead).
- Evaluate all individuals and keep the 15 best in each population
- Crossover: the best individual in each population is paired in a loop with all other survivors. For each pair, each hyper parameter is copied from a randomly chosen parent (e.g. for each hp: choose parent = mom or dad randomly, then copy parent[hp] to child)
- Go back to step 3.
small_step_mutation determines the standard deviation used to change the hyper parameter value when the current value is the mean (e.g. new_hp_value = np.random.normal(current_hp_value, small_step_mutation * (max_value_for_hp - min_value_for_hp))
large_step_mutation is the probability that a large mutation will occur (if -choose True or False with probability large_step_mutation for True- then: new_hp_value = random(min_value, max_value)
The two mutation parameters are under evolution. small_step_mutation tends to evolve to zero, large_step_mutation tends to evolve to 1.
Steps 3-5 are repeated in a loop of 500 generations but I never let it actually run the entire 500 generations because each generation can take a pretty long time (varies between 15 minutes to several hours per generation. I consider this a bug and I think I know how to fix it. Will try soon. I expect the average runtime per generation to be 15-30 minutes)
So bottom line I have two questions:
- Is my current performance good? can it be improved?
- Is my algorithm good? can it be improved? (am I actually doing GA or something else?)
Thanks in advance!
The steps of GA is below: