From 3f3a9ff4189313fedcf276c25cab389f2499d42a Mon Sep 17 00:00:00 2001 From: dayhaha <18800111918@163.com> Date: Thu, 29 Dec 2016 13:15:29 +0000 Subject: [PATCH] modify follow comment --- demo/recommendation/evaluate.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/demo/recommendation/evaluate.py b/demo/recommendation/evaluate.py index 064c233b073..3afa7a1e9db 100755 --- a/demo/recommendation/evaluate.py +++ b/demo/recommendation/evaluate.py @@ -17,8 +17,8 @@ import re import math -def get_best_pass(filename): - with open(filename, 'r') as f: +def get_best_pass(log_filename): + with open(log_filename, 'r') as f: text = f.read() pattern = re.compile('Test.*? cost=([0-9]+\.[0-9]+).*?pass-([0-9]+)', re.S) @@ -27,8 +27,8 @@ def get_best_pass(filename): return sorted_results[0] -filename = sys.argv[1] -log = get_best_pass(filename) +log_filename = sys.argv[1] +log = get_best_pass(log_filename) predict_error = math.sqrt(float(log[0])) / 2 print 'Best pass is %s, error is %s, which means predict get error as %f' % ( log[1], log[0], predict_error) -- GitLab