multiml.task.keras.keras_util module
- multiml.task.keras.keras_util.compile(obj, obj_args, modules)
- multiml.task.keras.keras_util.training_keras_model(model, num_epochs, batch_size, max_patience, x_train, y_train, x_valid, y_valid, chpt_path=None, callbacks=['EarlyStopping', 'ModelCheckpoint', 'TensorBoard'], tensorboard_path=None, verbose=None)
Training keras model.
- Parameters:
num_epochs (int) – maximum number of epochs
batch_size (int) – mini-batch size
max_patience (int) – maximum patience for early stopping
x_train (np.darray) – input array for training
y_train (np.darray) – output array for training
x_valid (np.darray) – input array for validation
y_valid (np.darray) – output array for validation
chpt_path (str) – path for Keras check-point saving. If None, temporary directory will be used.
callbacks (str or keras.Callback) – callback for keras model training. Predefined callbacks (EarlyStopping, ModelCheckpoint, and TensorBoard) can be selected by str. Other user-defined callbacks should be given as keras.Callback object.
tensorboard_path (str) – Path for tensorboard callbacks. If None, tensorboard callback is not used.
verbose (int) – verbose option for Model.fit(). If None, it’s set based on logger.MIN_LEVEL
- Returns:
training results, which contains loss histories.
- Return type:
dict
- multiml.task.keras.keras_util.get_optimizer(optimizer, optimizer_args=None)
Get Keras optimizer.
- Parameters:
optimizer (str or obj) – If str, the corresponding optimizer is searched for in the keras class.
learning_rate (float) – learning rate for the optimizer