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
7af47b94
Commit
7af47b94
authored
Aug 21, 2018
by
张彦钊
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
change main method for test
parent
be0f6ec9
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
13 deletions
+15
-13
predictDiary.py
predictDiary.py
+14
-13
userProfile.py
userProfile.py
+1
-0
No files found.
predictDiary.py
View file @
7af47b94
...
...
@@ -102,19 +102,20 @@ def multi_predict(predict_list,processes=12):
if
__name__
==
"__main__"
:
# TODO 如果耗时小于一分钟,下一次取到的device_id和上一次相同。还有一种情况,一个用户持续活跃,会被重复预测
while
True
:
empty
,
device_id_list
=
get_active_users
()
if
empty
:
for
eachFile
in
os
.
listdir
(
"/tmp"
):
if
"xlearn"
in
eachFile
:
os
.
remove
(
"/tmp"
+
"/"
+
eachFile
)
time
.
sleep
(
58
)
else
:
old_device_id_list
=
pd
.
read_csv
(
DIRECTORY_PATH
+
"data_set_device_id.csv"
)[
"device_id"
]
.
values
.
tolist
()
# 求活跃用户和老用户的交集,也就是只预测老用户
predict_list
=
list
(
set
(
device_id_list
)
&
set
(
old_device_id_list
))
multi_predict
(
predict_list
)
# while True:
# empty,device_id_list = get_active_users()
# if empty:
# for eachFile in os.listdir("/tmp"):
# if "xlearn" in eachFile:
# os.remove("/tmp" + "/" + eachFile)
# time.sleep(58)
# else:
# old_device_id_list = pd.read_csv(DIRECTORY_PATH + "data_set_device_id.csv")["device_id"].values.tolist()
# # 求活跃用户和老用户的交集,也就是只预测老用户
# predict_list = list(set(device_id_list) & set(old_device_id_list))
# multi_predict(predict_list)
router
(
"358035085192742"
)
#TODO 上线前把预测流程中的计时器、打印代码删掉或者注释,因为预测对性能要求高,能少一条代码语句就少一条
...
...
userProfile.py
View file @
7af47b94
...
...
@@ -31,4 +31,5 @@ def fetch_user_profile(device_id):
user_profile_dict
=
{}
for
i
in
user_profile
.
columns
:
user_profile_dict
[
i
]
=
user_profile
.
loc
[
0
,
i
]
print
(
user_profile_dict
)
return
user_profile_dict
,
False
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