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
82e9c33c
Commit
82e9c33c
authored
Jul 22, 2020
by
赵威
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
get result
parent
fa0c9d66
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
14 deletions
+3
-14
model.py
src/models/esmm/model.py
+3
-14
No files found.
src/models/esmm/model.py
View file @
82e9c33c
...
@@ -124,24 +124,13 @@ def model_predict_diary(device_id, diary_ids, device_dict, diary_dict, predict_f
...
@@ -124,24 +124,13 @@ 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
())
print
(
examples
)
a
=
json
.
dumps
(
examples
)
print
(
a
)
b
=
json
.
loads
(
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
})
predictions
=
predict_fn
({
"examples"
:
b
})
res
=
sorted
(
zip
(
diary_ids_res
,
predictions
[
"output"
]
.
tolist
()),
key
=
lambda
x
:
x
[
1
],
reverse
=
True
)
diary_ids
=
[]
print
(
res
)
for
i
in
diary_lst
:
diary_ids
.
append
(
i
.
get
(
"card_id"
,
"-1"
))
print
(
predictions
)
print
(
predictions
[
"output"
]
.
tolist
())
print
(
diary_ids_res
)
print
(
diary_ids
)
print
(
len
(
predictions
[
"output"
]
.
tolist
()),
len
(
diary_ids
),
len
(
diary_ids_res
))
total_1
=
(
timeit
.
default_timer
()
-
time_1
)
total_1
=
(
timeit
.
default_timer
()
-
time_1
)
print
(
"prediction cost {:.5f}s"
.
format
(
total_1
))
print
(
"prediction cost {:.5f}s"
.
format
(
total_1
))
return
predictions
return
predictions
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