teradataml 20.0.0.6__py3-none-any.whl → 20.0.0.7__py3-none-any.whl
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 teradataml might be problematic. Click here for more details.
- teradataml/README.md +210 -0
- teradataml/__init__.py +1 -1
- teradataml/_version.py +1 -1
- teradataml/analytics/analytic_function_executor.py +162 -76
- teradataml/analytics/byom/__init__.py +1 -1
- teradataml/analytics/json_parser/__init__.py +2 -0
- teradataml/analytics/json_parser/analytic_functions_argument.py +95 -2
- teradataml/analytics/json_parser/metadata.py +22 -4
- teradataml/analytics/sqle/DecisionTreePredict.py +3 -2
- teradataml/analytics/sqle/NaiveBayesPredict.py +3 -2
- teradataml/analytics/sqle/__init__.py +3 -0
- teradataml/analytics/utils.py +4 -1
- teradataml/automl/__init__.py +2369 -464
- teradataml/automl/autodataprep/__init__.py +15 -0
- teradataml/automl/custom_json_utils.py +184 -112
- teradataml/automl/data_preparation.py +113 -58
- teradataml/automl/data_transformation.py +154 -53
- teradataml/automl/feature_engineering.py +113 -53
- teradataml/automl/feature_exploration.py +548 -25
- teradataml/automl/model_evaluation.py +260 -32
- teradataml/automl/model_training.py +399 -206
- teradataml/clients/auth_client.py +2 -2
- teradataml/common/aed_utils.py +11 -2
- teradataml/common/bulk_exposed_utils.py +4 -2
- teradataml/common/constants.py +62 -2
- teradataml/common/garbagecollector.py +50 -21
- teradataml/common/messagecodes.py +47 -2
- teradataml/common/messages.py +19 -1
- teradataml/common/sqlbundle.py +23 -6
- teradataml/common/utils.py +116 -10
- teradataml/context/aed_context.py +16 -10
- teradataml/data/Employee.csv +5 -0
- teradataml/data/Employee_Address.csv +4 -0
- teradataml/data/Employee_roles.csv +5 -0
- teradataml/data/JulesBelvezeDummyData.csv +100 -0
- teradataml/data/byom_example.json +5 -0
- teradataml/data/creditcard_data.csv +284618 -0
- teradataml/data/docs/byom/docs/ONNXSeq2Seq.py +255 -0
- teradataml/data/docs/sqle/docs_17_10/NGramSplitter.py +1 -1
- teradataml/data/docs/sqle/docs_17_20/NGramSplitter.py +1 -1
- teradataml/data/docs/sqle/docs_17_20/TextParser.py +1 -1
- teradataml/data/jsons/byom/ONNXSeq2Seq.json +287 -0
- teradataml/data/jsons/sqle/20.00/AI_AnalyzeSentiment.json +3 -7
- teradataml/data/jsons/sqle/20.00/AI_AskLLM.json +3 -7
- teradataml/data/jsons/sqle/20.00/AI_DetectLanguage.json +3 -7
- teradataml/data/jsons/sqle/20.00/AI_ExtractKeyPhrases.json +3 -7
- teradataml/data/jsons/sqle/20.00/AI_MaskPII.json +3 -7
- teradataml/data/jsons/sqle/20.00/AI_RecognizeEntities.json +3 -7
- teradataml/data/jsons/sqle/20.00/AI_RecognizePIIEntities.json +3 -7
- teradataml/data/jsons/sqle/20.00/AI_TextClassifier.json +3 -7
- teradataml/data/jsons/sqle/20.00/AI_TextEmbeddings.json +3 -7
- teradataml/data/jsons/sqle/20.00/AI_TextSummarize.json +3 -7
- teradataml/data/jsons/sqle/20.00/AI_TextTranslate.json +3 -7
- teradataml/data/jsons/sqle/20.00/TD_API_AzureML.json +151 -0
- teradataml/data/jsons/sqle/20.00/TD_API_Sagemaker.json +182 -0
- teradataml/data/jsons/sqle/20.00/TD_API_VertexAI.json +183 -0
- teradataml/data/load_example_data.py +29 -11
- teradataml/data/payment_fraud_dataset.csv +10001 -0
- teradataml/data/teradataml_example.json +67 -0
- teradataml/dataframe/copy_to.py +714 -54
- teradataml/dataframe/dataframe.py +1153 -33
- teradataml/dataframe/dataframe_utils.py +8 -3
- teradataml/dataframe/functions.py +168 -1
- teradataml/dataframe/setop.py +4 -1
- teradataml/dataframe/sql.py +141 -9
- teradataml/dbutils/dbutils.py +470 -35
- teradataml/dbutils/filemgr.py +1 -1
- teradataml/hyperparameter_tuner/optimizer.py +456 -142
- teradataml/lib/aed_0_1.dll +0 -0
- teradataml/lib/libaed_0_1.dylib +0 -0
- teradataml/lib/libaed_0_1.so +0 -0
- teradataml/lib/libaed_0_1_aarch64.so +0 -0
- teradataml/scriptmgmt/UserEnv.py +234 -34
- teradataml/scriptmgmt/lls_utils.py +43 -17
- teradataml/sdk/_json_parser.py +1 -1
- teradataml/sdk/api_client.py +9 -6
- teradataml/sdk/modelops/_client.py +3 -0
- teradataml/series/series.py +12 -7
- teradataml/store/feature_store/constants.py +601 -234
- teradataml/store/feature_store/feature_store.py +2886 -616
- teradataml/store/feature_store/mind_map.py +639 -0
- teradataml/store/feature_store/models.py +5831 -214
- teradataml/store/feature_store/utils.py +390 -0
- teradataml/table_operators/table_operator_util.py +1 -1
- teradataml/table_operators/templates/dataframe_register.template +6 -2
- teradataml/table_operators/templates/dataframe_udf.template +6 -2
- teradataml/utils/docstring.py +527 -0
- teradataml/utils/dtypes.py +93 -0
- teradataml/utils/internal_buffer.py +2 -2
- teradataml/utils/utils.py +41 -2
- teradataml/utils/validators.py +694 -17
- {teradataml-20.0.0.6.dist-info → teradataml-20.0.0.7.dist-info}/METADATA +213 -2
- {teradataml-20.0.0.6.dist-info → teradataml-20.0.0.7.dist-info}/RECORD +96 -81
- {teradataml-20.0.0.6.dist-info → teradataml-20.0.0.7.dist-info}/WHEEL +0 -0
- {teradataml-20.0.0.6.dist-info → teradataml-20.0.0.7.dist-info}/top_level.txt +0 -0
- {teradataml-20.0.0.6.dist-info → teradataml-20.0.0.7.dist-info}/zip-safe +0 -0
|
@@ -15,6 +15,7 @@ File implements classes for following:
|
|
|
15
15
|
* Analytic Function Output Argument
|
|
16
16
|
* Analytic Function Other Argument
|
|
17
17
|
"""
|
|
18
|
+
import re
|
|
18
19
|
from teradataml.analytics.json_parser import PartitionKind
|
|
19
20
|
from teradataml.utils.dtypes import _Dtypes
|
|
20
21
|
from teradataml.utils.validators import _Validators
|
|
@@ -284,6 +285,79 @@ class _AnlyFuncArgumentBase(object):
|
|
|
284
285
|
"""
|
|
285
286
|
return self.__use_in_r
|
|
286
287
|
|
|
288
|
+
@staticmethod
|
|
289
|
+
def get_regex_sql_name(sql_name, match_name, arg_names):
|
|
290
|
+
"""
|
|
291
|
+
DESCRIPTION:
|
|
292
|
+
Get SQL name of the argument by matching the given pattern.
|
|
293
|
+
|
|
294
|
+
PARAMETERS:
|
|
295
|
+
sql_name:
|
|
296
|
+
Required Argument.
|
|
297
|
+
Specifies the name of the argument in SQL.
|
|
298
|
+
Types: str
|
|
299
|
+
|
|
300
|
+
match_name:
|
|
301
|
+
Required Argument.
|
|
302
|
+
Specifies the match name which will be replaced
|
|
303
|
+
by the SQL name.
|
|
304
|
+
Types: str
|
|
305
|
+
|
|
306
|
+
arg_names:
|
|
307
|
+
Required Argument.
|
|
308
|
+
Specifies the list of python argument name.
|
|
309
|
+
Types: list
|
|
310
|
+
|
|
311
|
+
RETURNS:
|
|
312
|
+
list
|
|
313
|
+
|
|
314
|
+
RAISES:
|
|
315
|
+
None
|
|
316
|
+
|
|
317
|
+
EXAMPLES:
|
|
318
|
+
# Get the argument name used in SQL Query.
|
|
319
|
+
from teradataml.analytics.json_parser.argument import _AnlyFuncArgumentBase
|
|
320
|
+
argument_base = _AnlyFuncArgumentBase("sql_name", True, "SQL Description", "Python Description", "name", True)
|
|
321
|
+
argument_base.get_regex_sql_name("Abc_*", "const_", ["const_num", "const_min_length"])
|
|
322
|
+
"""
|
|
323
|
+
sql_names = [key.replace(match_name, sql_name)
|
|
324
|
+
for key in arg_names if key.startswith(match_name)]
|
|
325
|
+
|
|
326
|
+
return sql_names
|
|
327
|
+
|
|
328
|
+
@staticmethod
|
|
329
|
+
def get_regex_matched_arguments(arg_name, **kwargs):
|
|
330
|
+
"""
|
|
331
|
+
DESCRIPTION:
|
|
332
|
+
Get client specific name of the argument by matching given pattern.
|
|
333
|
+
|
|
334
|
+
PARAMETERS:
|
|
335
|
+
arg_name:
|
|
336
|
+
Required Argument.
|
|
337
|
+
Specifies the name of the argument.
|
|
338
|
+
Types: list
|
|
339
|
+
|
|
340
|
+
kwargs:
|
|
341
|
+
Required Argument.
|
|
342
|
+
Specifies the user provided arguments.
|
|
343
|
+
Types: dict
|
|
344
|
+
|
|
345
|
+
RETURNS:
|
|
346
|
+
list
|
|
347
|
+
|
|
348
|
+
RAISES:
|
|
349
|
+
None
|
|
350
|
+
|
|
351
|
+
EXAMPLES:
|
|
352
|
+
# Get the argument name, which is exposed to user.
|
|
353
|
+
from teradataml.analytics.json_parser.argument import _AnlyFuncArgumentBase
|
|
354
|
+
argument_base = _AnlyFuncArgumentBase("sql_name", True, "SQL Description", "Python Description", "name", True)
|
|
355
|
+
argument_base.get_regex_matched_arguments("const_*", newdata=DataFrame(df), const_num=2, const_min_length=81)
|
|
356
|
+
"""
|
|
357
|
+
pattern = re.compile("{}{}".format('^', arg_name))
|
|
358
|
+
arg_names = [key for key in kwargs if pattern.match(key)]
|
|
359
|
+
|
|
360
|
+
return arg_names
|
|
287
361
|
|
|
288
362
|
class _AnlyFuncInput(_AnlyFuncArgumentBase):
|
|
289
363
|
"""
|
|
@@ -913,7 +987,9 @@ class _AnlyFuncArgument(_AnlyFuncArgumentBase):
|
|
|
913
987
|
allowed_types=None,
|
|
914
988
|
allowed_type_groups=None,
|
|
915
989
|
is_output_column=False,
|
|
916
|
-
alternate_sql_name=None
|
|
990
|
+
alternate_sql_name=None,
|
|
991
|
+
regex_match=False,
|
|
992
|
+
match_name=None):
|
|
917
993
|
"""
|
|
918
994
|
Constructor for generating an object of Analytic Function Argument from
|
|
919
995
|
JSON for other arguments.
|
|
@@ -1079,6 +1155,17 @@ class _AnlyFuncArgument(_AnlyFuncArgumentBase):
|
|
|
1079
1155
|
Optional Argument.
|
|
1080
1156
|
Specifies alternate names for the argument.
|
|
1081
1157
|
Types: str or list of str
|
|
1158
|
+
|
|
1159
|
+
regex_match:
|
|
1160
|
+
Optional Argument.
|
|
1161
|
+
Specifies whether argument is regular expression or not.
|
|
1162
|
+
Default Value: False
|
|
1163
|
+
Types: bool
|
|
1164
|
+
|
|
1165
|
+
match_name:
|
|
1166
|
+
Optional Argument.
|
|
1167
|
+
Specifies the name to match against the user provided arguments.
|
|
1168
|
+
Types: str
|
|
1082
1169
|
"""
|
|
1083
1170
|
|
|
1084
1171
|
# Call super class constructor to initialize basic parameters.
|
|
@@ -1107,6 +1194,8 @@ class _AnlyFuncArgument(_AnlyFuncArgumentBase):
|
|
|
1107
1194
|
self.__r_order_num = r_order_num
|
|
1108
1195
|
self.__is_output_column = is_output_column
|
|
1109
1196
|
self.__alternate_sql_name = alternate_sql_name
|
|
1197
|
+
self.__regex_match = regex_match
|
|
1198
|
+
self.__match_name = match_name
|
|
1110
1199
|
|
|
1111
1200
|
awu_matrix = []
|
|
1112
1201
|
awu_matrix.append(["r_order_num", r_order_num, False, int])
|
|
@@ -1131,6 +1220,8 @@ class _AnlyFuncArgument(_AnlyFuncArgumentBase):
|
|
|
1131
1220
|
awu_matrix.append(["allowed_type_groups", allowed_type_groups, True, (list, str)])
|
|
1132
1221
|
awu_matrix.append(["is_output_column", is_output_column, True, bool])
|
|
1133
1222
|
awu_matrix.append(["alternate_sql_name", alternate_sql_name, True, (list, str)])
|
|
1223
|
+
awu_matrix.append(["regex_match", regex_match, True, bool])
|
|
1224
|
+
awu_matrix.append(["match_name", match_name, True, str, True])
|
|
1134
1225
|
|
|
1135
1226
|
# Validate argument types.
|
|
1136
1227
|
_Validators._validate_function_arguments(awu_matrix)
|
|
@@ -1165,6 +1256,8 @@ class _AnlyFuncArgument(_AnlyFuncArgumentBase):
|
|
|
1165
1256
|
self.is_output_column = lambda: self.__is_output_column
|
|
1166
1257
|
self.get_alternate_sql_name = lambda: self.__alternate_sql_name
|
|
1167
1258
|
self.is_empty_value_allowed = lambda: not self.is_column_argument()
|
|
1259
|
+
self.regex_match = lambda: self.__regex_match
|
|
1260
|
+
self.match_name = lambda: self.__match_name
|
|
1168
1261
|
|
|
1169
1262
|
def get_python_type(self):
|
|
1170
1263
|
"""
|
|
@@ -1709,4 +1802,4 @@ class _AnlyFuncArgumentUAF(_AnlyFuncArgumentBaseUAF):
|
|
|
1709
1802
|
if self.__allows_lists and (list not in py_types):
|
|
1710
1803
|
py_types = py_types + (list,)
|
|
1711
1804
|
|
|
1712
|
-
return py_types
|
|
1805
|
+
return py_types
|
|
@@ -322,9 +322,13 @@ class _AnlyFuncMetadata:
|
|
|
322
322
|
|
|
323
323
|
sql_name = self._get_argument_value(argument, self.json_fields.NAME, section)
|
|
324
324
|
|
|
325
|
+
regex_match = self._get_argument_value(argument, self.json_fields.REGEX_MATCH, section, False)
|
|
326
|
+
|
|
327
|
+
match_name = self._get_argument_value(argument, self.json_fields.MATCH_NAME, section, False)
|
|
328
|
+
|
|
325
329
|
lang_name = self._get_argument_value(argument, self.json_fields.LANG_NAME, section, False)
|
|
326
330
|
lang_name = lang_name if lang_name is not None else self._get_pythonic_name_arg_name(
|
|
327
|
-
self._get_argument_value(argument, self.json_fields.R_NAME, section))
|
|
331
|
+
self._get_argument_value(argument, self.json_fields.R_NAME, section), is_regex_match=regex_match)
|
|
328
332
|
|
|
329
333
|
is_required = self._get_argument_value(argument, self.json_fields.IS_REQUIRED, section)
|
|
330
334
|
|
|
@@ -437,7 +441,9 @@ class _AnlyFuncMetadata:
|
|
|
437
441
|
r_order_num=r_order_num,
|
|
438
442
|
is_output_column=is_output_column,
|
|
439
443
|
alternate_sql_name=alternate_sql_name,
|
|
440
|
-
lang_name=lang_name
|
|
444
|
+
lang_name=lang_name,
|
|
445
|
+
regex_match=regex_match,
|
|
446
|
+
match_name=match_name))
|
|
441
447
|
else:
|
|
442
448
|
self.arguments.append(_AnlyFuncArgument(default_value=default_value,
|
|
443
449
|
permitted_values=permitted_values,
|
|
@@ -466,7 +472,10 @@ class _AnlyFuncMetadata:
|
|
|
466
472
|
allowed_type_groups=allowed_type_groups,
|
|
467
473
|
r_order_num=r_order_num,
|
|
468
474
|
is_output_column=is_output_column,
|
|
469
|
-
alternate_sql_name=alternate_sql_name
|
|
475
|
+
alternate_sql_name=alternate_sql_name,
|
|
476
|
+
regex_match=regex_match,
|
|
477
|
+
match_name=match_name))
|
|
478
|
+
|
|
470
479
|
|
|
471
480
|
def _parse_input_tables(self):
|
|
472
481
|
"""
|
|
@@ -1094,7 +1103,7 @@ class _AnlyFuncMetadata:
|
|
|
1094
1103
|
MessageCodes.DUPLICATE_PARAMETER)
|
|
1095
1104
|
|
|
1096
1105
|
@staticmethod
|
|
1097
|
-
def _get_pythonic_name_arg_name(r_name):
|
|
1106
|
+
def _get_pythonic_name_arg_name(r_name, is_regex_match=False):
|
|
1098
1107
|
"""
|
|
1099
1108
|
DESCRIPTION:
|
|
1100
1109
|
Function to get the pythonic name for argument from the name specified
|
|
@@ -1111,6 +1120,12 @@ class _AnlyFuncMetadata:
|
|
|
1111
1120
|
Specifies the name of the argument which is mentioned in json file.
|
|
1112
1121
|
Types: str
|
|
1113
1122
|
|
|
1123
|
+
is_regex_match:
|
|
1124
|
+
Optional Argument.
|
|
1125
|
+
Specifies whether regex match is set or not.
|
|
1126
|
+
Default Value: False
|
|
1127
|
+
Types: bool
|
|
1128
|
+
|
|
1114
1129
|
RETURNS:
|
|
1115
1130
|
str
|
|
1116
1131
|
|
|
@@ -1120,6 +1135,9 @@ class _AnlyFuncMetadata:
|
|
|
1120
1135
|
EXAMPLES:
|
|
1121
1136
|
_AnlyFuncMetadata(json_data, "/abc/Antiselect.json")._get_pythonic_name_arg_name("abc")
|
|
1122
1137
|
"""
|
|
1138
|
+
# When regex_match is set to True, we consider r_name as a regular expression.
|
|
1139
|
+
if is_regex_match:
|
|
1140
|
+
return r_name.strip()
|
|
1123
1141
|
return r_name.strip().lower().replace(".", "_").replace("_table", "_data").replace("table_", "data_")
|
|
1124
1142
|
|
|
1125
1143
|
def _get_function_name(self):
|
|
@@ -338,7 +338,8 @@ class DecisionTreePredict:
|
|
|
338
338
|
self.__func_other_args,
|
|
339
339
|
self.__func_other_arg_json_datatypes,
|
|
340
340
|
self.__func_output_args_sql_names,
|
|
341
|
-
self.__func_output_args,
|
|
341
|
+
self.__func_output_args,
|
|
342
|
+
skip_config_lookup=True,
|
|
342
343
|
engine="ENGINE_SQL")
|
|
343
344
|
# Invoke call to SQL-MR generation.
|
|
344
345
|
self.sqlmr_query = self.__aqg_obj._gen_sqlmr_select_stmt_sql()
|
|
@@ -348,7 +349,7 @@ class DecisionTreePredict:
|
|
|
348
349
|
print(self.sqlmr_query)
|
|
349
350
|
|
|
350
351
|
# Set the algorithm name for Model Cataloging.
|
|
351
|
-
self._algorithm_name =
|
|
352
|
+
self._algorithm_name = function_name
|
|
352
353
|
|
|
353
354
|
def __execute(self):
|
|
354
355
|
"""
|
|
@@ -287,7 +287,8 @@ class NaiveBayesPredict:
|
|
|
287
287
|
self.__func_other_args,
|
|
288
288
|
self.__func_other_arg_json_datatypes,
|
|
289
289
|
self.__func_output_args_sql_names,
|
|
290
|
-
self.__func_output_args,
|
|
290
|
+
self.__func_output_args,
|
|
291
|
+
skip_config_lookup=True,
|
|
291
292
|
engine="ENGINE_SQL")
|
|
292
293
|
# Invoke call to SQL-MR generation.
|
|
293
294
|
self.sqlmr_query = self.__aqg_obj._gen_sqlmr_select_stmt_sql()
|
|
@@ -297,7 +298,7 @@ class NaiveBayesPredict:
|
|
|
297
298
|
print(self.sqlmr_query)
|
|
298
299
|
|
|
299
300
|
# Set the algorithm name for Model Cataloging.
|
|
300
|
-
self._algorithm_name =
|
|
301
|
+
self._algorithm_name = function_name
|
|
301
302
|
|
|
302
303
|
def __execute(self):
|
|
303
304
|
"""
|
|
@@ -6,6 +6,9 @@ from teradataml.analytics.meta_class import _common_init, _common_dir
|
|
|
6
6
|
from teradataml.analytics.json_parser.utils import _get_associated_parent_classes
|
|
7
7
|
|
|
8
8
|
_sqle_functions = [
|
|
9
|
+
'TDAPIVertexAI',
|
|
10
|
+
'TDAPISagemaker',
|
|
11
|
+
'TDAPIAzureML',
|
|
9
12
|
'AIAnalyzeSentiment',
|
|
10
13
|
'AITextTranslate',
|
|
11
14
|
'AIDetectLanguage',
|
teradataml/analytics/utils.py
CHANGED
|
@@ -459,10 +459,13 @@ class FuncSpecialCaseHandler():
|
|
|
459
459
|
"Matrix2Image": {"type": self._single_quote_arg,
|
|
460
460
|
"colormap": self._single_quote_arg
|
|
461
461
|
},
|
|
462
|
+
"TDAPIVERTEXAI": {"authorization": self._remove_quotes},
|
|
463
|
+
"TDAPISAGEMAKER": {"authorization": self._remove_quotes},
|
|
464
|
+
"TDAPIAZUREML": {"authorization": self._remove_quotes},
|
|
462
465
|
"AIAnalyzeSentiment": {"authorization": self._remove_quotes},
|
|
463
466
|
"AITextTranslate": {"authorization": self._remove_quotes},
|
|
464
467
|
"AITextSummarize": {"authorization": self._remove_quotes},
|
|
465
|
-
"
|
|
468
|
+
"AITextEmbeddings": {"authorization": self._remove_quotes},
|
|
466
469
|
"AITextClassifier": {"authorization": self._remove_quotes},
|
|
467
470
|
"AIRecognizePIIEntities": {"authorization": self._remove_quotes},
|
|
468
471
|
"AIRecognizeEntities": {"authorization": self._remove_quotes},
|