upgini 1.2.62a3818.dev1__tar.gz → 1.2.62a3818.dev3__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of upgini might be problematic. Click here for more details.
- {upgini-1.2.62a3818.dev1 → upgini-1.2.62a3818.dev3}/PKG-INFO +1 -1
- upgini-1.2.62a3818.dev3/src/upgini/__about__.py +1 -0
- {upgini-1.2.62a3818.dev1 → upgini-1.2.62a3818.dev3}/src/upgini/autofe/binary.py +11 -11
- {upgini-1.2.62a3818.dev1 → upgini-1.2.62a3818.dev3}/src/upgini/autofe/date.py +6 -6
- {upgini-1.2.62a3818.dev1 → upgini-1.2.62a3818.dev3}/src/upgini/autofe/feature.py +6 -6
- {upgini-1.2.62a3818.dev1 → upgini-1.2.62a3818.dev3}/src/upgini/autofe/groupby.py +6 -6
- {upgini-1.2.62a3818.dev1 → upgini-1.2.62a3818.dev3}/src/upgini/autofe/operator.py +8 -8
- {upgini-1.2.62a3818.dev1 → upgini-1.2.62a3818.dev3}/src/upgini/autofe/timeseries.py +4 -4
- {upgini-1.2.62a3818.dev1 → upgini-1.2.62a3818.dev3}/src/upgini/autofe/unary.py +11 -11
- {upgini-1.2.62a3818.dev1 → upgini-1.2.62a3818.dev3}/src/upgini/autofe/vector.py +3 -3
- upgini-1.2.62a3818.dev1/src/upgini/__about__.py +0 -1
- {upgini-1.2.62a3818.dev1 → upgini-1.2.62a3818.dev3}/.gitignore +0 -0
- {upgini-1.2.62a3818.dev1 → upgini-1.2.62a3818.dev3}/LICENSE +0 -0
- {upgini-1.2.62a3818.dev1 → upgini-1.2.62a3818.dev3}/README.md +0 -0
- {upgini-1.2.62a3818.dev1 → upgini-1.2.62a3818.dev3}/pyproject.toml +0 -0
- {upgini-1.2.62a3818.dev1 → upgini-1.2.62a3818.dev3}/src/upgini/__init__.py +0 -0
- {upgini-1.2.62a3818.dev1 → upgini-1.2.62a3818.dev3}/src/upgini/ads.py +0 -0
- {upgini-1.2.62a3818.dev1 → upgini-1.2.62a3818.dev3}/src/upgini/ads_management/__init__.py +0 -0
- {upgini-1.2.62a3818.dev1 → upgini-1.2.62a3818.dev3}/src/upgini/ads_management/ads_manager.py +0 -0
- {upgini-1.2.62a3818.dev1 → upgini-1.2.62a3818.dev3}/src/upgini/autofe/__init__.py +0 -0
- {upgini-1.2.62a3818.dev1 → upgini-1.2.62a3818.dev3}/src/upgini/autofe/all_operands.py +0 -0
- {upgini-1.2.62a3818.dev1 → upgini-1.2.62a3818.dev3}/src/upgini/data_source/__init__.py +0 -0
- {upgini-1.2.62a3818.dev1 → upgini-1.2.62a3818.dev3}/src/upgini/data_source/data_source_publisher.py +0 -0
- {upgini-1.2.62a3818.dev1 → upgini-1.2.62a3818.dev3}/src/upgini/dataset.py +0 -0
- {upgini-1.2.62a3818.dev1 → upgini-1.2.62a3818.dev3}/src/upgini/errors.py +0 -0
- {upgini-1.2.62a3818.dev1 → upgini-1.2.62a3818.dev3}/src/upgini/features_enricher.py +0 -0
- {upgini-1.2.62a3818.dev1 → upgini-1.2.62a3818.dev3}/src/upgini/http.py +0 -0
- {upgini-1.2.62a3818.dev1 → upgini-1.2.62a3818.dev3}/src/upgini/lazy_import.py +0 -0
- {upgini-1.2.62a3818.dev1 → upgini-1.2.62a3818.dev3}/src/upgini/mdc/__init__.py +0 -0
- {upgini-1.2.62a3818.dev1 → upgini-1.2.62a3818.dev3}/src/upgini/mdc/context.py +0 -0
- {upgini-1.2.62a3818.dev1 → upgini-1.2.62a3818.dev3}/src/upgini/metadata.py +0 -0
- {upgini-1.2.62a3818.dev1 → upgini-1.2.62a3818.dev3}/src/upgini/metrics.py +0 -0
- {upgini-1.2.62a3818.dev1 → upgini-1.2.62a3818.dev3}/src/upgini/normalizer/__init__.py +0 -0
- {upgini-1.2.62a3818.dev1 → upgini-1.2.62a3818.dev3}/src/upgini/normalizer/normalize_utils.py +0 -0
- {upgini-1.2.62a3818.dev1 → upgini-1.2.62a3818.dev3}/src/upgini/resource_bundle/__init__.py +0 -0
- {upgini-1.2.62a3818.dev1 → upgini-1.2.62a3818.dev3}/src/upgini/resource_bundle/exceptions.py +0 -0
- {upgini-1.2.62a3818.dev1 → upgini-1.2.62a3818.dev3}/src/upgini/resource_bundle/strings.properties +0 -0
- {upgini-1.2.62a3818.dev1 → upgini-1.2.62a3818.dev3}/src/upgini/resource_bundle/strings_widget.properties +0 -0
- {upgini-1.2.62a3818.dev1 → upgini-1.2.62a3818.dev3}/src/upgini/sampler/__init__.py +0 -0
- {upgini-1.2.62a3818.dev1 → upgini-1.2.62a3818.dev3}/src/upgini/sampler/base.py +0 -0
- {upgini-1.2.62a3818.dev1 → upgini-1.2.62a3818.dev3}/src/upgini/sampler/random_under_sampler.py +0 -0
- {upgini-1.2.62a3818.dev1 → upgini-1.2.62a3818.dev3}/src/upgini/sampler/utils.py +0 -0
- {upgini-1.2.62a3818.dev1 → upgini-1.2.62a3818.dev3}/src/upgini/search_task.py +0 -0
- {upgini-1.2.62a3818.dev1 → upgini-1.2.62a3818.dev3}/src/upgini/spinner.py +0 -0
- {upgini-1.2.62a3818.dev1 → upgini-1.2.62a3818.dev3}/src/upgini/utils/Roboto-Regular.ttf +0 -0
- {upgini-1.2.62a3818.dev1 → upgini-1.2.62a3818.dev3}/src/upgini/utils/__init__.py +0 -0
- {upgini-1.2.62a3818.dev1 → upgini-1.2.62a3818.dev3}/src/upgini/utils/base_search_key_detector.py +0 -0
- {upgini-1.2.62a3818.dev1 → upgini-1.2.62a3818.dev3}/src/upgini/utils/blocked_time_series.py +0 -0
- {upgini-1.2.62a3818.dev1 → upgini-1.2.62a3818.dev3}/src/upgini/utils/country_utils.py +0 -0
- {upgini-1.2.62a3818.dev1 → upgini-1.2.62a3818.dev3}/src/upgini/utils/custom_loss_utils.py +0 -0
- {upgini-1.2.62a3818.dev1 → upgini-1.2.62a3818.dev3}/src/upgini/utils/cv_utils.py +0 -0
- {upgini-1.2.62a3818.dev1 → upgini-1.2.62a3818.dev3}/src/upgini/utils/datetime_utils.py +0 -0
- {upgini-1.2.62a3818.dev1 → upgini-1.2.62a3818.dev3}/src/upgini/utils/deduplicate_utils.py +0 -0
- {upgini-1.2.62a3818.dev1 → upgini-1.2.62a3818.dev3}/src/upgini/utils/display_utils.py +0 -0
- {upgini-1.2.62a3818.dev1 → upgini-1.2.62a3818.dev3}/src/upgini/utils/email_utils.py +0 -0
- {upgini-1.2.62a3818.dev1 → upgini-1.2.62a3818.dev3}/src/upgini/utils/fallback_progress_bar.py +0 -0
- {upgini-1.2.62a3818.dev1 → upgini-1.2.62a3818.dev3}/src/upgini/utils/feature_info.py +0 -0
- {upgini-1.2.62a3818.dev1 → upgini-1.2.62a3818.dev3}/src/upgini/utils/features_validator.py +0 -0
- {upgini-1.2.62a3818.dev1 → upgini-1.2.62a3818.dev3}/src/upgini/utils/format.py +0 -0
- {upgini-1.2.62a3818.dev1 → upgini-1.2.62a3818.dev3}/src/upgini/utils/ip_utils.py +0 -0
- {upgini-1.2.62a3818.dev1 → upgini-1.2.62a3818.dev3}/src/upgini/utils/mstats.py +0 -0
- {upgini-1.2.62a3818.dev1 → upgini-1.2.62a3818.dev3}/src/upgini/utils/phone_utils.py +0 -0
- {upgini-1.2.62a3818.dev1 → upgini-1.2.62a3818.dev3}/src/upgini/utils/postal_code_utils.py +0 -0
- {upgini-1.2.62a3818.dev1 → upgini-1.2.62a3818.dev3}/src/upgini/utils/progress_bar.py +0 -0
- {upgini-1.2.62a3818.dev1 → upgini-1.2.62a3818.dev3}/src/upgini/utils/sklearn_ext.py +0 -0
- {upgini-1.2.62a3818.dev1 → upgini-1.2.62a3818.dev3}/src/upgini/utils/sort.py +0 -0
- {upgini-1.2.62a3818.dev1 → upgini-1.2.62a3818.dev3}/src/upgini/utils/target_utils.py +0 -0
- {upgini-1.2.62a3818.dev1 → upgini-1.2.62a3818.dev3}/src/upgini/utils/track_info.py +0 -0
- {upgini-1.2.62a3818.dev1 → upgini-1.2.62a3818.dev3}/src/upgini/utils/ts_utils.py +0 -0
- {upgini-1.2.62a3818.dev1 → upgini-1.2.62a3818.dev3}/src/upgini/utils/warning_counter.py +0 -0
- {upgini-1.2.62a3818.dev1 → upgini-1.2.62a3818.dev3}/src/upgini/version_validator.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.3
|
|
2
2
|
Name: upgini
|
|
3
|
-
Version: 1.2.62a3818.
|
|
3
|
+
Version: 1.2.62a3818.dev3
|
|
4
4
|
Summary: Intelligent data search & enrichment for Machine Learning
|
|
5
5
|
Project-URL: Bug Reports, https://github.com/upgini/upgini/issues
|
|
6
6
|
Project-URL: Homepage, https://upgini.com/
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = "1.2.62a3818.dev3"
|
|
@@ -5,10 +5,10 @@ import numpy as np
|
|
|
5
5
|
import pandas as pd
|
|
6
6
|
from jarowinkler import jarowinkler_similarity
|
|
7
7
|
|
|
8
|
-
from upgini.autofe.operator import
|
|
8
|
+
from upgini.autofe.operator import PandasOperator, VectorizableMixin
|
|
9
9
|
|
|
10
10
|
|
|
11
|
-
class Min(
|
|
11
|
+
class Min(PandasOperator):
|
|
12
12
|
name: str = "min"
|
|
13
13
|
is_binary: bool = True
|
|
14
14
|
is_symmetrical: bool = True
|
|
@@ -18,7 +18,7 @@ class Min(PandasOperand):
|
|
|
18
18
|
return np.minimum(left, right)
|
|
19
19
|
|
|
20
20
|
|
|
21
|
-
class Max(
|
|
21
|
+
class Max(PandasOperator):
|
|
22
22
|
name: str = "max"
|
|
23
23
|
is_binary: bool = True
|
|
24
24
|
is_symmetrical: bool = True
|
|
@@ -28,7 +28,7 @@ class Max(PandasOperand):
|
|
|
28
28
|
return np.maximum(left, right)
|
|
29
29
|
|
|
30
30
|
|
|
31
|
-
class Add(
|
|
31
|
+
class Add(PandasOperator, VectorizableMixin):
|
|
32
32
|
name: str = "+"
|
|
33
33
|
alias: str = "add"
|
|
34
34
|
is_binary: bool = True
|
|
@@ -47,7 +47,7 @@ class Add(PandasOperand, VectorizableMixin):
|
|
|
47
47
|
return d1.add(d2, axis=0)
|
|
48
48
|
|
|
49
49
|
|
|
50
|
-
class Subtract(
|
|
50
|
+
class Subtract(PandasOperator, VectorizableMixin):
|
|
51
51
|
name: str = "-"
|
|
52
52
|
alias: str = "sub"
|
|
53
53
|
is_binary: bool = True
|
|
@@ -66,7 +66,7 @@ class Subtract(PandasOperand, VectorizableMixin):
|
|
|
66
66
|
return d1.sub(d2, axis=0)
|
|
67
67
|
|
|
68
68
|
|
|
69
|
-
class Multiply(
|
|
69
|
+
class Multiply(PandasOperator, VectorizableMixin):
|
|
70
70
|
name: str = "*"
|
|
71
71
|
alias: str = "mul"
|
|
72
72
|
is_binary: bool = True
|
|
@@ -85,7 +85,7 @@ class Multiply(PandasOperand, VectorizableMixin):
|
|
|
85
85
|
return d1.mul(d2, axis=0)
|
|
86
86
|
|
|
87
87
|
|
|
88
|
-
class Divide(
|
|
88
|
+
class Divide(PandasOperator, VectorizableMixin):
|
|
89
89
|
name: str = "/"
|
|
90
90
|
alias: str = "div"
|
|
91
91
|
is_binary: bool = True
|
|
@@ -104,7 +104,7 @@ class Divide(PandasOperand, VectorizableMixin):
|
|
|
104
104
|
return d1.div(d2.replace(0, np.nan), axis=0)
|
|
105
105
|
|
|
106
106
|
|
|
107
|
-
class Combine(
|
|
107
|
+
class Combine(PandasOperator):
|
|
108
108
|
name: str = "Combine"
|
|
109
109
|
is_binary: bool = True
|
|
110
110
|
has_symmetry_importance: bool = True
|
|
@@ -116,7 +116,7 @@ class Combine(PandasOperand):
|
|
|
116
116
|
return pd.Series(temp, index=left.index)
|
|
117
117
|
|
|
118
118
|
|
|
119
|
-
class CombineThenFreq(
|
|
119
|
+
class CombineThenFreq(PandasOperator):
|
|
120
120
|
name: str = "CombineThenFreq"
|
|
121
121
|
is_binary: bool = True
|
|
122
122
|
is_symmetrical: bool = True
|
|
@@ -132,7 +132,7 @@ class CombineThenFreq(PandasOperand):
|
|
|
132
132
|
self._loc(temp, value_counts)
|
|
133
133
|
|
|
134
134
|
|
|
135
|
-
class Distance(
|
|
135
|
+
class Distance(PandasOperator):
|
|
136
136
|
name: str = "dist"
|
|
137
137
|
is_binary: bool = True
|
|
138
138
|
output_type: Optional[str] = "float"
|
|
@@ -170,7 +170,7 @@ class Sim(Distance):
|
|
|
170
170
|
return 1 - super().calculate_binary(left, right)
|
|
171
171
|
|
|
172
172
|
|
|
173
|
-
class StringSim(
|
|
173
|
+
class StringSim(PandasOperator, abc.ABC):
|
|
174
174
|
def calculate_binary(self, left: pd.Series, right: pd.Series) -> pd.Series:
|
|
175
175
|
sims = []
|
|
176
176
|
for i in left.index:
|
|
@@ -7,7 +7,7 @@ import pandas as pd
|
|
|
7
7
|
from pandas.core.arrays.timedeltas import TimedeltaArray
|
|
8
8
|
from pydantic import BaseModel, __version__ as pydantic_version
|
|
9
9
|
|
|
10
|
-
from upgini.autofe.operator import
|
|
10
|
+
from upgini.autofe.operator import PandasOperator, ParametrizedOperator
|
|
11
11
|
|
|
12
12
|
|
|
13
13
|
def get_pydantic_version():
|
|
@@ -43,7 +43,7 @@ class DateDiffMixin(BaseModel):
|
|
|
43
43
|
raise Exception(f"Unsupported difference unit: {self.diff_unit}")
|
|
44
44
|
|
|
45
45
|
|
|
46
|
-
class DateDiff(
|
|
46
|
+
class DateDiff(PandasOperator, DateDiffMixin):
|
|
47
47
|
name: str = "date_diff"
|
|
48
48
|
alias: Optional[str] = "date_diff_type1"
|
|
49
49
|
is_binary: bool = True
|
|
@@ -78,7 +78,7 @@ class DateDiff(PandasOperand, DateDiffMixin):
|
|
|
78
78
|
return x
|
|
79
79
|
|
|
80
80
|
|
|
81
|
-
class DateDiffType2(
|
|
81
|
+
class DateDiffType2(PandasOperator, DateDiffMixin):
|
|
82
82
|
name: str = "date_diff_type2"
|
|
83
83
|
is_binary: bool = True
|
|
84
84
|
has_symmetry_importance: bool = True
|
|
@@ -112,7 +112,7 @@ _ext_aggregations = {"nunique": (lambda x: len(np.unique(x)), 0), "count": (len,
|
|
|
112
112
|
_count_aggregations = ["nunique", "count"]
|
|
113
113
|
|
|
114
114
|
|
|
115
|
-
class DateListDiff(
|
|
115
|
+
class DateListDiff(PandasOperator, DateDiffMixin, ParametrizedOperator):
|
|
116
116
|
is_binary: bool = True
|
|
117
117
|
has_symmetry_importance: bool = True
|
|
118
118
|
|
|
@@ -183,7 +183,7 @@ class DateListDiff(PandasOperand, DateDiffMixin, ParametrizedOperand):
|
|
|
183
183
|
return method(x) if len(x) > 0 else default
|
|
184
184
|
|
|
185
185
|
|
|
186
|
-
class DateListDiffBounded(DateListDiff,
|
|
186
|
+
class DateListDiffBounded(DateListDiff, ParametrizedOperator):
|
|
187
187
|
lower_bound: Optional[int] = None
|
|
188
188
|
upper_bound: Optional[int] = None
|
|
189
189
|
|
|
@@ -217,7 +217,7 @@ class DateListDiffBounded(DateListDiff, ParametrizedOperand):
|
|
|
217
217
|
return super()._agg(x)
|
|
218
218
|
|
|
219
219
|
|
|
220
|
-
class DatePercentileBase(
|
|
220
|
+
class DatePercentileBase(PandasOperator, abc.ABC):
|
|
221
221
|
is_binary: bool = True
|
|
222
222
|
output_type: Optional[str] = "float"
|
|
223
223
|
|
|
@@ -7,7 +7,7 @@ import pandas as pd
|
|
|
7
7
|
from pandas._typing import DtypeObj
|
|
8
8
|
|
|
9
9
|
from upgini.autofe.all_operands import find_op
|
|
10
|
-
from upgini.autofe.operator import
|
|
10
|
+
from upgini.autofe.operator import Operator, PandasOperator
|
|
11
11
|
|
|
12
12
|
|
|
13
13
|
class Column:
|
|
@@ -65,7 +65,7 @@ class Column:
|
|
|
65
65
|
class Feature:
|
|
66
66
|
def __init__(
|
|
67
67
|
self,
|
|
68
|
-
op:
|
|
68
|
+
op: Operator,
|
|
69
69
|
children: List[Union[Column, "Feature"]],
|
|
70
70
|
data: Optional[pd.DataFrame] = None,
|
|
71
71
|
display_index: Optional[str] = None,
|
|
@@ -188,7 +188,7 @@ class Feature:
|
|
|
188
188
|
return self.children[0].infer_type(data)
|
|
189
189
|
|
|
190
190
|
def calculate(self, data: pd.DataFrame, is_root=False) -> Union[pd.Series, pd.DataFrame]:
|
|
191
|
-
if isinstance(self.op,
|
|
191
|
+
if isinstance(self.op, PandasOperator):
|
|
192
192
|
if self.op.is_vector:
|
|
193
193
|
ds = [child.calculate(data) for child in self.children]
|
|
194
194
|
new_data = self.op.calculate(data=ds)
|
|
@@ -324,7 +324,7 @@ class Feature:
|
|
|
324
324
|
|
|
325
325
|
class FeatureGroup:
|
|
326
326
|
def __init__(
|
|
327
|
-
self, op:
|
|
327
|
+
self, op: Operator, main_column: Optional[Union[Column, Feature]], children: List[Union[Column, Feature]]
|
|
328
328
|
):
|
|
329
329
|
self.op = op
|
|
330
330
|
self.main_column_node = main_column
|
|
@@ -345,7 +345,7 @@ class FeatureGroup:
|
|
|
345
345
|
return names
|
|
346
346
|
|
|
347
347
|
def calculate(self, data: pd.DataFrame, is_root=False) -> pd.DataFrame:
|
|
348
|
-
if isinstance(self.op,
|
|
348
|
+
if isinstance(self.op, PandasOperator):
|
|
349
349
|
main_column = None if self.main_column_node is None else self.main_column_node.get_display_name()
|
|
350
350
|
lower_order_children = []
|
|
351
351
|
if self.main_column_node is not None:
|
|
@@ -378,7 +378,7 @@ class FeatureGroup:
|
|
|
378
378
|
def make_groups(candidates: List[Feature]) -> List[Union[Feature, "FeatureGroup"]]:
|
|
379
379
|
grouped_features = []
|
|
380
380
|
|
|
381
|
-
def groupby_func(f: Feature) -> Tuple[
|
|
381
|
+
def groupby_func(f: Feature) -> Tuple[Operator, Union[Column, Feature]]:
|
|
382
382
|
return (f.op, f.children[0 if not f.op.is_vectorizable else f.op.group_index])
|
|
383
383
|
|
|
384
384
|
for op_child, features in itertools.groupby(candidates, groupby_func):
|
|
@@ -2,13 +2,13 @@ from typing import Optional
|
|
|
2
2
|
|
|
3
3
|
import pandas as pd
|
|
4
4
|
|
|
5
|
-
from upgini.autofe.operator import
|
|
5
|
+
from upgini.autofe.operator import PandasOperator, ParametrizedOperator, VectorizableMixin
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
class GroupByThenAgg(
|
|
9
|
-
|
|
9
|
+
PandasOperator,
|
|
10
10
|
VectorizableMixin,
|
|
11
|
-
|
|
11
|
+
ParametrizedOperator,
|
|
12
12
|
):
|
|
13
13
|
agg: Optional[str]
|
|
14
14
|
is_vectorizable: bool = True
|
|
@@ -39,7 +39,7 @@ class GroupByThenAgg(
|
|
|
39
39
|
return temp.merge(d2, how="right", on=[group_column])[value_columns]
|
|
40
40
|
|
|
41
41
|
|
|
42
|
-
class GroupByThenRank(
|
|
42
|
+
class GroupByThenRank(PandasOperator, VectorizableMixin):
|
|
43
43
|
name: str = "GroupByThenRank"
|
|
44
44
|
is_vectorizable: bool = True
|
|
45
45
|
is_grouping: bool = True
|
|
@@ -58,7 +58,7 @@ class GroupByThenRank(PandasOperand, VectorizableMixin):
|
|
|
58
58
|
return temp.merge(d2.reset_index(), how="right", on=["index"])[value_columns]
|
|
59
59
|
|
|
60
60
|
|
|
61
|
-
class GroupByThenNUnique(
|
|
61
|
+
class GroupByThenNUnique(PandasOperator, VectorizableMixin):
|
|
62
62
|
name: str = "GroupByThenNUnique"
|
|
63
63
|
is_vectorizable: bool = True
|
|
64
64
|
is_grouping: bool = True
|
|
@@ -78,7 +78,7 @@ class GroupByThenNUnique(PandasOperand, VectorizableMixin):
|
|
|
78
78
|
return nunique.merge(d2, how="right", on=[group_column])[value_columns]
|
|
79
79
|
|
|
80
80
|
|
|
81
|
-
class GroupByThenFreq(
|
|
81
|
+
class GroupByThenFreq(PandasOperator):
|
|
82
82
|
name: str = "GroupByThenFreq"
|
|
83
83
|
is_grouping: bool = True
|
|
84
84
|
output_type: Optional[str] = "float"
|
|
@@ -20,9 +20,9 @@ class OperatorRegistry(type(BaseModel)):
|
|
|
20
20
|
base_names.update(b.__name__ for b in base.__bases__)
|
|
21
21
|
base_classes.extend(base.__bases__)
|
|
22
22
|
|
|
23
|
-
if "
|
|
23
|
+
if "Operator" in base_names:
|
|
24
24
|
# Track parametrized operands separately
|
|
25
|
-
if "
|
|
25
|
+
if "ParametrizedOperator" in base_names:
|
|
26
26
|
cls._parametrized_registry.append(new_class)
|
|
27
27
|
else:
|
|
28
28
|
try:
|
|
@@ -33,7 +33,7 @@ class OperatorRegistry(type(BaseModel)):
|
|
|
33
33
|
return new_class
|
|
34
34
|
|
|
35
35
|
@classmethod
|
|
36
|
-
def get_operand(cls, name: str) -> Optional["
|
|
36
|
+
def get_operand(cls, name: str) -> Optional["Operator"]:
|
|
37
37
|
# First try to resolve as a parametrized operand formula
|
|
38
38
|
for operand_cls in cls._parametrized_registry:
|
|
39
39
|
resolved = operand_cls.from_formula(name)
|
|
@@ -46,7 +46,7 @@ class OperatorRegistry(type(BaseModel)):
|
|
|
46
46
|
return None
|
|
47
47
|
|
|
48
48
|
|
|
49
|
-
class
|
|
49
|
+
class Operator(BaseModel, metaclass=OperatorRegistry):
|
|
50
50
|
name: Optional[str] = None
|
|
51
51
|
alias: Optional[str] = None
|
|
52
52
|
is_unary: bool = False
|
|
@@ -75,7 +75,7 @@ class Operand(BaseModel, metaclass=OperatorRegistry):
|
|
|
75
75
|
return self.name
|
|
76
76
|
|
|
77
77
|
|
|
78
|
-
class
|
|
78
|
+
class ParametrizedOperator(Operator, abc.ABC):
|
|
79
79
|
|
|
80
80
|
@abc.abstractmethod
|
|
81
81
|
def to_formula(self) -> str:
|
|
@@ -83,14 +83,14 @@ class ParametrizedOperand(Operand, abc.ABC):
|
|
|
83
83
|
|
|
84
84
|
@classmethod
|
|
85
85
|
@abc.abstractmethod
|
|
86
|
-
def from_formula(cls, formula: str) -> Optional["
|
|
86
|
+
def from_formula(cls, formula: str) -> Optional["Operator"]:
|
|
87
87
|
pass
|
|
88
88
|
|
|
89
89
|
|
|
90
90
|
MAIN_COLUMN = "main_column"
|
|
91
91
|
|
|
92
92
|
|
|
93
|
-
class
|
|
93
|
+
class PandasOperator(Operator, abc.ABC):
|
|
94
94
|
def calculate(self, **kwargs) -> pd.Series:
|
|
95
95
|
if self.is_unary:
|
|
96
96
|
return self.calculate_unary(kwargs["data"])
|
|
@@ -131,7 +131,7 @@ class PandasOperand(Operand, abc.ABC):
|
|
|
131
131
|
return value
|
|
132
132
|
|
|
133
133
|
|
|
134
|
-
class VectorizableMixin(
|
|
134
|
+
class VectorizableMixin(Operator):
|
|
135
135
|
group_index: int = 1
|
|
136
136
|
|
|
137
137
|
def validate_calculation(self, input_columns: List[str], **kwargs) -> Tuple[str, List[str]]:
|
|
@@ -2,7 +2,7 @@ import abc
|
|
|
2
2
|
from typing import Dict, List, Optional
|
|
3
3
|
|
|
4
4
|
import pandas as pd
|
|
5
|
-
from upgini.autofe.operator import
|
|
5
|
+
from upgini.autofe.operator import PandasOperator, ParametrizedOperator
|
|
6
6
|
|
|
7
7
|
try:
|
|
8
8
|
from pydantic import field_validator as validator # V2
|
|
@@ -10,7 +10,7 @@ except ImportError:
|
|
|
10
10
|
from pydantic import validator # V1
|
|
11
11
|
|
|
12
12
|
|
|
13
|
-
class TimeSeriesBase(
|
|
13
|
+
class TimeSeriesBase(PandasOperator, abc.ABC):
|
|
14
14
|
is_vector: bool = True
|
|
15
15
|
date_unit: Optional[str] = None
|
|
16
16
|
offset_size: int = 0
|
|
@@ -67,7 +67,7 @@ class TimeSeriesBase(PandasOperand, abc.ABC):
|
|
|
67
67
|
_roll_aggregations = {"norm_mean": lambda x: x[-1] / x.mean(), "last": lambda x: x[-1]}
|
|
68
68
|
|
|
69
69
|
|
|
70
|
-
class Roll(TimeSeriesBase,
|
|
70
|
+
class Roll(TimeSeriesBase, ParametrizedOperator):
|
|
71
71
|
aggregation: str
|
|
72
72
|
window_size: int = 1
|
|
73
73
|
window_unit: str = "D"
|
|
@@ -142,7 +142,7 @@ class Roll(TimeSeriesBase, ParametrizedOperand):
|
|
|
142
142
|
)
|
|
143
143
|
|
|
144
144
|
|
|
145
|
-
class Lag(TimeSeriesBase,
|
|
145
|
+
class Lag(TimeSeriesBase, ParametrizedOperator):
|
|
146
146
|
lag_size: int
|
|
147
147
|
lag_unit: str = "D"
|
|
148
148
|
|
|
@@ -2,10 +2,10 @@ from typing import Dict, Optional
|
|
|
2
2
|
import numpy as np
|
|
3
3
|
import pandas as pd
|
|
4
4
|
|
|
5
|
-
from upgini.autofe.operator import
|
|
5
|
+
from upgini.autofe.operator import PandasOperator, VectorizableMixin
|
|
6
6
|
|
|
7
7
|
|
|
8
|
-
class Abs(
|
|
8
|
+
class Abs(PandasOperator, VectorizableMixin):
|
|
9
9
|
name: str = "abs"
|
|
10
10
|
is_unary: bool = True
|
|
11
11
|
is_vectorizable: bool = True
|
|
@@ -20,7 +20,7 @@ class Abs(PandasOperand, VectorizableMixin):
|
|
|
20
20
|
# return data.abs()
|
|
21
21
|
|
|
22
22
|
|
|
23
|
-
class Log(
|
|
23
|
+
class Log(PandasOperator, VectorizableMixin):
|
|
24
24
|
name: str = "log"
|
|
25
25
|
is_unary: bool = True
|
|
26
26
|
is_vectorizable: bool = True
|
|
@@ -34,7 +34,7 @@ class Log(PandasOperand, VectorizableMixin):
|
|
|
34
34
|
return self._round_value(np.log(data.replace(0, np.nan).abs()), 10)
|
|
35
35
|
|
|
36
36
|
|
|
37
|
-
class Sqrt(
|
|
37
|
+
class Sqrt(PandasOperator, VectorizableMixin):
|
|
38
38
|
name: str = "sqrt"
|
|
39
39
|
is_unary: bool = True
|
|
40
40
|
is_vectorizable: bool = True
|
|
@@ -48,7 +48,7 @@ class Sqrt(PandasOperand, VectorizableMixin):
|
|
|
48
48
|
return self._round_value(np.sqrt(data.abs()))
|
|
49
49
|
|
|
50
50
|
|
|
51
|
-
class Square(
|
|
51
|
+
class Square(PandasOperator, VectorizableMixin):
|
|
52
52
|
name: str = "square"
|
|
53
53
|
is_unary: bool = True
|
|
54
54
|
is_vectorizable: bool = True
|
|
@@ -61,7 +61,7 @@ class Square(PandasOperand, VectorizableMixin):
|
|
|
61
61
|
return np.square(data)
|
|
62
62
|
|
|
63
63
|
|
|
64
|
-
class Sigmoid(
|
|
64
|
+
class Sigmoid(PandasOperator, VectorizableMixin):
|
|
65
65
|
name: str = "sigmoid"
|
|
66
66
|
is_unary: bool = True
|
|
67
67
|
is_vectorizable: bool = True
|
|
@@ -75,7 +75,7 @@ class Sigmoid(PandasOperand, VectorizableMixin):
|
|
|
75
75
|
return self._round_value(1 / (1 + np.exp(-data)))
|
|
76
76
|
|
|
77
77
|
|
|
78
|
-
class Floor(
|
|
78
|
+
class Floor(PandasOperator, VectorizableMixin):
|
|
79
79
|
name: str = "floor"
|
|
80
80
|
is_unary: bool = True
|
|
81
81
|
is_vectorizable: bool = True
|
|
@@ -90,7 +90,7 @@ class Floor(PandasOperand, VectorizableMixin):
|
|
|
90
90
|
return np.floor(data)
|
|
91
91
|
|
|
92
92
|
|
|
93
|
-
class Residual(
|
|
93
|
+
class Residual(PandasOperator, VectorizableMixin):
|
|
94
94
|
name: str = "residual"
|
|
95
95
|
is_unary: bool = True
|
|
96
96
|
is_vectorizable: bool = True
|
|
@@ -104,7 +104,7 @@ class Residual(PandasOperand, VectorizableMixin):
|
|
|
104
104
|
return data - np.floor(data)
|
|
105
105
|
|
|
106
106
|
|
|
107
|
-
class Freq(
|
|
107
|
+
class Freq(PandasOperator):
|
|
108
108
|
name: str = "freq"
|
|
109
109
|
is_unary: bool = True
|
|
110
110
|
output_type: Optional[str] = "float"
|
|
@@ -116,7 +116,7 @@ class Freq(PandasOperand):
|
|
|
116
116
|
return self._loc(data, value_counts)
|
|
117
117
|
|
|
118
118
|
|
|
119
|
-
class Norm(
|
|
119
|
+
class Norm(PandasOperator):
|
|
120
120
|
name: str = "norm"
|
|
121
121
|
is_unary: bool = True
|
|
122
122
|
output_type: Optional[str] = "float"
|
|
@@ -148,7 +148,7 @@ class Norm(PandasOperand):
|
|
|
148
148
|
return res
|
|
149
149
|
|
|
150
150
|
|
|
151
|
-
class Embeddings(
|
|
151
|
+
class Embeddings(PandasOperator):
|
|
152
152
|
name: str = "emb"
|
|
153
153
|
is_unary: bool = True
|
|
154
154
|
input_type: Optional[str] = "string"
|
|
@@ -2,10 +2,10 @@ from typing import List, Optional
|
|
|
2
2
|
|
|
3
3
|
import pandas as pd
|
|
4
4
|
|
|
5
|
-
from upgini.autofe.operator import
|
|
5
|
+
from upgini.autofe.operator import PandasOperator, VectorizableMixin
|
|
6
6
|
|
|
7
7
|
|
|
8
|
-
class Mean(
|
|
8
|
+
class Mean(PandasOperator, VectorizableMixin):
|
|
9
9
|
name: str = "mean"
|
|
10
10
|
output_type: Optional[str] = "float"
|
|
11
11
|
is_vector: bool = True
|
|
@@ -15,7 +15,7 @@ class Mean(PandasOperand, VectorizableMixin):
|
|
|
15
15
|
return pd.DataFrame(data).T.fillna(0).mean(axis=1)
|
|
16
16
|
|
|
17
17
|
|
|
18
|
-
class Sum(
|
|
18
|
+
class Sum(PandasOperator, VectorizableMixin):
|
|
19
19
|
name: str = "sum"
|
|
20
20
|
is_vector: bool = True
|
|
21
21
|
group_index: int = 0
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
__version__ = "1.2.62a3818.dev1"
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{upgini-1.2.62a3818.dev1 → upgini-1.2.62a3818.dev3}/src/upgini/ads_management/ads_manager.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{upgini-1.2.62a3818.dev1 → upgini-1.2.62a3818.dev3}/src/upgini/data_source/data_source_publisher.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{upgini-1.2.62a3818.dev1 → upgini-1.2.62a3818.dev3}/src/upgini/normalizer/normalize_utils.py
RENAMED
|
File without changes
|
|
File without changes
|
{upgini-1.2.62a3818.dev1 → upgini-1.2.62a3818.dev3}/src/upgini/resource_bundle/exceptions.py
RENAMED
|
File without changes
|
{upgini-1.2.62a3818.dev1 → upgini-1.2.62a3818.dev3}/src/upgini/resource_bundle/strings.properties
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{upgini-1.2.62a3818.dev1 → upgini-1.2.62a3818.dev3}/src/upgini/sampler/random_under_sampler.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{upgini-1.2.62a3818.dev1 → upgini-1.2.62a3818.dev3}/src/upgini/utils/base_search_key_detector.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{upgini-1.2.62a3818.dev1 → upgini-1.2.62a3818.dev3}/src/upgini/utils/fallback_progress_bar.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|