Beispiel #1
0
def _calc_and_save_train_metrics(nn_model, train_subset, avg_loss):
    train_metrics = dict()
    train_metrics['train_perplexity'] = calculate_model_mean_perplexity(nn_model, train_subset)
    train_metrics['train_loss'] = avg_loss
    save_metrics(train_metrics)

    _logger.info('Current train perplexity: %s' % train_metrics['train_perplexity'])
    return train_metrics
Beispiel #2
0
def _calc_and_save_val_metrics(nn_model,
                               context_sensitive_val_subset,
                               context_free_val,
                               prediction_mode=PREDICTION_MODE_FOR_TESTS):
    val_metrics = calculate_and_log_val_metrics(nn_model, context_sensitive_val_subset, context_free_val,
                                                prediction_mode)
    save_metrics(val_metrics)

    return val_metrics