Coverage for /Users/sebastiana/Documents/Sugarpills/confidence/spotify_confidence/analysis/frequentist/z_test_linreg.py: 100%

1# Copyright 2017-2020 Spotify AB

2#

3# Licensed under the Apache License, Version 2.0 (the "License");

4# you may not use this file except in compliance with the License.

5# You may obtain a copy of the License at

6#

7# http://www.apache.org/licenses/LICENSE-2.0

8#

9# Unless required by applicable law or agreed to in writing, software

10# distributed under the License is distributed on an "AS IS" BASIS,

11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.

12# See the License for the specific language governing permissions and

13# limitations under the License.

14

15 from typing import Union, Iterable

16

17 from pandas import DataFrame

18

19 from spotify_confidence.analysis.constants import BONFERRONI, METHOD_COLUMN_NAME

20 from .experiment import Experiment

21 from ..abstract_base_classes.confidence_computer_abc import ConfidenceComputerABC

22 from ..abstract_base_classes.confidence_grapher_abc import ConfidenceGrapherABC

23

24

25 class ZTestLinreg(Experiment):

26 def __init__(

27 self,

28 data_frame: DataFrame,

29 numerator_column: str,

30 numerator_sum_squares_column: Union[str, None],

31 denominator_column: str,

32 feature_column: Union[str, None],

33 feature_sum_squares_column: Union[str, None],

34 feature_cross_sum_column: Union[str, None],

35 categorical_group_columns: Union[str, Iterable],

36 ordinal_group_column: Union[str, None] = None,

37 metric_column: Union[str, None] = None,

38 treatment_column: Union[str, None] = None,

39 interval_size: float = 0.95,

40 power: float = 0.8,

41 correction_method: str = BONFERRONI,

42 confidence_computer: ConfidenceComputerABC = None,

43 confidence_grapher: ConfidenceGrapherABC = None,

44 ):

45 super().__init__(

46 data_frame=data_frame.assign(**{METHOD_COLUMN_NAME: "z-test-linreg"}),

47 numerator_column=numerator_column,

48 numerator_sum_squares_column=numerator_sum_squares_column,

49 denominator_column=denominator_column,

50 categorical_group_columns=categorical_group_columns,

51 ordinal_group_column=ordinal_group_column,

52 interval_size=interval_size,

53 correction_method=correction_method,

54 confidence_computer=confidence_computer,

55 confidence_grapher=confidence_grapher,

56 method_column=METHOD_COLUMN_NAME,

57 metric_column=metric_column,

58 treatment_column=treatment_column,

59 power=power,

60 feature_column=feature_column,

61 feature_sum_squares_column=feature_sum_squares_column,

62 feature_cross_sum_column=feature_cross_sum_column,

63 )