diff --git a/amn/Build_Model.py b/amn/Build_Model.py index 766e155..20f3c9a 100644 --- a/amn/Build_Model.py +++ b/amn/Build_Model.py @@ -19,8 +19,8 @@ def sharp_sigmoid(x): # Custom activation function return K.sigmoid(10000.0 * x) -from tensorflow.keras.utils import get_custom_objects, CustomObjectScope -from tensorflow.keras.layers import Activation, Lambda +from keras.utils import get_custom_objects, CustomObjectScope +from keras.layers import Activation, Lambda get_custom_objects().update({'sharp_sigmoid': Activation(sharp_sigmoid)}) def my_mse(y_true, y_pred): @@ -55,7 +55,7 @@ def CROP(dimension, start, end): # Crops (or slices) a Tensor on a given dimension from start to end # example : to crop tensor x[:, :, 5:10] # call x = crop(2,5,10)(x) to slice the second dimension - from tensorflow.keras.layers import Lambda + from keras.layers import Lambda def func(x): if dimension == 0: return x[start: end] @@ -165,9 +165,9 @@ def Loss_all(V, Vinko, Vout, parameter): # Dense model # ############################################################################## -from tensorflow.keras.layers import Input, Dense, Dropout, Flatten, Activation, BatchNormalization -from tensorflow.keras.layers import Reshape, multiply -from tensorflow.keras.layers import concatenate, add, subtract, dot +from keras.layers import Input, Dense, Dropout, Flatten, Activation, BatchNormalization +from keras.layers import Reshape, multiply +from keras.layers import concatenate, add, subtract, dot def input_ANN_Dense(parameter, verbose=False): # Shape X and Y depending on the model used @@ -180,7 +180,7 @@ def input_ANN_Dense(parameter, verbose=False): def Dense_layers(inputs, parameter, trainable=True, verbose=False): # Build a dense architecture with some hidden layers - from tensorflow.keras.regularizers import l2 + from keras.regularizers import l2 activation=parameter.activation n_hidden=parameter.n_hidden @@ -614,9 +614,9 @@ def train_evaluate_model(parameter, failure=0, temperature=0, verbose=False): # ############################################################################## from amn.Build_Dataset import TrainingSet -from tensorflow.keras.models import load_model -from tensorflow.keras.models import Model -from tensorflow.keras.models import model_from_json +from keras.models import load_model +from keras.models import Model +from keras.models import model_from_json from sklearn.metrics import r2_score from sklearn.metrics import accuracy_score, f1_score, matthews_corrcoef @@ -760,7 +760,7 @@ def save(self, filename, verbose=False): h.write(s) self.model.save(filemodel) - def load(self, filename, fileparam, filemodel, output_dim=-1, verbose=False): + def load(self, filename, fileparam=None, filemodel=None, output_dim=-1, verbose=False): if filename == "" or filename is None: fileparam = fileparam filemodel = filemodel diff --git a/amn/_version.py b/amn/_version.py index 3dc1f76..d3ec452 100644 --- a/amn/_version.py +++ b/amn/_version.py @@ -1 +1 @@ -__version__ = "0.1.0" +__version__ = "0.2.0" diff --git a/environment.yaml b/environment.yaml index 8a765d8..445ca27 100644 --- a/environment.yaml +++ b/environment.yaml @@ -4,7 +4,7 @@ channels: - conda-forge dependencies: - - python =3.8 + - python =3.11 - numpy =1.23.5 - pandas - matplotlib @@ -16,6 +16,6 @@ dependencies: - typing_extensions =4.5.0 - pip - ipykernel - - tensorflow =2.4.1 + - tensorflow =2.12.0 - tensorflow-probability - importlib-resources \ No newline at end of file diff --git a/setup.py b/setup.py index 393478c..f1bd93d 100644 --- a/setup.py +++ b/setup.py @@ -55,5 +55,5 @@ def get_version(): 'License :: OSI Approved :: MIT License', 'Operating System :: OS Independent', ], - python_requires = '>=3.8', + python_requires = '>=3.11', ) \ No newline at end of file diff --git a/tests/data/IJN1463EXP_AMN_QP_model.h5 b/tests/data/IJN1463EXP_AMN_QP_model.h5 index 5ca3f42..edc5409 100644 Binary files a/tests/data/IJN1463EXP_AMN_QP_model.h5 and b/tests/data/IJN1463EXP_AMN_QP_model.h5 differ diff --git a/tests/data/IJN1463EXP_AMN_QP_param.csv b/tests/data/IJN1463EXP_AMN_QP_param.csv index 2ee8468..b1357a2 100644 --- a/tests/data/IJN1463EXP_AMN_QP_param.csv +++ b/tests/data/IJN1463EXP_AMN_QP_param.csv @@ -1 +1 @@ -./Dataset_input/Putida/IJN1463EXP,AMN_QP,3,['BIOMASS_KT2440_WT3'],1,174,4038,1,500,sigmoid,500,accuracy_score,0.001,0.25,10,0,5 \ No newline at end of file +/home/rkhaled/amn_library/amn/models/IJN1463EXP,AMN_QP,3,['BIOMASS_KT2440_WT3'],1,174,4038,1,500,relu,500,r2_score,0.001,0.25,10,0,5 \ No newline at end of file