def train(output_units=OUTPUT_UNITS, num_units=NUM_UNITS, loss=LOSS, learning_rate=LEARNING_RATE): # Generate the training sequences inputs, targets = generate_training_sequences(SEQUENCE_LENGTH) # Build the network model = build_model(output_units, num_units, loss, learning_rate) # Train the model model.fit(inputs, targets, epochs=EPOCHS, batch_size=BATCH_SIZE) # Save the model model.save(SAVE_MODEL_PATH)
def train(output_units=OUTPUT_UNITS, num_units=NUM_UNITS, loss=LOSS, learning_rate=LEARNING_RATE): """Train and save TF model. :param output_units (int): Num output units :param num_units (list of int): Num of units in hidden layers :param loss (str): Type of loss function to use :param learning_rate (float): Learning rate to apply """ # generate the training sequences inputs, targets = generate_training_sequences(SEQUENCE_LENGTH) # build the network model = build_model(output_units, num_units, loss, learning_rate) # train the model model.fit(inputs, targets, epochs=EPOCHS, batch_size=BATCH_SIZE) # save the model model.save(SAVE_MODEL_PATH)
def train(output_units=OUTPUT_UNITS, num_units=NUM_UNITS, loss=LOSS, learning_rate=LEARNING_RATE): """Entrenar y guardar modelo TF. :param output_units (int): Número de unidades de salida :param num_units (list of int): Número de unidades en capas ocultas :param loss (str): Tipo de función de pérdida a utilizar :param learning_rate (float): Tasa de aprendizaje para aplicar """ # generar las secuencias de entrenamiento inputs, targets = generate_training_sequences(SEQUENCE_LENGTH) # construir la red model = build_model(output_units, num_units, loss, learning_rate) # entrenar al modelo model.fit(inputs, targets, epochs=EPOCHS, batch_size=BATCH_SIZE) # guardar el modelo model.save(SAVE_MODEL_PATH)