MLBazaar/MLPrimitives

Building model within `fit` in `keras` adapter

sarahmish opened this issue · 0 comments

  • MLPrimitives version: 0.3.2
  • Python version: 3.7
  • Operating System: macOS 10.15.6

Description

In keras adapter, we build the model within the fit function, this entails that with every fit call we will rebuild the model and thus we cannot "continue" the process of training (i.e. call fit twice to train the same model).

def fit(self, X, y, **kwargs):
self._augment_hyperparameters(X, 'input', kwargs)
self._augment_hyperparameters(y, 'target', kwargs)
self.model = self._build_model(**kwargs)

Is this the expected behavior? Or should there be a flag to indicate if this is the first call to fit, then build the model, otherwise continue

if not self._fitted:
    self._augment_hyperparameters(X, 'input', kwargs)
    self._augment_hyperparameters(y, 'target', kwargs)
    self.model = self._build_model(**kwargs)