kamae 2.33.0__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.
- kamae-2.33.0/LICENSE.txt +202 -0
- kamae-2.33.0/PKG-INFO +247 -0
- kamae-2.33.0/README.md +227 -0
- kamae-2.33.0/pyproject.toml +82 -0
- kamae-2.33.0/setup.cfg +4 -0
- kamae-2.33.0/src/kamae/__init__.py +23 -0
- kamae-2.33.0/src/kamae/graph/__init__.py +15 -0
- kamae-2.33.0/src/kamae/graph/pipeline_graph.py +460 -0
- kamae-2.33.0/src/kamae/sklearn/__init__.py +13 -0
- kamae-2.33.0/src/kamae/sklearn/estimators/__init__.py +15 -0
- kamae-2.33.0/src/kamae/sklearn/estimators/standard_scale.py +102 -0
- kamae-2.33.0/src/kamae/sklearn/params/__init__.py +22 -0
- kamae-2.33.0/src/kamae/sklearn/params/base.py +202 -0
- kamae-2.33.0/src/kamae/sklearn/params/name.py +32 -0
- kamae-2.33.0/src/kamae/sklearn/params/utils.py +46 -0
- kamae-2.33.0/src/kamae/sklearn/pipeline/__init__.py +15 -0
- kamae-2.33.0/src/kamae/sklearn/pipeline/pipeline.py +97 -0
- kamae-2.33.0/src/kamae/sklearn/transformers/__init__.py +19 -0
- kamae-2.33.0/src/kamae/sklearn/transformers/array_concatenate.py +102 -0
- kamae-2.33.0/src/kamae/sklearn/transformers/array_split.py +72 -0
- kamae-2.33.0/src/kamae/sklearn/transformers/base.py +90 -0
- kamae-2.33.0/src/kamae/sklearn/transformers/identity.py +78 -0
- kamae-2.33.0/src/kamae/sklearn/transformers/log.py +87 -0
- kamae-2.33.0/src/kamae/spark/__init__.py +13 -0
- kamae-2.33.0/src/kamae/spark/common/__init__.py +15 -0
- kamae-2.33.0/src/kamae/spark/common/spark_operation.py +367 -0
- kamae-2.33.0/src/kamae/spark/estimators/__init__.py +25 -0
- kamae-2.33.0/src/kamae/spark/estimators/base.py +107 -0
- kamae-2.33.0/src/kamae/spark/estimators/conditional_standard_scale.py +592 -0
- kamae-2.33.0/src/kamae/spark/estimators/impute.py +154 -0
- kamae-2.33.0/src/kamae/spark/estimators/one_hot_encode.py +149 -0
- kamae-2.33.0/src/kamae/spark/estimators/shared_one_hot_encode.py +147 -0
- kamae-2.33.0/src/kamae/spark/estimators/shared_string_index.py +135 -0
- kamae-2.33.0/src/kamae/spark/estimators/single_feature_array_standard_scale.py +144 -0
- kamae-2.33.0/src/kamae/spark/estimators/standard_scale.py +147 -0
- kamae-2.33.0/src/kamae/spark/estimators/string_index.py +132 -0
- kamae-2.33.0/src/kamae/spark/params/__init__.py +47 -0
- kamae-2.33.0/src/kamae/spark/params/base.py +286 -0
- kamae-2.33.0/src/kamae/spark/params/name.py +40 -0
- kamae-2.33.0/src/kamae/spark/params/shared.py +992 -0
- kamae-2.33.0/src/kamae/spark/params/utils.py +122 -0
- kamae-2.33.0/src/kamae/spark/pipeline/__init__.py +31 -0
- kamae-2.33.0/src/kamae/spark/pipeline/pipeline.py +239 -0
- kamae-2.33.0/src/kamae/spark/pipeline/pipeline_model.py +172 -0
- kamae-2.33.0/src/kamae/spark/transformers/__init__.py +87 -0
- kamae-2.33.0/src/kamae/spark/transformers/absolute_value.py +123 -0
- kamae-2.33.0/src/kamae/spark/transformers/array_concatenate.py +291 -0
- kamae-2.33.0/src/kamae/spark/transformers/array_crop.py +215 -0
- kamae-2.33.0/src/kamae/spark/transformers/array_split.py +115 -0
- kamae-2.33.0/src/kamae/spark/transformers/array_subtract_minimum.py +195 -0
- kamae-2.33.0/src/kamae/spark/transformers/base.py +115 -0
- kamae-2.33.0/src/kamae/spark/transformers/bearing_angle.py +232 -0
- kamae-2.33.0/src/kamae/spark/transformers/bin.py +323 -0
- kamae-2.33.0/src/kamae/spark/transformers/bloom_encode.py +273 -0
- kamae-2.33.0/src/kamae/spark/transformers/bucketize.py +175 -0
- kamae-2.33.0/src/kamae/spark/transformers/conditional_standard_scale.py +169 -0
- kamae-2.33.0/src/kamae/spark/transformers/cosine_similarity.py +157 -0
- kamae-2.33.0/src/kamae/spark/transformers/current_date.py +126 -0
- kamae-2.33.0/src/kamae/spark/transformers/current_date_time.py +136 -0
- kamae-2.33.0/src/kamae/spark/transformers/current_unix_timestamp.py +143 -0
- kamae-2.33.0/src/kamae/spark/transformers/date_add.py +226 -0
- kamae-2.33.0/src/kamae/spark/transformers/date_diff.py +147 -0
- kamae-2.33.0/src/kamae/spark/transformers/date_parse.py +236 -0
- kamae-2.33.0/src/kamae/spark/transformers/date_time_to_unix_timestamp.py +145 -0
- kamae-2.33.0/src/kamae/spark/transformers/divide.py +142 -0
- kamae-2.33.0/src/kamae/spark/transformers/exp.py +108 -0
- kamae-2.33.0/src/kamae/spark/transformers/exponent.py +186 -0
- kamae-2.33.0/src/kamae/spark/transformers/hash_index.py +130 -0
- kamae-2.33.0/src/kamae/spark/transformers/haversine_distance.py +272 -0
- kamae-2.33.0/src/kamae/spark/transformers/identity.py +103 -0
- kamae-2.33.0/src/kamae/spark/transformers/if_statement.py +404 -0
- kamae-2.33.0/src/kamae/spark/transformers/impute.py +181 -0
- kamae-2.33.0/src/kamae/spark/transformers/lambda_function.py +440 -0
- kamae-2.33.0/src/kamae/spark/transformers/list_max.py +187 -0
- kamae-2.33.0/src/kamae/spark/transformers/list_mean.py +175 -0
- kamae-2.33.0/src/kamae/spark/transformers/list_median.py +195 -0
- kamae-2.33.0/src/kamae/spark/transformers/list_min.py +187 -0
- kamae-2.33.0/src/kamae/spark/transformers/list_std_dev.py +175 -0
- kamae-2.33.0/src/kamae/spark/transformers/log.py +147 -0
- kamae-2.33.0/src/kamae/spark/transformers/logical_and.py +126 -0
- kamae-2.33.0/src/kamae/spark/transformers/logical_not.py +108 -0
- kamae-2.33.0/src/kamae/spark/transformers/logical_or.py +126 -0
- kamae-2.33.0/src/kamae/spark/transformers/max.py +148 -0
- kamae-2.33.0/src/kamae/spark/transformers/mean.py +151 -0
- kamae-2.33.0/src/kamae/spark/transformers/min.py +148 -0
- kamae-2.33.0/src/kamae/spark/transformers/modulo.py +202 -0
- kamae-2.33.0/src/kamae/spark/transformers/multiply.py +148 -0
- kamae-2.33.0/src/kamae/spark/transformers/numerical_if_statement.py +379 -0
- kamae-2.33.0/src/kamae/spark/transformers/one_hot_encode.py +176 -0
- kamae-2.33.0/src/kamae/spark/transformers/ordinal_array_encode.py +144 -0
- kamae-2.33.0/src/kamae/spark/transformers/round.py +156 -0
- kamae-2.33.0/src/kamae/spark/transformers/round_to_decimal.py +147 -0
- kamae-2.33.0/src/kamae/spark/transformers/shared_one_hot_encode.py +181 -0
- kamae-2.33.0/src/kamae/spark/transformers/shared_string_index.py +160 -0
- kamae-2.33.0/src/kamae/spark/transformers/standard_scale.py +147 -0
- kamae-2.33.0/src/kamae/spark/transformers/string_affix.py +194 -0
- kamae-2.33.0/src/kamae/spark/transformers/string_array_constant.py +112 -0
- kamae-2.33.0/src/kamae/spark/transformers/string_case.py +173 -0
- kamae-2.33.0/src/kamae/spark/transformers/string_concatenate.py +155 -0
- kamae-2.33.0/src/kamae/spark/transformers/string_contains.py +165 -0
- kamae-2.33.0/src/kamae/spark/transformers/string_contains_list.py +144 -0
- kamae-2.33.0/src/kamae/spark/transformers/string_equals_if_statement.py +328 -0
- kamae-2.33.0/src/kamae/spark/transformers/string_index.py +151 -0
- kamae-2.33.0/src/kamae/spark/transformers/string_isin_list.py +141 -0
- kamae-2.33.0/src/kamae/spark/transformers/string_list_to_string.py +155 -0
- kamae-2.33.0/src/kamae/spark/transformers/string_map.py +241 -0
- kamae-2.33.0/src/kamae/spark/transformers/string_replace.py +280 -0
- kamae-2.33.0/src/kamae/spark/transformers/string_to_string_list.py +226 -0
- kamae-2.33.0/src/kamae/spark/transformers/sub_string_delim_at_index.py +221 -0
- kamae-2.33.0/src/kamae/spark/transformers/subtract.py +148 -0
- kamae-2.33.0/src/kamae/spark/transformers/sum.py +148 -0
- kamae-2.33.0/src/kamae/spark/transformers/unix_timestamp_to_date_time.py +168 -0
- kamae-2.33.0/src/kamae/spark/utils/__init__.py +52 -0
- kamae-2.33.0/src/kamae/spark/utils/array_utils.py +237 -0
- kamae-2.33.0/src/kamae/spark/utils/indexer_utils.py +172 -0
- kamae-2.33.0/src/kamae/spark/utils/list_utils.py +97 -0
- kamae-2.33.0/src/kamae/spark/utils/scaler_utils.py +77 -0
- kamae-2.33.0/src/kamae/spark/utils/transform_utils.py +409 -0
- kamae-2.33.0/src/kamae/spark/utils/user_defined_functions.py +163 -0
- kamae-2.33.0/src/kamae/tensorflow/__init__.py +13 -0
- kamae-2.33.0/src/kamae/tensorflow/layers/__init__.py +78 -0
- kamae-2.33.0/src/kamae/tensorflow/layers/absolute_value.py +90 -0
- kamae-2.33.0/src/kamae/tensorflow/layers/array_concatenate.py +138 -0
- kamae-2.33.0/src/kamae/tensorflow/layers/array_crop.py +112 -0
- kamae-2.33.0/src/kamae/tensorflow/layers/array_split.py +91 -0
- kamae-2.33.0/src/kamae/tensorflow/layers/array_subtract_minimum.py +147 -0
- kamae-2.33.0/src/kamae/tensorflow/layers/base.py +408 -0
- kamae-2.33.0/src/kamae/tensorflow/layers/bearing_angle.py +178 -0
- kamae-2.33.0/src/kamae/tensorflow/layers/bin.py +167 -0
- kamae-2.33.0/src/kamae/tensorflow/layers/bloom_encode.py +180 -0
- kamae-2.33.0/src/kamae/tensorflow/layers/bucketize.py +98 -0
- kamae-2.33.0/src/kamae/tensorflow/layers/conditional_standard_scale.py +142 -0
- kamae-2.33.0/src/kamae/tensorflow/layers/cosine_similarity.py +108 -0
- kamae-2.33.0/src/kamae/tensorflow/layers/current_date.py +84 -0
- kamae-2.33.0/src/kamae/tensorflow/layers/current_date_time.py +91 -0
- kamae-2.33.0/src/kamae/tensorflow/layers/current_unix_timestamp.py +114 -0
- kamae-2.33.0/src/kamae/tensorflow/layers/date_add.py +127 -0
- kamae-2.33.0/src/kamae/tensorflow/layers/date_diff.py +120 -0
- kamae-2.33.0/src/kamae/tensorflow/layers/date_parse.py +186 -0
- kamae-2.33.0/src/kamae/tensorflow/layers/date_time_to_unix_timestamp.py +111 -0
- kamae-2.33.0/src/kamae/tensorflow/layers/divide.py +109 -0
- kamae-2.33.0/src/kamae/tensorflow/layers/exp.py +88 -0
- kamae-2.33.0/src/kamae/tensorflow/layers/exponent.py +103 -0
- kamae-2.33.0/src/kamae/tensorflow/layers/hash_index.py +104 -0
- kamae-2.33.0/src/kamae/tensorflow/layers/haversine_distance.py +170 -0
- kamae-2.33.0/src/kamae/tensorflow/layers/identity.py +81 -0
- kamae-2.33.0/src/kamae/tensorflow/layers/if_statement.py +279 -0
- kamae-2.33.0/src/kamae/tensorflow/layers/impute.py +119 -0
- kamae-2.33.0/src/kamae/tensorflow/layers/lambda_function.py +100 -0
- kamae-2.33.0/src/kamae/tensorflow/layers/list_max.py +172 -0
- kamae-2.33.0/src/kamae/tensorflow/layers/list_mean.py +193 -0
- kamae-2.33.0/src/kamae/tensorflow/layers/list_median.py +227 -0
- kamae-2.33.0/src/kamae/tensorflow/layers/list_min.py +173 -0
- kamae-2.33.0/src/kamae/tensorflow/layers/list_std_dev.py +211 -0
- kamae-2.33.0/src/kamae/tensorflow/layers/log.py +95 -0
- kamae-2.33.0/src/kamae/tensorflow/layers/logical_and.py +84 -0
- kamae-2.33.0/src/kamae/tensorflow/layers/logical_not.py +81 -0
- kamae-2.33.0/src/kamae/tensorflow/layers/logical_or.py +84 -0
- kamae-2.33.0/src/kamae/tensorflow/layers/max.py +121 -0
- kamae-2.33.0/src/kamae/tensorflow/layers/mean.py +124 -0
- kamae-2.33.0/src/kamae/tensorflow/layers/min.py +122 -0
- kamae-2.33.0/src/kamae/tensorflow/layers/modulo.py +118 -0
- kamae-2.33.0/src/kamae/tensorflow/layers/multiply.py +119 -0
- kamae-2.33.0/src/kamae/tensorflow/layers/numerical_if_statement.py +209 -0
- kamae-2.33.0/src/kamae/tensorflow/layers/one_hot_encode.py +154 -0
- kamae-2.33.0/src/kamae/tensorflow/layers/ordinal_array_encode.py +138 -0
- kamae-2.33.0/src/kamae/tensorflow/layers/round.py +101 -0
- kamae-2.33.0/src/kamae/tensorflow/layers/round_to_decimal.py +103 -0
- kamae-2.33.0/src/kamae/tensorflow/layers/standard_scale.py +124 -0
- kamae-2.33.0/src/kamae/tensorflow/layers/string_affix.py +107 -0
- kamae-2.33.0/src/kamae/tensorflow/layers/string_array_constant.py +92 -0
- kamae-2.33.0/src/kamae/tensorflow/layers/string_case.py +96 -0
- kamae-2.33.0/src/kamae/tensorflow/layers/string_concatenate.py +87 -0
- kamae-2.33.0/src/kamae/tensorflow/layers/string_contains.py +204 -0
- kamae-2.33.0/src/kamae/tensorflow/layers/string_contains_list.py +147 -0
- kamae-2.33.0/src/kamae/tensorflow/layers/string_equals_if_statement.py +198 -0
- kamae-2.33.0/src/kamae/tensorflow/layers/string_index.py +124 -0
- kamae-2.33.0/src/kamae/tensorflow/layers/string_isin_list.py +106 -0
- kamae-2.33.0/src/kamae/tensorflow/layers/string_list_to_string.py +108 -0
- kamae-2.33.0/src/kamae/tensorflow/layers/string_map.py +132 -0
- kamae-2.33.0/src/kamae/tensorflow/layers/string_replace.py +243 -0
- kamae-2.33.0/src/kamae/tensorflow/layers/string_to_string_list.py +134 -0
- kamae-2.33.0/src/kamae/tensorflow/layers/sub_string_delim_at_index.py +186 -0
- kamae-2.33.0/src/kamae/tensorflow/layers/subtract.py +115 -0
- kamae-2.33.0/src/kamae/tensorflow/layers/sum.py +118 -0
- kamae-2.33.0/src/kamae/tensorflow/layers/unix_timestamp_to_date_time.py +123 -0
- kamae-2.33.0/src/kamae/tensorflow/typing/__init__.py +15 -0
- kamae-2.33.0/src/kamae/tensorflow/typing/types.py +20 -0
- kamae-2.33.0/src/kamae/tensorflow/utils/__init__.py +42 -0
- kamae-2.33.0/src/kamae/tensorflow/utils/date_utils.py +580 -0
- kamae-2.33.0/src/kamae/tensorflow/utils/input_utils.py +140 -0
- kamae-2.33.0/src/kamae/tensorflow/utils/layer_utils.py +165 -0
- kamae-2.33.0/src/kamae/tensorflow/utils/list_utils.py +79 -0
- kamae-2.33.0/src/kamae/tensorflow/utils/shape_utils.py +44 -0
- kamae-2.33.0/src/kamae/tensorflow/utils/transform_utils.py +81 -0
- kamae-2.33.0/src/kamae/utils/__init__.py +16 -0
- kamae-2.33.0/src/kamae/utils/dtype_enum.py +81 -0
- kamae-2.33.0/src/kamae/utils/utils.py +39 -0
- kamae-2.33.0/src/kamae.egg-info/PKG-INFO +247 -0
- kamae-2.33.0/src/kamae.egg-info/SOURCES.txt +201 -0
- kamae-2.33.0/src/kamae.egg-info/dependency_links.txt +1 -0
- kamae-2.33.0/src/kamae.egg-info/requires.txt +10 -0
- kamae-2.33.0/src/kamae.egg-info/top_level.txt +1 -0
kamae-2.33.0/LICENSE.txt
ADDED
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
|
|
2
|
+
Apache License
|
|
3
|
+
Version 2.0, January 2004
|
|
4
|
+
http://www.apache.org/licenses/
|
|
5
|
+
|
|
6
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
7
|
+
|
|
8
|
+
1. Definitions.
|
|
9
|
+
|
|
10
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
11
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
12
|
+
|
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
14
|
+
the copyright owner that is granting the License.
|
|
15
|
+
|
|
16
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
17
|
+
other entities that control, are controlled by, or are under common
|
|
18
|
+
control with that entity. For the purposes of this definition,
|
|
19
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
20
|
+
direction or management of such entity, whether by contract or
|
|
21
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
22
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
23
|
+
|
|
24
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
25
|
+
exercising permissions granted by this License.
|
|
26
|
+
|
|
27
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
28
|
+
including but not limited to software source code, documentation
|
|
29
|
+
source, and configuration files.
|
|
30
|
+
|
|
31
|
+
"Object" form shall mean any form resulting from mechanical
|
|
32
|
+
transformation or translation of a Source form, including but
|
|
33
|
+
not limited to compiled object code, generated documentation,
|
|
34
|
+
and conversions to other media types.
|
|
35
|
+
|
|
36
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
37
|
+
Object form, made available under the License, as indicated by a
|
|
38
|
+
copyright notice that is included in or attached to the work
|
|
39
|
+
(an example is provided in the Appendix below).
|
|
40
|
+
|
|
41
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
42
|
+
form, that is based on (or derived from) the Work and for which the
|
|
43
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
47
|
+
the Work and Derivative Works thereof.
|
|
48
|
+
|
|
49
|
+
"Contribution" shall mean any work of authorship, including
|
|
50
|
+
the original version of the Work and any modifications or additions
|
|
51
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
52
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
53
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
54
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
55
|
+
means any form of electronic, verbal, or written communication sent
|
|
56
|
+
to the Licensor or its representatives, including but not limited to
|
|
57
|
+
communication on electronic mailing lists, source code control systems,
|
|
58
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
59
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
60
|
+
excluding communication that is conspicuously marked or otherwise
|
|
61
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
62
|
+
|
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
64
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
65
|
+
subsequently incorporated within the Work.
|
|
66
|
+
|
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
|
73
|
+
|
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
79
|
+
where such license applies only to those patent claims licensable
|
|
80
|
+
by such Contributor that are necessarily infringed by their
|
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
83
|
+
institute patent litigation against any entity (including a
|
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
86
|
+
or contributory patent infringement, then any patent licenses
|
|
87
|
+
granted to You under this License for that Work shall terminate
|
|
88
|
+
as of the date such litigation is filed.
|
|
89
|
+
|
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
92
|
+
modifications, and in Source or Object form, provided that You
|
|
93
|
+
meet the following conditions:
|
|
94
|
+
|
|
95
|
+
(a) You must give any other recipients of the Work or
|
|
96
|
+
Derivative Works a copy of this License; and
|
|
97
|
+
|
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
|
99
|
+
stating that You changed the files; and
|
|
100
|
+
|
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
|
103
|
+
attribution notices from the Source form of the Work,
|
|
104
|
+
excluding those notices that do not pertain to any part of
|
|
105
|
+
the Derivative Works; and
|
|
106
|
+
|
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
|
109
|
+
include a readable copy of the attribution notices contained
|
|
110
|
+
within such NOTICE file, excluding those notices that do not
|
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
|
112
|
+
of the following places: within a NOTICE text file distributed
|
|
113
|
+
as part of the Derivative Works; within the Source form or
|
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
|
115
|
+
within a display generated by the Derivative Works, if and
|
|
116
|
+
wherever such third-party notices normally appear. The contents
|
|
117
|
+
of the NOTICE file are for informational purposes only and
|
|
118
|
+
do not modify the License. You may add Your own attribution
|
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
121
|
+
that such additional attribution notices cannot be construed
|
|
122
|
+
as modifying the License.
|
|
123
|
+
|
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
|
125
|
+
may provide additional or different license terms and conditions
|
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
129
|
+
the conditions stated in this License.
|
|
130
|
+
|
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
134
|
+
this License, without any additional terms or conditions.
|
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
136
|
+
the terms of any separate license agreement you may have executed
|
|
137
|
+
with Licensor regarding such Contributions.
|
|
138
|
+
|
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
141
|
+
except as required for reasonable and customary use in describing the
|
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
143
|
+
|
|
144
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
|
153
|
+
|
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
|
159
|
+
incidental, or consequential damages of any character arising as a
|
|
160
|
+
result of this License or out of the use or inability to use the
|
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
163
|
+
other commercial damages or losses), even if such Contributor
|
|
164
|
+
has been advised of the possibility of such damages.
|
|
165
|
+
|
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
169
|
+
or other liability obligations and/or rights consistent with this
|
|
170
|
+
License. However, in accepting such obligations, You may act only
|
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
175
|
+
of your accepting any such warranty or additional liability.
|
|
176
|
+
|
|
177
|
+
END OF TERMS AND CONDITIONS
|
|
178
|
+
|
|
179
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
180
|
+
|
|
181
|
+
To apply the Apache License to your work, attach the following
|
|
182
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
183
|
+
replaced with your own identifying information. (Don't include
|
|
184
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
185
|
+
comment syntax for the file format. We also recommend that a
|
|
186
|
+
file or class name and description of purpose be included on the
|
|
187
|
+
same "printed page" as the copyright notice for easier
|
|
188
|
+
identification within third-party archives.
|
|
189
|
+
|
|
190
|
+
Copyright [yyyy] [name of copyright owner]
|
|
191
|
+
|
|
192
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
193
|
+
you may not use this file except in compliance with the License.
|
|
194
|
+
You may obtain a copy of the License at
|
|
195
|
+
|
|
196
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
197
|
+
|
|
198
|
+
Unless required by applicable law or agreed to in writing, software
|
|
199
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
200
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
201
|
+
See the License for the specific language governing permissions and
|
|
202
|
+
limitations under the License.
|
kamae-2.33.0/PKG-INFO
ADDED
|
@@ -0,0 +1,247 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: kamae
|
|
3
|
+
Version: 2.33.0
|
|
4
|
+
Summary: Feature engineering for big data and quick inference.
|
|
5
|
+
Author-email: Expedia Group <oss@expediagroup.com>
|
|
6
|
+
Requires-Python: <3.13,>=3.8.1
|
|
7
|
+
Description-Content-Type: text/markdown
|
|
8
|
+
License-File: LICENSE.txt
|
|
9
|
+
Requires-Dist: pyspark<4.0.0,>=3.4.0
|
|
10
|
+
Requires-Dist: pandas<2.0.0,>=1.3.4
|
|
11
|
+
Requires-Dist: networkx<3.0.0,>=2.6.3
|
|
12
|
+
Requires-Dist: pyfarmhash<0.4.0,>=0.3.2
|
|
13
|
+
Requires-Dist: keras-tuner<2.0.0,>=1.0.4
|
|
14
|
+
Requires-Dist: scikit-learn<2.0.0,>=1.0.0
|
|
15
|
+
Requires-Dist: joblib<2.0.0,>=1.0.0
|
|
16
|
+
Requires-Dist: numpy<2.0.0,>=1.22.0
|
|
17
|
+
Requires-Dist: tensorflow<2.19.0,>=2.9.1
|
|
18
|
+
Requires-Dist: dill<1.0.0,>=0.3.0
|
|
19
|
+
Dynamic: license-file
|
|
20
|
+
|
|
21
|
+
# Kamae
|
|
22
|
+
[](https://github.com/ExpediaGroup/kamae/actions/workflows/ci.yaml)
|
|
23
|
+
|
|
24
|
+
Kamae is a Python package comprising a set of reusable components
|
|
25
|
+
for preprocessing inputs offline (Spark) and online (TensorFlow).
|
|
26
|
+
|
|
27
|
+
Build all your big-data preprocessing pipelines in [Spark](https://spark.apache.org/), and get your [Keras](https://keras.io/) preprocessing model for free!
|
|
28
|
+
|
|
29
|
+
## Usage
|
|
30
|
+
The library is designed with three main usage patterns in mind:
|
|
31
|
+
|
|
32
|
+
1. **Import and use Keras preprocessing layers directly.**
|
|
33
|
+
|
|
34
|
+
This is the recommended usage pattern for complex use-cases.
|
|
35
|
+
For example when your data is not tabular, or when you need to apply preprocessing steps that are not supported by the provided Spark Pipeline interface.
|
|
36
|
+
The library provides a set of Keras subclassed layers that can be imported and used directly in a Keras model.
|
|
37
|
+
You can chain these layers together to create complex preprocessing steps, and then use the resulting model as the input to a trainable model.
|
|
38
|
+
|
|
39
|
+
2. **Use the provided Spark Pipeline interface to build Keras preprocessing models.**
|
|
40
|
+
|
|
41
|
+
This is the recommended usage pattern for big data use-cases, (classification, regression, ranking) where your data is tabular,
|
|
42
|
+
and you want to apply standard preprocessing steps such as normalization, one-hot encoding, etc.
|
|
43
|
+
The library provides Spark transformers, estimators and pipelining so that a user can chain
|
|
44
|
+
together preprocessing steps in Spark, fit the pipeline on a Spark DataFrame, and then export the result as a Keras model.
|
|
45
|
+
Unit tests ensure parity between the Spark and Keras implementations of the preprocessing layers.
|
|
46
|
+
|
|
47
|
+
3. **Use the provided Sklearn Pipeline interface to build Keras preprocessing models.**
|
|
48
|
+
|
|
49
|
+
_**Note: This is provided as an example of how Kamae could be extended to support other pipeline SDKs but it is NOT actively supported. It is far behind the Spark interface in terms of transformer coverage & enhancements we have made such as [type](docs/achieving_type_parity.md) & [shape](docs/achieving_shape_parity.md) parity. Contributions are welcome, but please use at your own risk.**_
|
|
50
|
+
|
|
51
|
+
Works in the same way as the Spark pipeline interface, just using Scikit-learn transformers, estimators and pipelines.
|
|
52
|
+
This is the recommended usage pattern for small data use-cases, (classification, regression, ranking) where your data is tabular,
|
|
53
|
+
and you want to apply standard preprocessing steps such as normalization, one-hot encoding, etc.
|
|
54
|
+
|
|
55
|
+
[Keras Tuner](https://keras.io/keras_tuner/) support is also provided for the Spark & Scikit-learn Pipeline interface, whereby a
|
|
56
|
+
model builder function is returned so that the hyperparameters of the preprocessing steps can be tuned using the Keras Tuner API.
|
|
57
|
+
|
|
58
|
+
Once you have created a Kamae preprocessing model, you can use it as the input to a trainable model. See [these](docs/chaining_models.md) docs for more information.
|
|
59
|
+
|
|
60
|
+
For advice on achieving type parity between the Spark and Keras implementations of the preprocessing layers, see [these](docs/achieving_type_parity.md) docs.
|
|
61
|
+
|
|
62
|
+
For information on achieving shape parity between the Spark and Keras implementations of the preprocessing layers, see [these](docs/achieving_shape_parity.md) docs.
|
|
63
|
+
|
|
64
|
+
## Pipeline Examples
|
|
65
|
+
See the [examples](examples/spark) directory for various examples of how to use the Spark Pipeline interface.
|
|
66
|
+
Similarly, see the [examples](examples/sklearn) directory for various examples of how to use the Scikit-learn Pipeline interface.
|
|
67
|
+
Follow the development instructions below to run the examples locally.
|
|
68
|
+
|
|
69
|
+
## Supported Preprocessing Layers
|
|
70
|
+
|
|
71
|
+
| Transformation | Description | Keras Layer | Spark Transformer | Scikit-learn Transformer |
|
|
72
|
+
|:-------------------------------:|:-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------:|:------------------------------------------------------------------:|:-------------------------------------------------------------------------:|:-----------------------------------------------------------:|
|
|
73
|
+
| AbsoluteValue | Applies the `abs(x)` transform. | [Link](src/kamae/tensorflow/layers/absolute_value.py) | [Link](src/kamae/spark/transformers/absolute_value.py) | Not yet implemented |
|
|
74
|
+
| ArrayConcatenate | Assembles multiple features into a single array. | [Link](src/kamae/tensorflow/layers/array_concatenate.py) | [Link](src/kamae/spark/transformers/array_concatenate.py) | [Link](src/kamae/sklearn/transformers/array_concatenate.py) |
|
|
75
|
+
| ArrayCrop | Crops or pads a feature array to a consistent size. | [Link](src/kamae/tensorflow/layers/array_crop.py) | [Link](src/kamae/spark/transformers/array_crop.py) | Not yet implemented |
|
|
76
|
+
| ArraySplit | Splits a feature array into multiple features. | [Link](src/kamae/tensorflow/layers/array_split.py) | [Link](src/kamae/spark/transformers/array_split.py) | [Link](src/kamae/sklearn/transformers/array_split.py) |
|
|
77
|
+
| ArraySubtractMinimum | Subtracts the minimum element in an array from therest to compute a timestamp difference. Ignores padded values. | [Link](src/kamae/tensorflow/layers/array_subtract_minimum.py) | [Link](src/kamae/spark/transformers/array_subtract_minimum.py) | Not yet implemented |
|
|
78
|
+
| BearingAngle | Compute the bearing angle (https://en.wikipedia.org/wiki/Bearing_(navigation)) between two pairs of lat/long. | [Link](src/kamae/tensorflow/layers/bearing_angle.py) | [Link](src/kamae/spark/transformers/bearing_angle.py) | Not yet implemented |
|
|
79
|
+
| Bin | Bins a numerical column into string categorical bins. Users can specify the bin values, labels and a default label. | [Link](src/kamae/tensorflow/layers/bin.py) | [Link](src/kamae/spark/transformers/bin.py) | Not yet implemented |
|
|
80
|
+
| BloomEncode | Hash encodes a string feature multiple times to create an array of indices. Useful for compressing input dimensions for embeddings. Paper: https://arxiv.org/pdf/1706.03993.pdf | [Link](src/kamae/tensorflow/layers/bloom_encode.py) | [Link](src/kamae/spark/transformers/bloom_encode.py) | Not yet implemented |
|
|
81
|
+
| Bucketize | Buckets a numerical column into integer bins. | [Link](src/kamae/tensorflow/layers/bucketize.py) | [Link](src/kamae/spark/transformers/bucketize.py) | Not yet implemented |
|
|
82
|
+
| ConditionalStandardScale | Normalises by the mean and standard deviation, with ability to: apply a mask on another column, not scale the zeros, and apply a non standard scaling function. | [Link](src/kamae/tensorflow/layers/conditional_standard_scale.py) | [Link](src/kamae/spark/estimators/conditional_standard_scale.py) | Not yet implemented |
|
|
83
|
+
| CosineSimilarity | Computes the cosine similarity between two array features. | [Link](src/kamae/tensorflow/layers/cosine_similarity.py) | [Link](src/kamae/spark/transformers/cosine_similarity.py) | Not yet implemented |
|
|
84
|
+
| CurrentDate | Returns the current date for use in other transformers. | [Link](src/kamae/tensorflow/layers/current_date.py) | [Link](src/kamae/spark/transformers/current_date.py) | Not yet implemented |
|
|
85
|
+
| CurrentDateTime | Returns the current date time in the format yyyy-MM-dd HH:mm:ss.SSS for use in other transformers. | [Link](src/kamae/tensorflow/layers/current_date_time.py) | [Link](src/kamae/spark/transformers/current_date_time.py) | Not yet implemented |
|
|
86
|
+
| CurrentUnixTimestamp | Returns the current unix timestamp in either seconds or milliseconds for use in other transformers. | [Link](src/kamae/tensorflow/layers/current_unix_timestamp.py) | [Link](src/kamae/spark/transformers/current_unix_timestamp.py) | Not yet implemented |
|
|
87
|
+
| DateAdd | Adds a static or dynamic number of days to a date feature. NOTE: Destroys any time component of the datetime if present. | [Link](src/kamae/tensorflow/layers/date_add.py) | [Link](src/kamae/spark/transformers/date_add.py) | Not yet implemented |
|
|
88
|
+
| DateDiff | Computes the number of days between two date features. | [Link](src/kamae/tensorflow/layers/date_diff.py) | [Link](src/kamae/spark/transformers/date_diff.py) | Not yet implemented |
|
|
89
|
+
| DateParse | Parses a string date of format YYYY-MM-DD to extract a given date part. E.g. day of year. | [Link](src/kamae/tensorflow/layers/date_parse.py) | [Link](src/kamae/spark/transformers/date_parse.py) | Not yet implemented |
|
|
90
|
+
| DateTimeToUnixTimestamp | Converts a UTC datetime string to unix timestamp. | [Link](src/kamae/tensorflow/layers/date_time_to_unix_timestamp.py) | [Link](src/kamae/spark/transformers/date_time_to_unix_timestamp.py) | Not yet implemented |
|
|
91
|
+
| Divide | Divides a single feature by a constant or divides multiple features against each other. | [Link](src/kamae/tensorflow/layers/divide.py) | [Link](src/kamae/spark/transformers/divide.py) | Not yet implemented |
|
|
92
|
+
| Exp | Applies the exp(x) operation to the feature. | [Link](src/kamae/tensorflow/layers/exp.py) | [Link](src/kamae/spark/transformers/exp.py) | Not yet implemented |
|
|
93
|
+
| Exponent | Applies the x^exponent to a single feature or x^y for multiple features. | [Link](src/kamae/tensorflow/layers/exponent.py) | [Link](src/kamae/spark/transformers/exponent.py) | Not yet implemented |
|
|
94
|
+
| HashIndex | Transforms strings to indices via a hash table of predeterminded size. | [Link](src/kamae/tensorflow/layers/hash_index.py) | [Link](src/kamae/spark/transformers/hash_index.py) | Not yet implemented |
|
|
95
|
+
| HaversineDistance | Computes the [haversine distance](https://en.wikipedia.org/wiki/Haversine_formula) between latitude and longitude pairs. | [Link](src/kamae/tensorflow/layers/haversine_distance.py) | [Link](src/kamae/spark/transformers/haversine_distance.py) | Not yet implemented |
|
|
96
|
+
| Identity | Applies the identity operation, leaving the input the same. | [Link](src/kamae/tensorflow/layers/identity.py) | [Link](src/kamae/spark/transformers/identity.py) | [Link](src/kamae/sklearn/transformers/identity.py) |
|
|
97
|
+
| IfStatement | Computes a simple if statement on a set of columns/tensors and/or constants. | [Link](src/kamae/tensorflow/layers/if_statement.py) | [Link](src/kamae/spark/transformers/if_statement.py) | Not yet implemented |
|
|
98
|
+
| Impute | Performs imputation of either mean or median value of the data over a specified mask. | [Link](src/kamae/tensorflow/layers/impute.py) | [Link](src/kamae/spark/transformers/impute.py) | Not yet implemented |
|
|
99
|
+
| LambdaFunction | Transforms an input (or multiple inputs) to an output (or multiple outputs) with a user provided tensorflow function. | [Link](src/kamae/tensorflow/layers/lambda_function.py) | [Link](src/kamae/spark/transformers/lambda_function.py) | Not yet implemented |
|
|
100
|
+
| ListMax | Computes the listwise max of a feature, optionally calculated only on the top items based on another given feature. | [Link](src/kamae/tensorflow/layers/list_max.py) | [Link](src/kamae/spark/transformers/list_max.py) | Not yet implemented |
|
|
101
|
+
| ListMean | Computes the listwise mean of a feature, optionally calculated only on the top items based on another given feature. | [Link](src/kamae/tensorflow/layers/list_mean.py) | [Link](src/kamae/spark/transformers/list_mean.py) | Not yet implemented |
|
|
102
|
+
| ListMedian | Computes the listwise median of a feature, optionally calculated only on the top items based on another given feature. | [Link](src/kamae/tensorflow/layers/list_median.py) | [Link](src/kamae/spark/transformers/list_median.py) | Not yet implemented |
|
|
103
|
+
| ListMin | Computes the listwise min of a feature, optionally calculated only on the top items based on another given feature. | [Link](src/kamae/tensorflow/layers/list_min.py) | [Link](src/kamae/spark/transformers/list_min.py) | Not yet implemented |
|
|
104
|
+
| ListStdDev | Computes the listwise standard deviation of a feature, optionally calculated only on the top items based on another given feature. | [Link](src/kamae/tensorflow/layers/list_std_dev.py) | [Link](src/kamae/spark/transformers/list_std_dev.py) | Not yet implemented |
|
|
105
|
+
| Log | Applies the natural logarithm `log(alpha + x)` transform . | [Link](src/kamae/tensorflow/layers/log.py) | [Link](src/kamae/spark/transformers/log.py) | [Link](src/kamae/sklearn/transformers/log.py) |
|
|
106
|
+
| LogicalAnd | Performs an and(x, y) operation on multiple boolean features. | [Link](src/kamae/tensorflow/layers/logical_and.py) | [Link](src/kamae/spark/transformers/logical_and.py) | Not yet implemented |
|
|
107
|
+
| LogicalNot | Performs a not(x) operation on a single boolean feature. | [Link](src/kamae/tensorflow/layers/logical_not.py) | [Link](src/kamae/spark/transformers/logical_not.py) | Not yet implemented |
|
|
108
|
+
| LogicalOr | Performs an or(x, y) operation on multiple boolean features. | [Link](src/kamae/tensorflow/layers/logical_or.py) | [Link](src/kamae/spark/transformers/logical_or.py) | Not yet implemented |
|
|
109
|
+
| Max | Computes the maximum of a feature with a constant or multiple other features. | [Link](src/kamae/tensorflow/layers/max.py) | [Link](src/kamae/spark/transformers/max.py) | Not yet implemented |
|
|
110
|
+
| Mean | Computes the mean of a feature with a constant or multiple other features. | [Link](src/kamae/tensorflow/layers/mean.py) | [Link](src/kamae/spark/transformers/mean.py) | Not yet implemented |
|
|
111
|
+
| Min | Computes the minimum of a feature with a constant or multiple other features. | [Link](src/kamae/tensorflow/layers/min.py) | [Link](src/kamae/spark/transformers/min.py) | Not yet implemented |
|
|
112
|
+
| Modulo | Computes the modulo of a feature with the mod divisor being a constant or another feature. | [Link](src/kamae/tensorflow/layers/modulo.py) | [Link](src/kamae/spark/transformers/modulo.py) | Not yet implemented |
|
|
113
|
+
| Multiply | Multiplies a single feature by a constant or multiples multiple features together. | [Link](src/kamae/tensorflow/layers/multiply.py) | [Link](src/kamae/spark/transformers/multiply.py) | Not yet implemented |
|
|
114
|
+
| NumericalIfStatement | Performs a simple if else statement witha given operator. Value to check, result if true or false can be constants or features. | [Link](src/kamae/tensorflow/layers/numerical_if_statement.py) | [Link](src/kamae/spark/transformers/numerical_if_statement.py) | Not yet implemented |
|
|
115
|
+
| OneHotEncode | Transforms a string to a one-hot array. | [Link](src/kamae/tensorflow/layers/one_hot_encode.py) | [Link](src/kamae/spark/estimators/one_hot_encode.py) | Not yet implemented |
|
|
116
|
+
| OrdinalArrayEncode | Encodes strings in an array according to the order in which they appear. Only for 2D tensors. | [Link](src/kamae/tensorflow/layers/ordinal_array_encoder.py) | [Link](src/kamae/spark/estimators/ordinal_array_encoder.py) | Not yet implemented |
|
|
117
|
+
| Round | Rounds a floating feature to the nearest integer using `ceil`, `floor` or a standard `round` op. | [Link](src/kamae/tensorflow/layers/round.py) | [Link](src/kamae/spark/transformers/round.py) | Not yet implemented |
|
|
118
|
+
| RoundToDecimal | Rounds a floating feature to the nearest decimal precision. | [Link](src/kamae/tensorflow/layers/round_to_decimal.py) | [Link](src/kamae/spark/transformers/round_to_decimal.py) | Not yet implemented |
|
|
119
|
+
| SharedOneHotEncode | Transforms a string to a one-hot array, using labels across multiple inputs to determine the one-hot size. | [Link](src/kamae/tensorflow/layers/one_hot_encode.py) | [Link](src/kamae/spark/estimators/shared_one_hot_encode.py) | Not yet implemented |
|
|
120
|
+
| SharedStringIndex | Transforms strings to indices via a vocabulary lookup, sharing the vocabulary across multiple inputs. | [Link](src/kamae/tensorflow/layers/string_index.py) | [Link](src/kamae/spark/estimators/shared_string_index.py) | Not yet implemented |
|
|
121
|
+
| SingleFeatureArrayStandardScale | Normalises by the mean and standard deviation calculated over all elements of all inputs, with ability to mask a specified value. | [Link](src/kamae/tensorflow/layers/standard_scale.py) | [Link](src/kamae/spark/estimators/single_feature_array_standard_scale.py) | Not yet implemented |
|
|
122
|
+
| StandardScale | Normalises by the mean and standard deviation, with ability to mask a specified value. | [Link](src/kamae/tensorflow/layers/standard_scale.py) | [Link](src/kamae/spark/estimators/standard_scale.py) | [Link](src/kamae/sklearn/estimators/standard_scale.py) |
|
|
123
|
+
| StringAffix | Prefixes and suffixes a string with provided constants. | [Link](src/kamae/tensorflow/layers/string_affix.py) | [Link](src/kamae/spark/transformers/string_affix.py) | Not yet implemented |
|
|
124
|
+
| StringArrayConstant | Inserts provided string array constant into a column. | [Link](src/kamae/tensorflow/layers/string_array_constant.py) | [Link](src/kamae/spark/transformers/string_array_constant.py) | Not yet implemented |
|
|
125
|
+
| StringCase | Applies an upper or lower casing operation to the feature. | [Link](src/kamae/tensorflow/layers/string_case.py) | [Link](src/kamae/spark/transformers/string_case.py) | Not yet implemented |
|
|
126
|
+
| StringConcatenate | Joins string columns using the provided separator. | [Link](src/kamae/tensorflow/layers/string_concatenate.py) | [Link](src/kamae/spark/transformers/string_concatenate.py) | Not yet implemented |
|
|
127
|
+
| StringContains | Checks for the existence of a constant or tensor-element substring within a feature. | [Link](src/kamae/tensorflow/layers/string_contains.py) | [Link](src/kamae/spark/transformers/string_contains.py) | Not yet implemented |
|
|
128
|
+
| StringContainsList | Checks for the existence of any string from a list of string constants within a feature. | [Link](src/kamae/tensorflow/layers/string_contains_list.py) | [Link](src/kamae/spark/transformers/string_contains_list.py) | Not yet implemented |
|
|
129
|
+
| StringEqualsIfStatement | Performs a simple if else statement on string equality. Value to check, result if true or false can be constants or features. | [Link](src/kamae/tensorflow/layers/string_equals_if_statement.py) | [Link](src/kamae/spark/transformers/string_equals_if_statement.py) | Not yet implemented |
|
|
130
|
+
| StringIndex | Transforms strings to indices via a vocabulary lookup | [Link](src/kamae/tensorflow/layers/string_index.py) | [Link](src/kamae/spark/estimators/string_index.py) | Not yet implemented |
|
|
131
|
+
| StringListToString | Concatenates a list of strings to a single string with a given delimiter. | [Link](src/kamae/tensorflow/layers/string_list_to_string.py) | [Link](src/kamae/spark/transformers/string_list_to_string.py) | Not yet implemented |
|
|
132
|
+
| StringMap | Maps a list of string values to a list of other string values with a standard CASE WHEN statement. Can provide a default value for ELSE. | [Link](src/kamae/tensorflow/layers/string_map.py) | [Link](src/kamae/spark/transformers/string_map.py) | Not yet implemented |
|
|
133
|
+
| StringIsInList | Checks if the feature is equal to at least one of the strings provided. | [Link](src/kamae/tensorflow/layers/string_isin_list.py) | [Link](src/kamae/spark/transformers/string_isin_list.py) | Not yet implemented |
|
|
134
|
+
| StringReplace | Performs a regex replace operation on a feature with constant params or between multiple features | [Link](src/kamae/tensorflow/layers/string_replace.py) | [Link](src/kamae/spark/transformers/string_replace.py) | Not yet implemented |
|
|
135
|
+
| StringToStringList | Splits a string by a separator, returning a list of parametrised length (with a default value for missing inputs). | [Link](src/kamae/tensorflow/layers/string_to_string_list.py) | [Link](src/kamae/spark/transformers/string_to_string_list.py) | Not yet implemented |
|
|
136
|
+
| SubStringDelimAtIndex | Splits a string column using the provided delimiter, and returns the value at the index given. If the index is out of bounds, returns a given default value | [Link](src/kamae/tensorflow/layers/sub_string_delim_at_index.py) | [Link](src/kamae/spark/transformers/sub_string_delim_at_index.py) | Not yet implemented |
|
|
137
|
+
| Subtract | Subtracts a constant from a single feature or subtracts multiple features from each other. | [Link](src/kamae/tensorflow/layers/subtract.py) | [Link](src/kamae/spark/transformers/subtract.py) | Not yet implemented |
|
|
138
|
+
| Sum | Adds a constant to a single feature or sums multiple features together. | [Link](src/kamae/tensorflow/layers/sum.py) | [Link](src/kamae/spark/transformers/sum.py) | Not yet implemented |
|
|
139
|
+
| UnixTimestampToDateTime | Converts a unix timestamp to a UTC datetime string. | [Link](src/kamae/tensorflow/layers/unix_timestamp_to_date_time.py) | [Link](src/kamae/spark/transformers/unix_timestamp_to_date_time.py) | Not yet implemented |
|
|
140
|
+
|
|
141
|
+
## Mac ARM/x86_64 Support
|
|
142
|
+
From `tensorflow>=2.13.0` onwards, TensorFlow directly releases builds for Mac ARM chips.
|
|
143
|
+
|
|
144
|
+
Kamae supports `tensorflow>=2.9.1,<2.19.0`, however, if you require `tensorflow<2.13.0` and are using a Mac ARM chip, you will need to install `tensorflow-macos<2.13.0` yourself.
|
|
145
|
+
|
|
146
|
+
From `tensorflow>=2.18.0` onwards, TensorFlow does not release builds for Mac x86_64 chips. If you are on an old Mac chip, please bear this in mind when using the library.
|
|
147
|
+
|
|
148
|
+
|
|
149
|
+
## Installation
|
|
150
|
+
|
|
151
|
+
The Kamae package is pushed to PyPI, and can be installed using the command:
|
|
152
|
+
```bash
|
|
153
|
+
pip install kamae
|
|
154
|
+
```
|
|
155
|
+
Alternatively, the package can be installed from the source code by downloading the latest release .tar file from the [Releases](https://github.com/ExpediaGroup/kamae/releases) page and running the following command:
|
|
156
|
+
```bash
|
|
157
|
+
pip install kamae-<version>.tar
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
## Development
|
|
161
|
+
|
|
162
|
+
### Getting Started
|
|
163
|
+
|
|
164
|
+
#### Installing Python
|
|
165
|
+
|
|
166
|
+
Local development is in Python 3.10. uv can install this for you, once you have run `make setup-uv`. Then run `make install`
|
|
167
|
+
|
|
168
|
+
The final package supports Python 3.8 -> 3.12.
|
|
169
|
+
|
|
170
|
+
#### Installing `pipx`
|
|
171
|
+
|
|
172
|
+
`pipx` is used to install `uv` and `pre-commit` in isolated environments.
|
|
173
|
+
|
|
174
|
+
Installing `pipx` depends on your operating system. See the [pipx installation instructions](https://github.com/pypa/pipx?tab=readme-ov-file#install-pipx).
|
|
175
|
+
|
|
176
|
+
#### Setting up the project
|
|
177
|
+
|
|
178
|
+
Once python 3.10 and `pipx` are installed, run the below make command to set up the project:
|
|
179
|
+
```bash
|
|
180
|
+
make setup
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
### Helpful Commands
|
|
184
|
+
|
|
185
|
+
A Makefile is provided to simplify common development tasks. The available commands can be listed by running:
|
|
186
|
+
```bash
|
|
187
|
+
make help
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
In order to get setup for local development, you will need to install the project dependencies and pre-commit hooks. This can be done by running:
|
|
191
|
+
```bash
|
|
192
|
+
make setup
|
|
193
|
+
```
|
|
194
|
+
|
|
195
|
+
Once the dependencies are installed, tests, formatting & linting can be run by running:
|
|
196
|
+
|
|
197
|
+
```bash
|
|
198
|
+
make all
|
|
199
|
+
```
|
|
200
|
+
|
|
201
|
+
You can run an example of the package by running:
|
|
202
|
+
```bash
|
|
203
|
+
make run-example
|
|
204
|
+
```
|
|
205
|
+
|
|
206
|
+
You can test the inference of a model served by TensorFlow Serving by running:
|
|
207
|
+
```bash
|
|
208
|
+
make test-tf-serving
|
|
209
|
+
```
|
|
210
|
+
|
|
211
|
+
Lastly, you can run both an example and test the inference of a model (above two commands) in one command by running:
|
|
212
|
+
```bash
|
|
213
|
+
make test-end-to-end
|
|
214
|
+
```
|
|
215
|
+
|
|
216
|
+
See the docs here for more details on [testing inference](docs/testing_inference.md).
|
|
217
|
+
|
|
218
|
+
### Dependencies
|
|
219
|
+
|
|
220
|
+
For local development, dependency management is controlled with the [uv](https://docs.astral.sh/uv/) package, which can be installed by following the instructions [here](https://docs.astral.sh/uv/getting-started/installation/).
|
|
221
|
+
|
|
222
|
+
### Contributing
|
|
223
|
+
|
|
224
|
+
To contribute to the project, a branch should be created from the `main` branch, and a pull request should be opened when the changes are ready to be reviewed.
|
|
225
|
+
Please follow [these](/docs/adding_transformer.md) docs for contributing new transformers.
|
|
226
|
+
|
|
227
|
+
### Code Quality
|
|
228
|
+
|
|
229
|
+
The project uses pre-commit hooks to enforce linting and formatting standards. You should install the pre-commit hooks before committing for the first time by running:
|
|
230
|
+
```bash
|
|
231
|
+
uv run pre-commit install
|
|
232
|
+
```
|
|
233
|
+
|
|
234
|
+
Additionally, for a pull request to be accepted, the code must pass the unit tests found in the `tests/` directory. The full suite of formatting, linting, coverage checks, and tests can be run locally with the command:
|
|
235
|
+
```bash
|
|
236
|
+
make all
|
|
237
|
+
```
|
|
238
|
+
|
|
239
|
+
### Versioning
|
|
240
|
+
|
|
241
|
+
Versioning for the project is performed by the [semantic-release](https://semantic-release.gitbook.io/semantic-release/) package. When a pull request is merged into the `main` branch, the package version will be automatically updated based on the squashed commit message from the PR title.
|
|
242
|
+
|
|
243
|
+
Commits prefixed with `fix:` will trigger a patch version update, `feat:` will trigger a minor version update, and `BREAKING CHANGE:` will trigger a major version update. Note `BREAKING CHANGE:` needs to be in the commit body/footer as detailed [here](https://www.conventionalcommits.org/en/v1.0.0/#summary). All other commit prefixes will trigger no version update. PR titles should therefore be prefixed accordingly.
|
|
244
|
+
|
|
245
|
+
|
|
246
|
+
### Contact
|
|
247
|
+
For any questions or concerns please reach out to the [team](https://github.com/orgs/ExpediaGroup/teams/kamae-admins).
|