Ejemplo n.º 1
0
 def test_MODEL_loading(self):
     nn = Neural_Network(preprocessor=self.pp3D)
     model_path = os.path.join(self.tmp_dir3D.name, "my_model.hdf5")
     nn.dump(model_path)
     nn_new = Neural_Network(preprocessor=self.pp3D)
     nn_new.load(model_path)
Ejemplo n.º 2
0
                        mode="min")

#-----------------------------------------------------#
#          Run Pipeline for provided CV Fold          #
#-----------------------------------------------------#
# Run pipeline for cross-validation fold
run_fold(fold,
         model,
         epochs=1000,
         iterations=150,
         evaluation_path=path_eval,
         draw_figures=True,
         callbacks=[cb_lr, cb_es, cb_tb, cb_cl, cb_mc],
         save_models=False)

# Dump latest model to disk
model.dump(os.path.join(fold_subdir, "model.latest.hdf5"))

#-----------------------------------------------------#
#           Inference for provided CV Fold            #
#-----------------------------------------------------#
# Load best model weights during fitting
model.load(os.path.join(fold_subdir, "model.best.hdf5"))

# Obtain training and validation data set
training, validation = load_disk2fold(
    os.path.join(fold_subdir, "sample_list.json"))

# Compute predictions
model.predict(validation, return_output=False)
Ejemplo n.º 3
0
 def test_MODEL_storage(self):
     nn = Neural_Network(preprocessor=self.pp3D)
     model_path = os.path.join(self.tmp_dir3D.name, "my_model.hdf5")
     nn.dump(model_path)
     self.assertTrue(os.path.exists(model_path))