Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
F
ffm-baseline
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
ML
ffm-baseline
Commits
56803ce4
Commit
56803ce4
authored
May 22, 2019
by
张彦钊
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
change test file
parent
db8a49fd
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
5 deletions
+5
-5
multi.py
tensnsorflow/multi.py
+5
-5
No files found.
tensnsorflow/multi.py
View file @
56803ce4
...
...
@@ -71,11 +71,11 @@ def feature_engineer():
.
map
(
lambda
x
:
(
app_list_func
(
x
[
0
],
app_list_map
),[
value_map
[
x
[
2
]],
value_map
[
x
[
1
]]],
x
[
3
],
x
[
4
]))
spark
.
createDataFrame
(
test
)
.
toDF
(
"level2_ids"
,
"ids"
,
"y"
,
"z"
)
\
.
repartition
(
1
)
.
write
.
format
(
"tfrecords"
)
.
save
(
path
=
path
+
"va/"
,
mode
=
"overwrite"
)
.
repartition
(
1
)
.
write
.
format
(
"tfrecords"
)
.
option
(
"recordType"
,
"SequenceExample"
)
.
save
(
path
=
path
+
"va/"
,
mode
=
"overwrite"
)
print
(
"va write done"
)
spark
.
createDataFrame
(
train
)
.
toDF
(
"level2_ids"
,
"ids"
,
"y"
,
"z"
)
\
.
repartition
(
1
)
.
write
.
format
(
"tfrecords"
)
.
save
(
path
=
path
+
"tr/"
,
mode
=
"overwrite"
)
.
repartition
(
1
)
.
write
.
format
(
"tfrecords"
)
.
option
(
"recordType"
,
"SequenceExample"
)
.
save
(
path
=
path
+
"tr/"
,
mode
=
"overwrite"
)
print
(
"done"
)
rdd
.
unpersist
()
...
...
@@ -85,7 +85,7 @@ def feature_engineer():
def
get_predict
(
date
,
value_map
,
app_list_map
):
sql
=
"select e.y,e.z,e.label,e.ucity_id,feat.level2_ids,e.device_id,e.cid_id from esmm_pre_data e "
\
"left join diary_feat feat on e.cid_id = feat.diary_id"
"left join diary_feat feat on e.cid_id = feat.diary_id
limit 50000
"
features
=
[
"ucity_id"
]
df
=
spark
.
sql
(
sql
)
...
...
@@ -103,7 +103,7 @@ def get_predict(date,value_map,app_list_map):
spark
.
createDataFrame
(
rdd
.
filter
(
lambda
x
:
x
[
4
]
==
0
)
.
map
(
lambda
x
:
(
x
[
0
],
x
[
5
],
x
[
6
],
x
[
7
])))
\
.
toDF
(
"level2_ids"
,
"y"
,
"z"
,
"ids"
)
.
repartition
(
1
)
.
write
.
format
(
"tfrecords"
)
\
.
save
(
path
=
path
+
"native/"
,
mode
=
"overwrite"
)
.
option
(
"recordType"
,
"SequenceExample"
)
.
save
(
path
=
path
+
"native/"
,
mode
=
"overwrite"
)
nearby_pre
=
spark
.
createDataFrame
(
rdd
.
filter
(
lambda
x
:
x
[
4
]
==
1
)
.
map
(
lambda
x
:(
x
[
1
],
x
[
2
],
x
[
3
])))
\
.
toDF
(
"city"
,
"uid"
,
"cid_id"
)
...
...
@@ -111,7 +111,7 @@ def get_predict(date,value_map,app_list_map):
nearby_pre
.
toPandas
()
.
to_csv
(
local_path
+
"nearby.csv"
,
header
=
True
)
spark
.
createDataFrame
(
rdd
.
filter
(
lambda
x
:
x
[
4
]
==
1
)
.
map
(
lambda
x
:
(
x
[
0
],
x
[
5
],
x
[
6
],
x
[
7
])))
\
.
toDF
(
"level2_ids"
,
"y"
,
"z"
,
"ids"
)
.
repartition
(
1
)
.
write
.
format
(
"tfrecords"
)
\
.
save
(
path
=
path
+
"nearby/"
,
mode
=
"overwrite"
)
.
option
(
"recordType"
,
"SequenceExample"
)
.
save
(
path
=
path
+
"nearby/"
,
mode
=
"overwrite"
)
rdd
.
unpersist
()
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment