-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathhypothesis_testing.py
More file actions
55 lines (42 loc) · 1.72 KB
/
hypothesis_testing.py
File metadata and controls
55 lines (42 loc) · 1.72 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
from __future__ import annotations
from ..dataset import Dataset
from ..extensions.scipy_stats import (Chi2TestExtension, KSTestExtension,
TTestExtension, UTestExtension)
from ..utils.constants import NUMBER_TYPES_LIST
from .abstract import StatHypothesisTesting
class TTest(StatHypothesisTesting):
@property
def search_types(self) -> list[type] | None:
return NUMBER_TYPES_LIST
@classmethod
def calc(cls, data: Dataset, test_data: Dataset | None = None, **kwargs) -> Dataset:
return TTestExtension(kwargs.get("reliability", 0.05)).calc(
data, other=test_data, **kwargs
)
class KSTest(StatHypothesisTesting):
@property
def search_types(self) -> list[type] | None:
return NUMBER_TYPES_LIST
@classmethod
def calc(cls, data: Dataset, test_data: Dataset | None = None, **kwargs) -> Dataset:
return KSTestExtension(kwargs.get("reliability", 0.05)).calc(
data, other=test_data, **kwargs
)
class UTest(StatHypothesisTesting):
@property
def search_types(self) -> list[type] | None:
return NUMBER_TYPES_LIST
@classmethod
def calc(cls, data: Dataset, test_data: Dataset | None = None, **kwargs) -> Dataset:
return UTestExtension(kwargs.get("reliability", 0.05)).calc(
data, other=test_data, **kwargs
)
class Chi2Test(StatHypothesisTesting):
@property
def search_types(self) -> list[type] | None:
return [str]
@classmethod
def calc(cls, data: Dataset, test_data: Dataset | None = None, **kwargs) -> Dataset:
return Chi2TestExtension(reliability=kwargs.get("reliability", 0.05)).calc(
data, other=test_data, **kwargs
)