Some time ago I discussed with my friend jokingly about GA might be good to make minimum perturbation for machine learning models. This might be true, might be false. Working on it might trigger some PTSD we have from what's supposed to be a philosophical AI mod. Unironically, I'm now curious whether this might work or not.
This is a small experiment on how good is Genetic Algorithm in creating a minimum perturbation for machine learning models in order to throw off their predictions (doesn't matter to where). The goal is to minimize both perturbation and model accuracy.
- Install necessary requirements
- Train the model, run
python model.pyin terminal. Make sure foldermodelsis created with a model. - Run Genetic Algorithm,
python genetic.py <num_generations> <norm>in terminal for the main result.- use any number for
<num_generations>, by default, it's 10. The more generation, the better the result would be. - use either 'l1_norm', 'l2_norm', or 'linfinity_norm' for the
<norm>. - note that this script uses the timestamp of the current day to both find the model and save images
- use any number for
- See result in images for the perturbation image.