Skip to content

Commit fbd2118

Browse files
authored
Merge pull request #172 from sb-ai-lab/dev/matching-n-neighbors
Dev/matching n neighbors
2 parents 48d0c30 + 445338e commit fbd2118

File tree

21 files changed

+118
-172
lines changed

21 files changed

+118
-172
lines changed

hypex/analyzers/ab.py

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,7 @@
44
from typing import Any
55

66
from ..comparators import TTest, UTest
7-
from ..dataset import (
8-
Dataset,
9-
ExperimentData,
10-
StatisticRole,
11-
TargetRole,
12-
TreatmentRole,
13-
)
7+
from ..dataset import Dataset, ExperimentData, StatisticRole, TargetRole, TreatmentRole
148
from ..experiments.base import Executor
159
from ..extensions.statsmodels import MultiTest, MultitestQuantile
1610
from ..utils import (

hypex/comparators/abstract.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -288,7 +288,7 @@ def _split_for_cross_mode(
288288
compared_data = cls._split_ds_into_columns(data=compared_data)
289289

290290
return baseline_data, compared_data
291-
291+
292292
@classmethod
293293
def _split_for_matched_pairs_mode(
294294
cls,
@@ -408,7 +408,7 @@ def execute(self, data: ExperimentData) -> ExperimentData:
408408
group_field_data = fields["group_field"]
409409
target_fields_data = fields["target_fields"]
410410
baseline_field_data = fields["baseline_field"]
411-
411+
412412
self.key = str(
413413
target_fields_data.columns[0]
414414
if len(target_fields_data.columns) == 1

hypex/dataset/__init__.py

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -5,28 +5,28 @@
55
from .abstract import DatasetBase
66
from .dataset import Dataset, DatasetAdapter, ExperimentData
77
from .roles import (
8-
ABCRole,
9-
AdditionalGroupingRole,
10-
AdditionalMatchingRole,
11-
AdditionalPreTargetRole,
12-
AdditionalTargetRole,
13-
AdditionalTreatmentRole,
14-
ConstGroupRole,
15-
DefaultRole,
16-
FeatureRole,
17-
FilterRole,
18-
GroupingRole,
19-
InfoRole,
20-
PreTargetRole,
21-
StatisticRole,
22-
StratificationRole,
23-
TargetRole,
24-
TempGroupingRole,
25-
TempRole,
26-
TempTargetRole,
27-
TempTreatmentRole,
28-
TreatmentRole,
29-
default_roles,
8+
ABCRole,
9+
AdditionalGroupingRole,
10+
AdditionalMatchingRole,
11+
AdditionalPreTargetRole,
12+
AdditionalTargetRole,
13+
AdditionalTreatmentRole,
14+
ConstGroupRole,
15+
DefaultRole,
16+
FeatureRole,
17+
FilterRole,
18+
GroupingRole,
19+
InfoRole,
20+
PreTargetRole,
21+
StatisticRole,
22+
StratificationRole,
23+
TargetRole,
24+
TempGroupingRole,
25+
TempRole,
26+
TempTargetRole,
27+
TempTreatmentRole,
28+
TreatmentRole,
29+
default_roles,
3030
)
3131

3232
__all__ = [

hypex/dataset/abstract.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,7 @@
99

1010
from ..utils import BackendsEnum, RoleColumnError
1111
from .backends import PandasDataset
12-
from .roles import (
13-
ABCRole,
14-
DefaultRole,
15-
default_roles,
16-
)
12+
from .roles import ABCRole, DefaultRole, default_roles
1713

1814

1915
def parse_roles(roles: dict) -> dict[str | int] | ABCRole:

hypex/dataset/backends/abstract.py

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,7 @@
11
from __future__ import annotations
22

33
from abc import ABC, abstractmethod
4-
from typing import (
5-
Any,
6-
Callable,
7-
Iterable,
8-
Literal,
9-
Sequence,
10-
Sized,
11-
)
4+
from typing import Any, Callable, Iterable, Literal, Sequence, Sized
125

136
from ...utils import AbstractMethodError, FromDictTypes
147

hypex/dataset/backends/pandas_backend.py

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,7 @@
11
from __future__ import annotations
22

33
from pathlib import Path
4-
from typing import (
5-
Any,
6-
Callable,
7-
Iterable,
8-
Literal,
9-
Sequence,
10-
Sized,
11-
)
4+
from typing import Any, Callable, Iterable, Literal, Sequence, Sized
125

136
import numpy as np
147
import pandas as pd # type: ignore

hypex/dataset/dataset.py

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,7 @@
33
import warnings
44
from collections.abc import Iterable
55
from copy import deepcopy
6-
from typing import (
7-
Any,
8-
Callable,
9-
Hashable,
10-
Literal,
11-
Sequence,
12-
)
6+
from typing import Any, Callable, Hashable, Literal, Sequence
137

148
import pandas as pd # type: ignore
159

hypex/dataset/roles.py

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,7 @@
22

33
from abc import ABC
44

5-
from ..utils import (
6-
CategoricalTypes,
7-
DefaultRoleTypes,
8-
RoleNameType,
9-
TargetRoleTypes,
10-
)
5+
from ..utils import CategoricalTypes, DefaultRoleTypes, RoleNameType, TargetRoleTypes
116

127

138
class ABCRole(ABC):

hypex/experiments/__init__.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
1-
from .base import (
2-
Experiment,
3-
OnRoleExperiment,
4-
)
1+
from .base import Experiment, OnRoleExperiment
52
from .base_complex import CycledExperiment, GroupExperiment
63

74
__all__ = ["CycledExperiment", "Experiment", "GroupExperiment", "OnRoleExperiment"]

hypex/experiments/base.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,7 @@
33
from copy import deepcopy
44
from typing import Any, Iterable, Sequence
55

6-
from ..dataset import (
7-
ABCRole,
8-
ExperimentData,
9-
TempTargetRole,
10-
)
6+
from ..dataset import ABCRole, ExperimentData, TempTargetRole
117
from ..executor import Executor
128
from ..utils import ExperimentDataEnum
139

0 commit comments

Comments
 (0)