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
8746e9ab
Commit
8746e9ab
authored
Aug 09, 2018
by
高雅喆
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of git.wanmeizhensuo.com:ML/ffm-baseline
fix tab
parents
e2672cfb
329c9e43
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
1 deletion
+4
-1
predictDiary.py
predictDiary.py
+4
-1
No files found.
predictDiary.py
View file @
8746e9ab
...
...
@@ -54,6 +54,7 @@ def predict(user_profile):
ffm_model
.
predict
(
DIRECTORY_PATH
+
"model_{0}-{1}_lr{2}_lambda{3}.out"
.
format
(
DATA_START_DATE
,
DATA_END_DATE
,
lr
,
l2_lambda
),
DIRECTORY_PATH
+
"result/{0}_output.txt"
.
format
(
user_profile
[
'device_id'
]))
print
(
"预测结束"
)
predict_save_to_local
(
user_profile
,
instance
)
predict_save_to_redis
(
user_profile
,
instance
)
...
...
@@ -72,12 +73,14 @@ def predict_save_to_local(user_profile, instance):
proba
=
wrapper_result
(
user_profile
,
instance
)
proba
.
loc
[:,
"url"
]
=
proba
[
"cid"
]
.
apply
(
lambda
x
:
"http://m.igengmei.com/diary_book/"
+
str
(
x
[
6
:])
+
'/'
)
proba
.
to_csv
(
DIRECTORY_PATH
+
"result/feed_{}"
.
format
(
user_profile
[
'device_id'
]),
index
=
False
)
print
(
"成功将预测候选集保存到本地"
)
#
TODO 写
到redis
#
预测候选集保存
到redis
def
predict_save_to_redis
(
user_profile
,
instance
):
device_id
=
user_profile
[
'device_id'
]
cid_list
=
wrapper_result
(
user_profile
,
instance
)[
"cid"
]
.
values
.
tolist
()
add_data_to_redis
(
device_id
,
cid_list
)
print
(
"成功将预测候选集保存到redis"
)
def
router
(
device_id
):
user_profile
,
not_exist
=
fetch_user_profile
(
device_id
)
...
...
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