Skip to content

Commit

Permalink
add comment
Browse files Browse the repository at this point in the history
  • Loading branch information
dariodandrea committed Jun 14, 2024
1 parent 96493d6 commit 1e41b21
Showing 1 changed file with 17 additions and 9 deletions.
26 changes: 17 additions & 9 deletions abexp/core/planning.py
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
# MIT License
#
#
# Copyright (c) 2021 Playtika Ltd.
#
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
#
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
#
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
Expand All @@ -26,9 +26,10 @@


class Planning:

@staticmethod
def planning_diff_mean(avg_n_users_per_day, mean_contr, mean_treat, std_contr, alpha=0.05, power=0.8):
def planning_diff_mean(
avg_n_users_per_day, mean_contr, mean_treat, std_contr, alpha=0.05, power=0.8
):
"""
Use the sample size determination with means comparison from the core.design.SampleSize class
to estimate the number of days that a test must run to achieve the desired significance and power level.
Expand Down Expand Up @@ -66,12 +67,16 @@ def planning_diff_mean(avg_n_users_per_day, mean_contr, mean_treat, std_contr, a
return np.Inf

# Compute required sample size
sample_size = SampleSize.ssd_mean(mean_contr, mean_treat, std_contr, alpha, power)
sample_size = SampleSize.ssd_mean(
mean_contr, mean_treat, std_contr, alpha, power
)

return int(np.ceil(sample_size/avg_n_users_per_day))
return int(np.ceil(sample_size / avg_n_users_per_day))

@staticmethod
def planning_diff_prop(avg_n_users_per_day, prop_contr, prop_treat, alpha=0.05, power=0.8):
def planning_diff_prop(
avg_n_users_per_day, prop_contr, prop_treat, alpha=0.05, power=0.8
):
"""
Use the sample size determination with proportions comparison from the core.design.SampleSize class
to estimate the number of days that a test must run to achieve the desired significance and power level.
Expand Down Expand Up @@ -109,3 +114,6 @@ def planning_diff_prop(avg_n_users_per_day, prop_contr, prop_treat, alpha=0.05,
sample_size = SampleSize.ssd_prop(prop_contr, prop_treat, alpha, power)

return int(np.ceil(sample_size / avg_n_users_per_day))


# comment

0 comments on commit 1e41b21

Please sign in to comment.