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
f0746c05
Commit
f0746c05
authored
Aug 31, 2018
by
张彦钊
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of git.wanmeizhensuo.com:ML/ffm-baseline
增加数据库捕捉异
parents
76c111ee
6e209881
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
31 additions
and
8 deletions
+31
-8
grayStat.py
eda/gray_stat/grayStat.py
+30
-7
main.py
eda/recommended_indexs/main.py
+1
-1
No files found.
eda/gray_stat/grayStat.py
View file @
f0746c05
from
utils
import
con_sql
,
tuple2dict
,
get_yesterday_date
# -*- coding: UTF-8 -*-
from
utils
import
con_sql
,
get_yesterday_date
import
time
OUTPUT_PATH
=
"/data2/models/eda/gray_stat/"
class
GrayStat
(
object
):
def
__init__
(
self
,
cid_type
,
uid_type
,
platform
,
ndays
=
get_yesterday_date
()):
...
...
@@ -55,11 +60,13 @@ class GrayStat(object):
if
__name__
==
'__main__'
:
print
(
"开始获取ffm中的灰度非灰度比例"
)
start
=
time
.
time
()
#1.ffm中的灰度非灰度(ios和安卓一样):
# 灰度:_6
# 非灰度:_8
result1
=
[]
#1.1获取ios和android平台的数据
platforms
=
[
'ios'
,
'android'
]
grays
=
[
'6'
,
'8'
]
for
platform
in
platforms
:
...
...
@@ -76,6 +83,7 @@ if __name__ == '__main__':
result1
[
-
1
][
5
]
+
result1
[
-
2
][
5
],
\
result1
[
-
1
][
6
]
+
result1
[
-
2
][
6
],
\
round
((
result1
[
-
1
][
5
]
+
result1
[
-
2
][
5
])
/
(
result1
[
-
1
][
6
]
+
result1
[
-
2
][
6
]),
4
)])
#1.2获取所有平台的数据
labels
=
[
'6'
,
'8'
,
'all'
]
for
i
in
range
(
3
):
result1
.
append
([
g_class
.
ndays
,
g_class
.
cid_type
,
'all'
,
labels
[
i
],
\
...
...
@@ -83,8 +91,13 @@ if __name__ == '__main__':
result1
[
i
][
5
]
+
result1
[
i
+
3
][
5
],
\
result1
[
i
][
6
]
+
result1
[
i
+
3
][
6
],
\
round
((
result1
[
i
][
5
]
+
result1
[
i
+
3
][
5
])
/
(
result1
[
i
][
6
]
+
result1
[
i
+
3
][
6
]),
4
)])
#1.3把一天所有的数据存入文件
output1
=
OUTPUT_PATH
+
"gray_ffm.csv"
with
open
(
output1
,
'a+'
)
as
f
:
for
line
in
result1
:
line
=
[
str
(
i
)
for
i
in
line
]
str_line
=
','
.
join
(
line
)
+
','
+
'
\n
'
f
.
write
(
str_line
)
#2.实际中的灰度非灰度:
# ios:
...
...
@@ -93,7 +106,9 @@ if __name__ == '__main__':
# android:
# 灰度:0|1|2|6|8
#非灰度:^01268
print
(
"开始获取实际中的灰度非灰度比例"
)
result2
=
[]
#2.1获取ios和android平台的数据
platforms
=
[
'ios'
,
'android'
]
for
platform
in
platforms
:
#TODO 对于(安卓灰度放到 0 1 2 6 8;iOS灰度保持 6 8)问题,做一个id判断即可
...
...
@@ -114,6 +129,7 @@ if __name__ == '__main__':
result2
[
-
1
][
5
]
+
result2
[
-
2
][
5
],
\
result2
[
-
1
][
6
]
+
result2
[
-
2
][
6
],
\
round
((
result2
[
-
1
][
5
]
+
result2
[
-
2
][
5
])
/
(
result2
[
-
1
][
6
]
+
result2
[
-
2
][
6
]),
4
)])
#2.2获取所有平台的数据
labels
=
[
'gray'
,
'not gray'
,
'all'
]
for
i
in
range
(
3
):
result2
.
append
([
g_class
.
ndays
,
g_class
.
cid_type
,
'all'
,
labels
[
i
],
\
...
...
@@ -121,8 +137,15 @@ if __name__ == '__main__':
result2
[
i
][
5
]
+
result2
[
i
+
3
][
5
],
\
result2
[
i
][
6
]
+
result2
[
i
+
3
][
6
],
\
round
((
result2
[
i
][
5
]
+
result2
[
i
+
3
][
5
])
/
(
result2
[
i
][
6
]
+
result2
[
i
+
3
][
6
]),
4
)])
#2.3把一天所有的数据写入文件
output2
=
OUTPUT_PATH
+
"gray_all.csv"
with
open
(
output2
,
'a+'
)
as
f
:
for
line
in
result2
:
line
=
[
str
(
i
)
for
i
in
line
]
str_line
=
','
.
join
(
line
)
+
','
+
'
\n
'
f
.
write
(
str_line
)
end
=
time
.
time
()
print
(
"程序执行时间:{}s"
.
format
(
end
-
start
))
eda/recommended_indexs/main.py
View file @
f0746c05
...
...
@@ -116,7 +116,7 @@ print("done")
end
=
time
.
time
()
print
(
'程序执行时间:
'
,
end
-
start
)
print
(
'程序执行时间:
{}s'
.
format
(
end
-
start
)
)
...
...
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