From b5ccf5210a1da989b5eedabc23768b09cbe76a44 Mon Sep 17 00:00:00 2001 From: manonreau Date: Wed, 25 Nov 2020 18:57:03 +0100 Subject: [PATCH 1/4] Update NeuralNet.py --- graphprot/NeuralNet.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/graphprot/NeuralNet.py b/graphprot/NeuralNet.py index c1fd5bb..31e38d6 100644 --- a/graphprot/NeuralNet.py +++ b/graphprot/NeuralNet.py @@ -594,6 +594,7 @@ def _export_epoch_hdf5(self, epoch, data): # mol name is a bit different # since there are strings if data_name == 'mol': + data_value = np.string_(data_value) string_dt = h5py.special_dtype(vlen=str) sg.create_dataset( data_name, data=data_value, dtype=string_dt) @@ -603,4 +604,4 @@ def _export_epoch_hdf5(self, epoch, data): sg.create_dataset(data_name, data=data_value) except TypeError: - logger.exception("Error in export epoch to hdf5") + raise ValueError("Error in export epoch to hdf5") From 3f086f301ce77b60da94bd17b74e237bfc831130 Mon Sep 17 00:00:00 2001 From: manonreau Date: Fri, 27 Nov 2020 11:42:05 +0100 Subject: [PATCH 2/4] Update NeuralNet.py --- graphprot/NeuralNet.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/graphprot/NeuralNet.py b/graphprot/NeuralNet.py index 31e38d6..26a59aa 100644 --- a/graphprot/NeuralNet.py +++ b/graphprot/NeuralNet.py @@ -39,7 +39,7 @@ def __init__(self, database, Net, else: self.load_params(pretrained_model) - + self.outdir = outdir # dataset dataset = HDF5DataSet(root='./', database=database, index=self.index, node_feature=self.node_feature, edge_feature=self.edge_feature, From d9e6d64e3fd921d42619474a3680e3bb5a501363 Mon Sep 17 00:00:00 2001 From: manonreau Date: Fri, 27 Nov 2020 11:47:33 +0100 Subject: [PATCH 3/4] Update NeuralNet.py --- graphprot/NeuralNet.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/graphprot/NeuralNet.py b/graphprot/NeuralNet.py index 26a59aa..4e5c405 100644 --- a/graphprot/NeuralNet.py +++ b/graphprot/NeuralNet.py @@ -376,8 +376,7 @@ def test(self, database_test, threshold=4, hdf5='test_data.hdf5'): self.test_acc = _test_acc self.test_loss = _test_loss - if save_prediction : - self._export_epoch_hdf5(0, self.data) + self._export_epoch_hdf5(0, self.data) self.f5.close() From 65e305ddc7e9d3c65d4824f7efd4493c8355fa91 Mon Sep 17 00:00:00 2001 From: manonreau Date: Fri, 27 Nov 2020 11:55:05 +0100 Subject: [PATCH 4/4] Update NeuralNet.py --- graphprot/NeuralNet.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/graphprot/NeuralNet.py b/graphprot/NeuralNet.py index 4e5c405..4795528 100644 --- a/graphprot/NeuralNet.py +++ b/graphprot/NeuralNet.py @@ -218,10 +218,10 @@ def train(self, nepoch=1, validate=False, plot=False, save_model='last', hdf5='t # If file exists, change its name with a number count = 0 + hdf5_name = hdf5.split('.')[0] while os.path.exists(fname) : count += 1 - hdf5 = hdf5.split('.')[0] - hdf5 = '{}_{:03d}.hdf5'.format(hdf5, count) + hdf5 = '{}_{:03d}.hdf5'.format(hdf5_name, count) fname = os.path.join(self.outdir, hdf5) # Open output file for writting @@ -346,10 +346,10 @@ def test(self, database_test, threshold=4, hdf5='test_data.hdf5'): # If file exists, change its name with a number count = 0 + hdf5_name = hdf5.split('.')[0] while os.path.exists(fname) : count += 1 - hdf5 = hdf5.split('.')[0] - hdf5 = '{}_{:03d}.hdf5'.format(hdf5, count) + hdf5 = '{}_{:03d}.hdf5'.format(hdf5_name, count) fname = os.path.join(self.outdir, hdf5) # Open output file for writting