Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
G
gm_strategy_cvr
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
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
rank
gm_strategy_cvr
Commits
2193e8e9
Commit
2193e8e9
authored
Jul 24, 2020
by
赵威
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update printer
parent
7a45d6c4
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
1 addition
and
11 deletions
+1
-11
main_portrait.py
src/main_portrait.py
+0
-1
model.py
src/models/esmm/model.py
+1
-10
No files found.
src/main_portrait.py
View file @
2193e8e9
...
@@ -47,7 +47,6 @@ def main():
...
@@ -47,7 +47,6 @@ def main():
device_dict
=
get_device_dict_from_redis
()
device_dict
=
get_device_dict_from_redis
()
diary_dict
=
get_diary_dict_from_redis
()
diary_dict
=
get_diary_dict_from_redis
()
print
(
list
(
diary_dict
.
keys
())[:
20
])
print
(
"redis data: "
+
str
(
len
(
device_dict
))
+
" "
+
str
(
len
(
diary_dict
)))
print
(
"redis data: "
+
str
(
len
(
device_dict
))
+
" "
+
str
(
len
(
diary_dict
)))
save_path
=
"/home/gmuser/data/models/1595501144"
save_path
=
"/home/gmuser/data/models/1595501144"
...
...
src/models/esmm/model.py
View file @
2193e8e9
...
@@ -97,10 +97,7 @@ def _bytes_feature(value):
...
@@ -97,10 +97,7 @@ def _bytes_feature(value):
def
model_predict_diary
(
device_id
,
diary_ids
,
device_dict
,
diary_dict
,
predict_fn
):
def
model_predict_diary
(
device_id
,
diary_ids
,
device_dict
,
diary_dict
,
predict_fn
):
time_1
=
timeit
.
default_timer
()
time_1
=
timeit
.
default_timer
()
device_info
,
diary_lst
,
diary_ids_res
=
device_diary_fe
(
device_id
,
diary_ids
,
device_dict
,
diary_dict
)
device_info
,
diary_lst
,
diary_ids_res
=
device_diary_fe
(
device_id
,
diary_ids
,
device_dict
,
diary_dict
)
print
(
"device_info: "
)
print
(
"predict check: "
+
str
(
len
(
diary_lst
))
+
" "
+
str
(
len
(
diary_ids_res
)))
print
(
device_info
)
print
(
diary_lst
)
print
(
diary_ids_res
)
int_columns
=
[
int_columns
=
[
"active_type"
,
"active_days"
,
"card_id"
,
"is_pure_author"
,
"is_have_reply"
,
"is_have_pure_reply"
,
"content_level"
,
"active_type"
,
"active_days"
,
"card_id"
,
"is_pure_author"
,
"is_have_reply"
,
"is_have_pure_reply"
,
"content_level"
,
"topic_num"
,
"favor_num"
,
"vote_num"
"topic_num"
,
"favor_num"
,
"vote_num"
...
@@ -117,8 +114,6 @@ def model_predict_diary(device_id, diary_ids, device_dict, diary_dict, predict_f
...
@@ -117,8 +114,6 @@ def model_predict_diary(device_id, diary_ids, device_dict, diary_dict, predict_f
tmp
=
{}
tmp
=
{}
tmp
.
update
(
device_info
)
tmp
.
update
(
device_info
)
tmp
.
update
(
diary_info
)
tmp
.
update
(
diary_info
)
# TODO
print
(
tmp
)
features
=
{}
features
=
{}
for
col
in
int_columns
:
for
col
in
int_columns
:
features
[
col
]
=
_int64_feature
(
int
(
tmp
[
col
]))
features
[
col
]
=
_int64_feature
(
int
(
tmp
[
col
]))
...
@@ -129,15 +124,11 @@ def model_predict_diary(device_id, diary_ids, device_dict, diary_dict, predict_f
...
@@ -129,15 +124,11 @@ def model_predict_diary(device_id, diary_ids, device_dict, diary_dict, predict_f
example
=
tf
.
train
.
Example
(
features
=
tf
.
train
.
Features
(
feature
=
features
))
example
=
tf
.
train
.
Example
(
features
=
tf
.
train
.
Features
(
feature
=
features
))
examples
.
append
(
example
.
SerializeToString
())
examples
.
append
(
example
.
SerializeToString
())
# TODO
print
(
examples
)
total_1
=
(
timeit
.
default_timer
()
-
time_1
)
total_1
=
(
timeit
.
default_timer
()
-
time_1
)
print
(
"make example cost {:.5f}s"
.
format
(
total_1
))
print
(
"make example cost {:.5f}s"
.
format
(
total_1
))
time_1
=
timeit
.
default_timer
()
time_1
=
timeit
.
default_timer
()
predictions
=
predict_fn
({
"examples"
:
examples
})
predictions
=
predict_fn
({
"examples"
:
examples
})
# TODO
print
(
predictions
)
res_tuple
=
sorted
(
zip
(
diary_ids_res
,
predictions
[
"output"
]
.
tolist
()),
key
=
lambda
x
:
x
[
1
],
reverse
=
True
)
res_tuple
=
sorted
(
zip
(
diary_ids_res
,
predictions
[
"output"
]
.
tolist
()),
key
=
lambda
x
:
x
[
1
],
reverse
=
True
)
res
=
[]
res
=
[]
for
(
id
,
_
)
in
res_tuple
:
for
(
id
,
_
)
in
res_tuple
:
...
...
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