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
b6a24939
Commit
b6a24939
authored
Sep 06, 2019
by
张彦钊
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
change test
parent
e671a9bb
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
32 additions
and
52 deletions
+32
-52
topic.py
copy_doris/topic.py
+0
-0
monitor.py
monitor.py
+29
-23
rerank.py
rerank.py
+3
-29
No files found.
copy_doris/topic.py
View file @
b6a24939
This diff is collapsed.
Click to expand it.
monitor.py
View file @
b6a24939
...
...
@@ -211,30 +211,36 @@ def make_data(device_id,city_id,key_head):
# device_id = "868663038800476"
city_id
=
"beijing"
def
topic
():
device_id
=
"78687687"
dislike_key
=
str
(
device_id
)
+
"_dislike_tractate"
r
=
redis
.
StrictRedis
.
from_url
(
"redis://redis.paas-test.env:6379/2"
)
r
.
sadd
(
dislike_key
,
*
[
1
,
2
])
print
(
r
.
smembers
(
dislike_key
))
search
=
"TS:search_recommend_tractate_queue:device_id:"
+
str
(
device_id
)
a
=
[
1
]
a
.
extend
(
list
(
range
(
36
,
50
)))
r
.
hset
(
search
,
'tractate_queue'
,
json
.
dumps
(
a
))
print
(
r
.
hgetall
(
search
))
def
black
(
x
):
db_zhengxing
=
pymysql
.
connect
(
host
=
"172.16.30.143"
,
port
=
3306
,
user
=
"work"
,
password
=
"BJQaT9VzDcuPBqkd"
,
db
=
"zhengxing"
,
cursorclass
=
pymysql
.
cursors
.
DictCursor
)
cursor
=
db_zhengxing
.
cursor
()
date_str
=
str
(
datetime
.
datetime
.
now
())
sql
=
"REPLACE INTO hippo_deviceblacklist(device_id,create_at,update_at,pull_black_type)"
\
"values('{}','{}','{}',{})"
.
format
(
x
,
date_str
,
date_str
,
1
)
cursor
.
execute
(
sql
)
db_zhengxing
.
commit
()
db_zhengxing
.
close
()
if
__name__
==
"__main__"
:
users_list
=
list
(
range
(
1
,
90
))
n
=
3
split_users_list
=
[
users_list
[
i
:
i
+
n
]
for
i
in
range
(
0
,
len
(
users_list
),
n
)]
for
child_users_list
in
split_users_list
:
total_samples
=
list
()
for
uid_city
in
child_users_list
:
# tag_list = get_user_profile(uid_city[0])
# queues = get_queues(uid_city[0], uid_city[1])
# if len(queues) > 0 and len(tag_list) > 0:
# new_native = tag_boost(queues[0], tag_list)
# new_nearby = tag_boost(queues[1], tag_list)
#
# insert_time = str(datetime.datetime.now().strftime('%Y%m%d%H%M'))
# sample = [uid_city[0], uid_city[1], new_native, new_nearby, queues[2], queues[3], insert_time]
total_samples
.
append
(
uid_city
)
if
len
(
total_samples
)
>
0
:
df
=
pd
.
DataFrame
(
total_samples
)
df
=
df
.
rename
(
columns
=
{
0
:
"device_id"
})
print
(
"df numbers"
)
print
(
df
.
shape
[
0
])
# to_data_base(df)
black
(
"hello"
)
...
...
rerank.py
View file @
b6a24939
...
...
@@ -183,35 +183,9 @@ def get_all_users():
if
__name__
==
"__main__"
:
# users_list = get_esmm_users()
# print("user number")
# print(len(users_list))
users_list
=
get_all_users
()
name_tag
=
get_searchworlds_to_tagid
()
n
=
500
split_users_list
=
[
users_list
[
i
:
i
+
n
]
for
i
in
range
(
0
,
len
(
users_list
),
n
)]
for
child_users_list
in
split_users_list
:
total_samples
=
list
()
for
uid_city
in
child_users_list
:
tag_list
=
get_user_profile
(
uid_city
[
0
])
queues
=
get_queues
(
uid_city
[
0
],
uid_city
[
1
])
if
len
(
queues
)
>
0
:
new_native
=
tag_boost
(
queues
[
0
],
tag_list
)
new_nearby
=
tag_boost
(
queues
[
1
],
tag_list
)
insert_time
=
str
(
datetime
.
datetime
.
now
()
.
strftime
(
'
%
Y
%
m
%
d
%
H
%
M'
))
sample
=
[
uid_city
[
0
],
uid_city
[
1
],
new_native
,
new_nearby
,
queues
[
2
],
queues
[
3
],
insert_time
]
total_samples
.
append
(
sample
)
if
len
(
total_samples
)
>
0
:
df
=
pd
.
DataFrame
(
total_samples
)
df
=
df
.
rename
(
columns
=
{
0
:
"device_id"
,
1
:
"city_id"
,
2
:
"native_queue"
,
3
:
"nearby_queue"
,
4
:
"nation_queue"
,
5
:
"megacity_queue"
,
6
:
"time"
})
print
(
"数量"
)
print
(
df
.
shape
[
0
])
to_data_base
(
df
)
device_id
=
"868663038800476"
city_id
=
"beijing"
queues
=
get_queues
(
device_id
,
city_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