Commit 264e4628 authored by 宋柯's avatar 宋柯

模型调试

parent 6f2d8504
...@@ -10,7 +10,10 @@ def getRedisConn(): ...@@ -10,7 +10,10 @@ def getRedisConn():
conn = redis.Redis(host="172.18.51.10", port=6379, db=0, decode_responses = True) #test conn = redis.Redis(host="172.18.51.10", port=6379, db=0, decode_responses = True) #test
return conn return conn
save_dir = sys.argv[1] if len(sys.argv) == 2:
save_dir = sys.argv[1]
else:
save_dir = '/data/files/wideAndDeep/'
print('save_dir: ', save_dir) print('save_dir: ', save_dir)
...@@ -34,3 +37,6 @@ for vocab_key in vocab_keys: ...@@ -34,3 +37,6 @@ for vocab_key in vocab_keys:
print('texts: ', len(texts)) print('texts: ', len(texts))
f.write('\n'.join(texts)) f.write('\n'.join(texts))
os.system("hdfs dfs -getmerge /strategy/train_samples {save_dir}train_samples.csv".format(save_dir = save_dir))
os.system("hdfs dfs -getmerge /strategy/test_samples {save_dir}test_samples.csv".format(save_dir = save_dir))
...@@ -2,7 +2,7 @@ import tensorflow as tf ...@@ -2,7 +2,7 @@ import tensorflow as tf
tf.logging.set_verbosity(tf.logging.INFO) tf.logging.set_verbosity(tf.logging.INFO)
import sys import sys
BASE_DIR = '/Users/edz/software/Recommend/' BASE_DIR = '/data/files/wideAndDeep/'
def input_fn(csv_path, epoch, shuffle, batch_size): def input_fn(csv_path, epoch, shuffle, batch_size):
dataset = tf.data.TextLineDataset(csv_path) dataset = tf.data.TextLineDataset(csv_path)
...@@ -211,7 +211,7 @@ session_config = tf.compat.v1.ConfigProto(log_device_placement = True, allow_sof ...@@ -211,7 +211,7 @@ session_config = tf.compat.v1.ConfigProto(log_device_placement = True, allow_sof
config = tf.estimator.RunConfig(save_checkpoints_steps = 10000) config = tf.estimator.RunConfig(save_checkpoints_steps = 10000)
wideAndDeepModel = tf.estimator.DNNLinearCombinedClassifier(model_dir = './wideAndDeep_tf1', wideAndDeepModel = tf.estimator.DNNLinearCombinedClassifier(model_dir = BASE_DIR + 'model',
linear_feature_columns = linear_feature_columns, linear_feature_columns = linear_feature_columns,
dnn_feature_columns = dnn_feature_columns, dnn_feature_columns = dnn_feature_columns,
dnn_hidden_units = [128, 32], dnn_hidden_units = [128, 32],
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment