gmontamat / gentun

Hyperparameter tuning for machine learning models using a distributed genetic algorithm
Apache License 2.0
83 stars 22 forks source link

lack of mnist.py #40

Closed whubaichuan closed 1 month ago

whubaichuan commented 10 months ago

Hi, in this test file,

import mnist

but no module named mnist.

I guess probably that some directory or files named as mnist.py is missing?

gmontamat commented 10 months ago

hi @whubaichuan take a look at requirements.txt, it's a dependency: pip install mnist==0.2.2

gmontamat commented 10 months ago

In the dev branch I'm dropping the use of this lib to get the mnist dataset but it's still a WIP.

whubaichuan commented 10 months ago

@gmontamat hi thanks. However, when I install all the libraries (especially tensorflow 1.15.4), run the test_mnist.py. I still have the problem below:


  File "gentun-master/tests/test_mnist.py", line 60, in <module>
    ga.run(2)
  File "gentun-master/gentun/algorithms.py", line 29, in run
    self.evolve_population()
  File "gentun-master/gentun/algorithms.py", line 72, in evolve_population
    fittest = self.population.get_fittest()
  File "gentun-master/gentun/populations.py", line 57, in get_fittest
    return max(self.individuals, key=operator.methodcaller('get_fitness'))
  File "gentun-master/gentun/individuals.py", line 91, in get_fitness
    self.evaluate_fitness()
  File "gentun-master/gentun/individuals.py", line 259, in evaluate_fitness
    self.fitness = model.cross_validate()
  File "gentun-master/gentun/models/keras_models.py", line 135, in cross_validate
    self.reset_weights()
  File "gentun-master/gentun/models/keras_models.py", line 125, in reset_weights
    layer.kernel.initializer.run(session=session)
AttributeError: 'NoneType' object has no attribute 'run'```
whubaichuan commented 10 months ago

@gmontamat hi, the output of pip freeze is:


astor==0.7.1
gast==0.2.2
gentun==0.0.1
google-pasta==0.2.0
grpcio==1.20.1
h5py==2.9.0
importlib-metadata==6.7.0
Keras==2.2.4
Keras-Applications==1.0.7
Keras-Preprocessing==1.0.9
Markdown==3.1
MarkupSafe==2.1.3
mnist==0.2.2
mock==3.0.4
numpy==1.16.3
opt-einsum==3.3.0
packaging==23.2
pika==1.0.1
plotly==5.18.0
protobuf==3.7.1
PyYAML==5.4
scikit-learn==0.20.3
scipy==1.2.1
six==1.12.0
tenacity==8.2.3
tensorboard==1.13.1
tensorflow==1.15.4
tensorflow-estimator==1.13.0
termcolor==1.1.0
typing_extensions==4.7.1
Werkzeug==0.15.3
wrapt==1.15.0
xgboost==0.82
zipp==3.15.0```
gmontamat commented 10 months ago

Looks like I need to update the libs, I tried replicating the environment in python3.8 and tf1.x is no longer supported.

whubaichuan commented 10 months ago

@gmontamat Thanks, gmontamat