Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CNN MNIST Example is minimizing instead of maximizing #72

Open
DuaneNielsen opened this issue Aug 12, 2024 · 1 comment
Open

CNN MNIST Example is minimizing instead of maximizing #72

DuaneNielsen opened this issue Aug 12, 2024 · 1 comment

Comments

@DuaneNielsen
Copy link

DuaneNielsen commented Aug 12, 2024

In the CNN MNIST example ...

from evosax import FitnessShaper
fit_shaper = FitnessShaper(centered_rank=True,
                           z_score=False,
                           w_decay=0.1,
                           maximize=False)

Should be

from evosax import FitnessShaper
fit_shaper = FitnessShaper(centered_rank=True,
                           z_score=False,
                           w_decay=0.1,
                           maximize=True)

With this i obtain

ParameterReshaper: 11274 parameters detected for optimization.
ParameterReshaper: 11274 parameters detected for optimization.
Generation: 0 {'train_acc': 0.09507812559604645, 'test_acc': 0.10459999740123749}
Generation: 100 {'train_acc': 0.5151562094688416, 'test_acc': 0.5392000079154968}
Generation: 200 {'train_acc': 0.4524902105331421, 'test_acc': 0.47589999437332153}
Generation: 300 {'train_acc': 0.517333984375, 'test_acc': 0.5645999908447266}
Generation: 400 {'train_acc': 0.5697656273841858, 'test_acc': 0.585099995136261}
Generation: 500 {'train_acc': 0.5973535180091858, 'test_acc': 0.635699987411499}
Generation: 600 {'train_acc': 0.6465820074081421, 'test_acc': 0.670199990272522}
Generation: 700 {'train_acc': 0.571484386920929, 'test_acc': 0.592199981212616}
Generation: 800 {'train_acc': 0.5779687166213989, 'test_acc': 0.6055999994277954}
Generation: 900 {'train_acc': 0.5424999594688416, 'test_acc': 0.5643999576568604}
Generation: 1000 {'train_acc': 0.4705566167831421, 'test_acc': 0.47669997811317444}
Generation: 1100 {'train_acc': 0.47603514790534973, 'test_acc': 0.4980999827384949}
Generation: 1200 {'train_acc': 0.4590234160423279, 'test_acc': 0.5117999911308289}
Generation: 1300 {'train_acc': 0.5096582174301147, 'test_acc': 0.5390999913215637}
Generation: 1400 {'train_acc': 0.5160546898841858, 'test_acc': 0.5342000126838684}
Generation: 1500 {'train_acc': 0.4954589605331421, 'test_acc': 0.5008999705314636}
Generation: 1600 {'train_acc': 0.5203222632408142, 'test_acc': 0.5051000118255615}
Generation: 1700 {'train_acc': 0.4918164014816284, 'test_acc': 0.5573999881744385}
Generation: 1800 {'train_acc': 0.4961327910423279, 'test_acc': 0.505299985408783}
Generation: 1900 {'train_acc': 0.48252928256988525, 'test_acc': 0.501800000667572}
Generation: 2000 {'train_acc': 0.43098631501197815, 'test_acc': 0.4576999843120575}
Generation: 2100 {'train_acc': 0.4217871129512787, 'test_acc': 0.44529998302459717}
Generation: 2200 {'train_acc': 0.419990211725235, 'test_acc': 0.44599997997283936}
Generation: 2300 {'train_acc': 0.42906248569488525, 'test_acc': 0.4562999904155731}
Generation: 2400 {'train_acc': 0.4432031214237213, 'test_acc': 0.4359000027179718}

@DuaneNielsen
Copy link
Author

DuaneNielsen commented Aug 12, 2024

Also, good default parameter settings are.. train batch_size 256 popsize 400, reaches test acc score of 0.84 in 1000 generations. There are bigger settings that can go higher, but for a quick demo those settings seem OK.

Generation: 0 {'train_acc': 0.10082031041383743, 'test_acc': 0.08980000019073486}
Generation: 100 {'train_acc': 0.774658203125, 'test_acc': 0.832099974155426}
Generation: 200 {'train_acc': 0.7950195074081421, 'test_acc': 0.8150999546051025}
Generation: 300 {'train_acc': 0.8118066191673279, 'test_acc': 0.826200008392334}
Generation: 400 {'train_acc': 0.82177734375, 'test_acc': 0.8105999827384949}
Generation: 500 {'train_acc': 0.7590429782867432, 'test_acc': 0.802299976348877}
Generation: 600 {'train_acc': 0.8229589462280273, 'test_acc': 0.809499979019165}
Generation: 700 {'train_acc': 0.7835742235183716, 'test_acc': 0.8240999579429626}
Generation: 800 {'train_acc': 0.8318847417831421, 'test_acc': 0.8420999646186829}
Generation: 900 {'train_acc': 0.7520995736122131, 'test_acc': 0.8055999875068665}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant