Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def __init__(self, exp_id, nb_epoch = 10, patience = 5, mongo_uri = "mongodb://localhost:27017/", data_filename = None):
self.exp_id = exp_id
self.model = None
self.data = None
self.data_loader = None
# How many epoch to train (if score earlystopping doesn't kick in earlier)
self.nb_epoch = nb_epoch
# How many epoch of not improving before earlystopper kicks in
self.patience = patience
self.mongo_uri = mongo_uri
self.factory = KerasModelFactory()
self.data_loader = DataLoader("http://localhost:8080", self.mongo_uri)
def get_model_factory(self, model_type):
if model_type == "keras":
return KerasModelFactory()
else:
raise ValueError("%s is not supported. Only Keras models are supported right now." % model_type)