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
5f59177f
Commit
5f59177f
authored
Oct 16, 2019
by
高雅喆
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
指标进tidb
parent
bbdc3ade
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
23 additions
and
0 deletions
+23
-0
evaluation_metrics.py
eda/smart_rank/evaluation_metrics.py
+10
-0
tool.py
eda/smart_rank/tool.py
+13
-0
No files found.
eda/smart_rank/evaluation_metrics.py
View file @
5f59177f
...
...
@@ -433,5 +433,14 @@ if __name__ == '__main__':
log1
.
info
({
"比对不上的有画像的人数"
:
result
[
"not_coincide_have_portrait_count"
]})
log1
.
info
({
"比对不上的无画像的人数"
:
result
[
"not_coincide_no_portrait_count"
]})
log1
.
info
(
"="
*
66
)
# 统计数据进tidb
tplt
=
"insert into user_portrait_tags_evalution values(null,'{0}','{1}','{2}',{3},{4},{5},{6},{7})"
stat_date
=
order_date
.
replace
(
"-"
,
""
)
insert_sql
=
tplt
.
format
(
stat_date
,
"英赫版"
if
version
==
1
else
"翔宇版"
,
action_type_detail
,
result
[
"device_count"
],
result
[
"coincide_count"
],
result
[
"coincide_rate"
],
result
[
"not_coincide_have_portrait_count"
],
result
[
"not_coincide_no_portrait_count"
])
write_data_by_mysql
(
'172.16.40.158'
,
4000
,
'root'
,
'3SYz54LS9#^9sBvC'
,
'jerry_test'
,
insert_sql
)
except
Exception
as
e
:
print
(
e
)
\ No newline at end of file
eda/smart_rank/tool.py
View file @
5f59177f
...
...
@@ -60,6 +60,19 @@ def get_data_by_mysql(host, port, user, passwd, db, sql):
print
(
e
)
def
write_data_by_mysql
(
host
,
port
,
user
,
passwd
,
db
,
sql
):
try
:
db
=
pymysql
.
connect
(
host
=
host
,
port
=
port
,
user
=
user
,
passwd
=
passwd
,
db
=
db
,
cursorclass
=
pymysql
.
cursors
.
DictCursor
)
cursor
=
db
.
cursor
()
cursor
.
execute
(
sql
)
db
.
commit
()
db
.
close
()
return
True
except
Exception
as
e
:
print
(
e
)
return
False
def
get_all_search_word_synonym_tags
():
"""
:return:dict {"search_word1":[tag_list1],"search_word2":[tag_list2]...}
...
...
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