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
ffa259c7
Commit
ffa259c7
authored
Feb 20, 2019
by
王志伟
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
数据指标波动假设检验统计
parent
1059174e
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
59 additions
and
5 deletions
+59
-5
hypothesis_test.py
eda/recommended_indexs/hypothesis_test.py
+59
-5
No files found.
eda/recommended_indexs/hypothesis_test.py
View file @
ffa259c7
...
...
@@ -170,7 +170,7 @@ def get_fivedate():
return
someday
five_days
=
get_fivedate
()
#获取最近5天的数据
#获取最近5天的数据
,此函数只适用于on_click_diary_card表格,具体原因可以查看数据代码
def
chi_DATA_recently
(
x
,
y
,
z
,
q
,
t1
,
t2
):
sql_cid
=
"select AVG({0}+{1}),AVG({2}) from {3}
\
where stat_date >= '{4}' and stat_date < '{5}' "
.
format
(
x
,
y
,
z
,
q
,
t1
,
t2
)
...
...
@@ -180,6 +180,17 @@ def chi_DATA_yesterday(x,y,z,q,t1):
sql_cid
=
"select {0}+{1},{2} from {3} where stat_date='{4}' "
.
format
(
x
,
y
,
z
,
q
,
t1
)
CVR_DATA_yesterday
=
con_sql
(
sql_cid
)[
0
]
return
CVR_DATA_yesterday
#获取最近5天的数据
def
chi_DATA_recently_all
(
x
,
y
,
z
,
q
,
t1
,
t2
):
sql_cid
=
"select AVG({0}),AVG({1}) from {2}
\
where stat_date >= '{3}' and stat_date < '{4}' "
.
format
(
x
,
y
,
z
,
t1
,
t2
)
CVR_DATA_recently
=
con_sql
(
sql_cid
)[
0
]
return
CVR_DATA_recently
def
chi_DATA_yesterday_all
(
x
,
y
,
z
,
q
,
t1
):
sql_cid
=
"select {0},{1} from {2} where stat_date='{3}' "
.
format
(
x
,
y
,
z
,
t1
)
CVR_DATA_yesterday
=
con_sql
(
sql_cid
)[
0
]
return
CVR_DATA_yesterday
#整理数据
def
data_cal
(
x
,
y
):
...
...
@@ -227,8 +238,8 @@ temp1_old=[float(str(Decimal(chi_ctr_precise_old_recently[i]).quantize(Decimal('
chi_ctr_precise_old_yesterday
=
chi_DATA_yesterday
(
"clk_count_oldUser_all_a"
,
"clk_count_oldUser_all_b"
,
"imp_count_oldUser_all_precise"
,
"on_click_diary_card"
,
yesterday
)
temp2_old
=
[
float
(
chi_ctr_precise_old_yesterday
[
i
])
for
i
in
range
(
len
(
chi_ctr_precise_old_yesterday
))]
# print(temp2)
tst_old
=
data_cal
(
temp1_old
,
temp2_old
)
chi_cal
(
tst_old
)
ctr_
tst_old
=
data_cal
(
temp1_old
,
temp2_old
)
chi_cal
(
ctr_
tst_old
)
#新用户精准点击曝光数据(首页精选日记本列表on_click_diary_card)
print
(
"【2】(精准曝光)首页精选日记本列表新用户ctr数据波动假设检验结果:"
)
...
...
@@ -238,8 +249,51 @@ temp1_new=[float(str(Decimal(chi_ctr_precise_new_recently[i]).quantize(Decimal('
chi_ctr_precise_new_yesterday
=
chi_DATA_yesterday
(
"clk_count_newUser_all_a"
,
"clk_count_newUser_all_b"
,
"imp_count_newUser_all_precise"
,
"on_click_diary_card"
,
yesterday
)
temp2_new
=
[
float
(
chi_ctr_precise_new_yesterday
[
i
])
for
i
in
range
(
len
(
chi_ctr_precise_new_yesterday
))]
# print(temp2)
tst_new
=
data_cal
(
temp1_new
,
temp2_new
)
chi_cal
(
tst_new
)
ctr_tst_new
=
data_cal
(
temp1_new
,
temp2_new
)
chi_cal
(
ctr_tst_new
)
#老用户美购转化数据
print
(
"【3】老用户CVR数据波动假设检验结果:"
)
chi_cvr_old_recently
=
chi_DATA_recently_all
(
"diary_meigou_oldUser"
,
"diary_clk_oldUser"
,
"diary_meigou_crv"
,
five_days
,
yesterday
)
cvr_old
=
[
float
(
str
(
Decimal
(
chi_cvr_old_recently
[
i
])
.
quantize
(
Decimal
(
'0.0'
))))
for
i
in
range
(
len
(
chi_cvr_old_recently
))]
# print(temp1)
chi_cvr_old_yesterday
=
chi_DATA_yesterday_all
(
"diary_meigou_oldUser"
,
"diary_clk_oldUser"
,
"diary_meigou_crv"
,
yesterday
)
cvr_old2
=
[
float
(
chi_cvr_old_yesterday
[
i
])
for
i
in
range
(
len
(
chi_cvr_old_yesterday
))]
# print(temp2)
cvr_tst_old
=
data_cal
(
cvr_old
,
cvr_old2
)
chi_cal
(
cvr_tst_old
)
#老用户美购转化数据
print
(
"【3】新用户CVR数据波动假设检验结果:"
)
chi_cvr_new_recently
=
chi_DATA_recently_all
(
"diary_meigou_newUser"
,
"diary_clk_newUser"
,
"diary_meigou_crv"
,
five_days
,
yesterday
)
cvr_new
=
[
float
(
str
(
Decimal
(
chi_cvr_new_recently
[
i
])
.
quantize
(
Decimal
(
'0.0'
))))
for
i
in
range
(
len
(
chi_cvr_new_recently
))]
# print(temp1)
chi_cvr_new_yesterday
=
chi_DATA_yesterday_all
(
"diary_meigou_newUser"
,
"diary_clk_newUser"
,
"diary_meigou_crv"
,
yesterday
)
cvr_new2
=
[
float
(
chi_cvr_new_yesterday
[
i
])
for
i
in
range
(
len
(
chi_cvr_new_yesterday
))]
# print(temp2)
cvr_tst_new
=
data_cal
(
cvr_new
,
cvr_new2
)
chi_cal
(
cvr_tst_new
)
#老用户美购转化数据
print
(
"【3】老用户CT-CVR数据波动假设检验结果:"
)
chi_ctcvr_old_recently
=
chi_DATA_recently_all
(
"diary_meigou_oldUser"
,
"diary_exp_oldUser"
,
"diary_meigou_crv"
,
five_days
,
yesterday
)
ctcvr_old
=
[
float
(
str
(
Decimal
(
chi_ctcvr_old_recently
[
i
])
.
quantize
(
Decimal
(
'0.0'
))))
for
i
in
range
(
len
(
chi_ctcvr_old_recently
))]
# print(temp1)
chi_ctcvr_old_yesterday
=
chi_DATA_yesterday_all
(
"diary_meigou_oldUser"
,
"diary_exp_oldUser"
,
"diary_meigou_crv"
,
yesterday
)
ctcvr_old2
=
[
float
(
chi_ctcvr_old_yesterday
[
i
])
for
i
in
range
(
len
(
chi_ctcvr_old_yesterday
))]
# print(temp2)
ctcvr_tst_old
=
data_cal
(
ctcvr_old
,
ctcvr_old2
)
chi_cal
(
ctcvr_tst_old
)
#老用户美购转化数据
print
(
"【3】新用户CT-CVR数据波动假设检验结果:"
)
chi_ctcvr_new_recently
=
chi_DATA_recently_all
(
"diary_meigou_newUser"
,
"diary_exp_newUser"
,
"diary_meigou_crv"
,
five_days
,
yesterday
)
ctcvr_new
=
[
float
(
str
(
Decimal
(
chi_ctcvr_new_recently
[
i
])
.
quantize
(
Decimal
(
'0.0'
))))
for
i
in
range
(
len
(
chi_ctcvr_new_recently
))]
# print(temp1)
chi_ctcvr_new_yesterday
=
chi_DATA_yesterday_all
(
"diary_meigou_newUser"
,
"diary_exp_newUser"
,
"diary_meigou_crv"
,
yesterday
)
ctcvr_new2
=
[
float
(
chi_ctcvr_new_yesterday
[
i
])
for
i
in
range
(
len
(
chi_ctcvr_new_yesterday
))]
# print(temp2)
ctcvr_tst_new
=
data_cal
(
ctcvr_new
,
ctcvr_new2
)
chi_cal
(
ctcvr_tst_new
)
# print(chi_ctr_precise_recently)
...
...
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