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
401b81df
Commit
401b81df
authored
Aug 29, 2018
by
张彦钊
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add print
parent
411bb75d
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
20 deletions
+21
-20
diaryQueueUpdate.py
diaryQueueUpdate.py
+15
-14
utils.py
utils.py
+6
-6
No files found.
diaryQueueUpdate.py
View file @
401b81df
...
...
@@ -244,20 +244,21 @@ if __name__ == "__main__":
# 增加缓存日记视频列表
cache_video_id
=
[]
cache_device_city_list
=
[]
while
True
:
data_set_cid
=
pd
.
read_csv
(
DIRECTORY_PATH
+
"data_set_cid.csv"
)[
"cid"
]
.
values
.
tolist
()
total_video_id
=
get_video_id
(
cache_video_id
)
cache_video_id
=
total_video_id
device_city_list
=
get_active_users
()
# 过滤掉上次预测过的用户
device_city_list
=
list
(
set
(
device_city_list
)
-
set
(
cache_device_city_list
))
cache_device_city_list
=
device_city_list
total_number
+=
len
(
device_city_list
)
print
(
"累计预测用户总数:{}"
.
format
(
total_number
))
if
device_city_list
!=
[]:
for
device_city
in
device_city_list
:
# start = time.time()
multi_proecess_update
(
device_city
[
0
],
device_city
[
1
],
data_set_cid
,
total_video_id
)
# while True:
data_set_cid
=
pd
.
read_csv
(
DIRECTORY_PATH
+
"data_set_cid.csv"
)[
"cid"
]
.
values
.
tolist
()
total_video_id
=
get_video_id
(
cache_video_id
)
cache_video_id
=
total_video_id
# device_city_list = get_active_users()
device_city_list
=
[(
"AB20292B-5D15-4C44-9429-1C2FF5ED26F6"
,
"beijing"
),]
# 过滤掉上次预测过的用户
device_city_list
=
list
(
set
(
device_city_list
)
-
set
(
cache_device_city_list
))
cache_device_city_list
=
device_city_list
total_number
+=
len
(
device_city_list
)
print
(
"累计预测用户总数:{}"
.
format
(
total_number
))
if
device_city_list
!=
[]:
for
device_city
in
device_city_list
:
# start = time.time()
multi_proecess_update
(
device_city
[
0
],
device_city
[
1
],
data_set_cid
,
total_video_id
)
# end = time.time()
# print("更新该用户队列耗时{}秒".format((end - start)))
...
...
utils.py
View file @
401b81df
...
...
@@ -51,10 +51,10 @@ def con_sql(sql):
def
queue_compare
(
old_list
,
new_list
):
# 去掉前面的"diary|"
old_list
=
list
(
map
(
lambda
x
:
int
(
x
[
6
:]),
old_list
))
#
print("旧表前十个")
#
print(old_list[:10])
#
print("新表前十个")
#
print(new_list[:10])
print
(
"旧表前十个"
)
print
(
old_list
[:
10
])
print
(
"新表前十个"
)
print
(
new_list
[:
10
])
temp
=
list
(
range
(
len
(
old_list
)))
x_dict
=
dict
(
zip
(
old_list
,
temp
))
temp
=
list
(
range
(
len
(
new_list
)))
...
...
@@ -63,8 +63,8 @@ def queue_compare(old_list, new_list):
for
key
in
x_dict
.
keys
():
if
x_dict
[
key
]
!=
y_dict
[
key
]:
i
+=
1
if
i
>
0
:
print
(
"日记队列更新前日记总个数{},位置发生变化个数{},发生变化率{}
%
"
.
format
(
len
(
old_list
),
i
,
print
(
"日记队列更新前日记总个数{},位置发生变化个数{},发生变化率{}
%
"
.
format
(
len
(
old_list
),
i
,
round
(
i
/
len
(
old_list
)
*
100
),
2
))
...
...
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