Commit 891b06a9 authored by Your Name's avatar Your Name

test

parent fa047b28
......@@ -162,14 +162,15 @@ def main(te_file):
preds = Estimator.predict(input_fn=lambda: input_fn(te_file, num_epochs=1, batch_size=10000), predict_keys=["pctcvr","pctr","pcvr"])
with open("/home/gmuser/esmm/nearby/pred.txt", "w") as fo:
for prob in preds:
fo.write("%f\t%f\t%f\n" % (prob['pctr'], prob['pcvr'], prob['pctcvr']))
#
# indices = []
# for prob in preds:
# indices.append([prob['pctr'], prob['pcvr'], prob['pctcvr']])
# return indices
# with open("/home/gmuser/esmm/nearby/pred.txt", "w") as fo:
# for prob in preds:
# fo.write("%f\t%f\t%f\n" % (prob['pctr'], prob['pcvr'], prob['pctcvr']))
indices = []
for prob in preds:
indices.append([prob['pctr'], prob['pcvr'], prob['pctcvr']])
print(prob['pctcvr'])
return indices
def test_map(x):
return x * x
......@@ -205,8 +206,6 @@ if __name__ == "__main__":
te_files = [[path+"nearby/part-r-00000"],[path+"native/part-r-00000"]]
rdd_te_files = spark.sparkContext.parallelize(te_files)
indices = rdd_te_files.repartition(2).map(lambda x: main(x))
print(indices.collect())
b = time.time()
print("耗时(分钟):")
......
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