Commit 3c51e7b1 authored by Your Name's avatar Your Name

dist predict test

parent fff075d7
...@@ -55,7 +55,6 @@ def input_fn(filenames, batch_size=32, num_epochs=1, perform_shuffle=False): ...@@ -55,7 +55,6 @@ def input_fn(filenames, batch_size=32, num_epochs=1, perform_shuffle=False):
return batch_features, batch_labels return batch_features, batch_labels
def model_fn(features, labels, mode, params): def model_fn(features, labels, mode, params):
"""Bulid Model function f(x) for Estimator.""" """Bulid Model function f(x) for Estimator."""
#------hyperparameters---- #------hyperparameters----
...@@ -268,14 +267,17 @@ if __name__ == "__main__": ...@@ -268,14 +267,17 @@ if __name__ == "__main__":
rdd_te_files = spark.sparkContext.parallelize(te_files) rdd_te_files = spark.sparkContext.parallelize(te_files)
print("-"*100) print("-"*100)
indices = rdd_te_files.repartition(40).map(lambda x: main(x)) # indices = rdd_te_files.repartition(40).map(lambda x: main(x))
print(indices.take(1)) # print(indices.take(1))
print("dist predict nearby") print("dist predict nearby")
te_result_dataframe = spark.createDataFrame(indices.flatMap(lambda x: x.split(";")).map( test = main(te_files[0])
lambda l: Row(uid=l.split(":")[0],city=l.split(":")[1],cid_id=l.split(":")[2],ctcvr=l.split(":")[3]))) print(test[:50])
te_result_dataframe.show() # te_result_dataframe = spark.createDataFrame(indices.flatMap(lambda x: x.split(";")).map(
# lambda l: Row(uid=l.split(":")[0],city=l.split(":")[1],cid_id=l.split(":")[2],ctcvr=l.split(":")[3])))
#
# te_result_dataframe.show()
# print("nearby rdd data") # print("nearby rdd data")
# te_result_dataframe.show() # te_result_dataframe.show()
......
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