Commit f55f775b authored by Your Name's avatar Your Name

predict native

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