Commit e8f6dcd9 authored by Your Name's avatar Your Name

predict nearby

parent 442e56d0
......@@ -200,14 +200,14 @@ if __name__ == "__main__":
spark.sparkContext.setLogLevel("WARN")
path = "hdfs://172.16.32.4:8020/strategy/esmm/"
df = spark.read.format("tfrecords").load(path+"test_native/part-r-00000")
df = spark.read.format("tfrecords").load(path+"test_nearby/part-r-00000")
df.show()
te_files = []
for i in range(0,10):
te_files.append([path + "test_native/part-r-0000" + str(i)])
te_files.append([path + "test_nearby/part-r-0000" + str(i)])
for i in range(10,100):
te_files.append([path + "test_native/part-r-000" + str(i)])
te_files.append([path + "test_nearby/part-r-000" + str(i)])
rdd_te_files = spark.sparkContext.parallelize(te_files)
print("-"*100)
......@@ -218,7 +218,7 @@ if __name__ == "__main__":
te_result_dataframe = spark.createDataFrame(indices.flatMap(lambda x: x.split(";")).map(lambda l: Row(sample_id=l.split(":")[0],ctcvr=l.split(":")[1])))
te_result_dataframe.show()
te_result_dataframe.toPandas().to_csv("/home/gmuser/esmm/native/pred.txt", header=True)
te_result_dataframe.toPandas().to_csv("/home/gmuser/esmm/nearby/pred.txt", header=True)
......
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