def _save_test_results(test_dataset, predictions_filename, nn_model, prediction_modes, **kwargs): test_dataset_ids = transform_contexts_to_token_ids( list(lines_to_context(test_dataset)), nn_model.token_to_index, INPUT_SEQUENCE_LENGTH, INPUT_CONTEXT_SIZE) calculate_and_log_val_metrics( nn_model, load_context_sensitive_val(nn_model.token_to_index, nn_model.condition_to_index), load_context_free_val(nn_model.token_to_index)) log_predictions(predictions_filename, test_dataset_ids, nn_model, prediction_modes, **kwargs)
def _save_test_results(test_dataset, predictions_filename, nn_model, prediction_mode, **kwargs): test_dataset_ids = transform_contexts_to_token_ids( list(lines_to_context(test_dataset)), nn_model.token_to_index, INPUT_SEQUENCE_LENGTH, INPUT_CONTEXT_SIZE) calculate_and_log_val_metrics(nn_model, load_context_sensitive_val(nn_model.token_to_index, nn_model.condition_to_index), load_context_free_val(nn_model.token_to_index)) log_predictions( predictions_filename, test_dataset_ids, nn_model, mode=prediction_mode, candidates_num=LOG_CANDIDATES_NUM, **kwargs)
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