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
bdc5743a
Commit
bdc5743a
authored
Aug 31, 2018
by
高雅喆
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
gray stat data to file
parent
0496a874
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
5 deletions
+23
-5
grayStat.py
eda/gray_stat/grayStat.py
+23
-5
No files found.
eda/gray_stat/grayStat.py
View file @
bdc5743a
from
utils
import
con_sql
,
tuple2dict
,
get_yesterday_date
import
sys
sys
.
path
.
append
(
'..'
)
from
recommended_indexs.utils
import
con_sql
,
get_yesterday_date
OUTPUT_PATH
=
"/data2/models/eda/gray_stat/"
class
GrayStat
(
object
):
def
__init__
(
self
,
cid_type
,
uid_type
,
platform
,
ndays
=
get_yesterday_date
()):
...
...
@@ -60,6 +63,7 @@ if __name__ == '__main__':
# 灰度:_6
# 非灰度:_8
result1
=
[]
#1.1获取ios和android平台的数据
platforms
=
[
'ios'
,
'android'
]
grays
=
[
'6'
,
'8'
]
for
platform
in
platforms
:
...
...
@@ -76,6 +80,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 +88,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:
...
...
@@ -94,6 +104,7 @@ if __name__ == '__main__':
# 灰度:0|1|2|6|8
#非灰度:^01268
result2
=
[]
#2.1获取ios和android平台的数据
platforms
=
[
'ios'
,
'android'
]
for
platform
in
platforms
:
#TODO 对于(安卓灰度放到 0 1 2 6 8;iOS灰度保持 6 8)问题,做一个id判断即可
...
...
@@ -114,6 +125,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 +133,14 @@ 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
)
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