Commit c9f6290b authored by Bannier Delphine's avatar Bannier Delphine
Browse files

set up kfold

parent 20c0e823
......@@ -14,7 +14,7 @@ from tensorflow.keras.layers import GaussianNoise
from tensorflow import TensorShape
import numpy as np
from tensorflow import TensorShape
import numpy as np
from sklearn.model_selection import train_test_split
......@@ -161,4 +161,16 @@ def create_hybrid_transfer(nb_attributes,new_model, custom_model, modify_name,in
x = Dense(4, activation="relu")(combinedInput)
x = Dense(1, activation="linear")(x)
model = Model(inputs=[mlp.input, cnn.input], outputs=x)
return model
\ No newline at end of file
return model
def fit_and_evaluate(t_x, val_x, t_y, val_y, EPOCHS=30, BATCH_SIZE=8,model = None,es= None,cp=None):
"""
`es`: earlystopping keras object
`cp`: checkpoint keras object
"""
mod = None
mod = model
results = mod.fit(t_x, t_y, epochs=EPOCHS, batch_size=BATCH_SIZE, callbacks=[es, cp],
verbose=1, validation_split=0.1)
print("Val Score: ", mod.evaluate(val_x, val_y))
return results
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment