Beispiel #1
0
 def save(self):
     """
     Save all parameters to file
     :param filename: file to save to
     """
     d = {"type": self.model_type, "labels": self.labels, "model": dict(self.model), "is_frozen": self.is_frozen}
     if not self.is_frozen:
         d.update({"_min_update": self._min_update, "_update_index": self._update_index})
     save_dict(self.filename, d)
Beispiel #2
0
 def save(self):
     """
     Save all parameters to file
     :param filename: file to save to
     """
     d = {
         "type": "dense",
         "labels": self.labels,
         "model": self.model,
         "is_frozen": self.is_frozen,
     }
     if not self.is_frozen:
         d.update({
             "_update_index": self._update_index,
         })
     save_dict(self.filename, d)
Beispiel #3
0
 def save(self):
     """
     Save all parameters to file
     :param filename: file to save to
     """
     d = {
         "type": self.model_type,
         "labels": self.labels,
         "is_frozen": self.is_frozen,
     }
     save_dict(self.filename, d)
     self.init_model()
     with open(self.filename + ".json", "w") as f:
         f.write(self.model.to_json())
     try:
         self.model.save_weights(self.filename + ".h5", overwrite=True)
     except ValueError as e:
         print("Failed saving model weights: %s" % e)