From 9b3031af1c8b17a8b5a6c2d12d9cbcdc25e79ecf Mon Sep 17 00:00:00 2001 From: Steve Nyemba Date: Tue, 12 Apr 2022 14:59:46 -0500 Subject: [PATCH] bug fix: preconditions --- data/maker/__init__.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/data/maker/__init__.py b/data/maker/__init__.py index 4c175e9..fba1361 100644 --- a/data/maker/__init__.py +++ b/data/maker/__init__.py @@ -248,7 +248,7 @@ class Learner(Process): _args = {"schema":self.get_schema(),"data":self._df,"columns":columns} if self._map : _args['map'] = self._map - self._encoder = prepare.Input(**_args) + self._encoder = prepare.Input(**_args) if self._df.shape[0] > 0 else None class Trainer(Learner): """ This will perform training using a GAN @@ -263,6 +263,10 @@ class Trainer(Learner): self.candidates = int(_args['candidates']) if 'candidates' in _args else 1 def run(self): self.initalize() + if self._encoder is None : + # + # @TODO Log that the dataset was empty or not statistically relevant + return _space,_matrix = self._encoder.convert() _args = self.network_args @@ -311,9 +315,15 @@ class Generator (Learner): file.close() def run(self): self.initalize() + if self._encoder is None : + # + # @TODO Log that the dataset was empty or not statistically relevant + return + # # The values will be returned because we have provided _map information from the constructor # + values,_matrix = self._encoder.convert() _args = self.network_args _args['map'] = self._map