Skip to content

Commit

Permalink
include evolutionary-keras
Browse files Browse the repository at this point in the history
  • Loading branch information
RoyStegeman committed Aug 20, 2020
1 parent cff0586 commit 5713b64
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
1 change: 1 addition & 0 deletions conda-recipe/meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ requirements:
- sphinx # documentation
- recommonmark
- sphinx_rtd_theme
- evolutionary_keras

test:
requires:
Expand Down
8 changes: 6 additions & 2 deletions n3fit/src/n3fit/backends/keras_backend/MetaModel.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,11 @@
"""

import tensorflow as tf
from tensorflow.keras.models import Model
from tensorflow.keras import optimizers as Kopt
from n3fit.backends.keras_backend.operations import numpy_to_tensor
import evolutionary_keras.optimizers as Evolutionary_optimizers
from evolutionary_keras.models import EvolModel


# Check the TF version to check if legacy-mode is needed (TF < 2.2)
tf_version = tf.__version__.split('.')
Expand All @@ -27,6 +29,8 @@
"Adamax": (Kopt.Adamax, {}),
"Nadam": (Kopt.Nadam, {}),
"Amsgrad": (Kopt.Adam, {"learning_rate": 0.01, "amsgrad": True}),
"NGA": (Evolutionary_optimizers.NGA, {}),
"CMA": (Evolutionary_optimizers.CMA, {})
}

# Some keys need to work for everyone
Expand Down Expand Up @@ -61,7 +65,7 @@ def _fill_placeholders(original_input, new_input=None):
return x


class MetaModel(Model):
class MetaModel(EvolModel):
"""
The `MetaModel` behaves as the tensorflow.keras.model.Model class,
with the addition of `tensor_content`:
Expand Down

0 comments on commit 5713b64

Please sign in to comment.