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.

Files changed (96) hide show
  1. teradataml/README.md +210 -0
  2. teradataml/__init__.py +1 -1
  3. teradataml/_version.py +1 -1
  4. teradataml/analytics/analytic_function_executor.py +162 -76
  5. teradataml/analytics/byom/__init__.py +1 -1
  6. teradataml/analytics/json_parser/__init__.py +2 -0
  7. teradataml/analytics/json_parser/analytic_functions_argument.py +95 -2
  8. teradataml/analytics/json_parser/metadata.py +22 -4
  9. teradataml/analytics/sqle/DecisionTreePredict.py +3 -2
  10. teradataml/analytics/sqle/NaiveBayesPredict.py +3 -2
  11. teradataml/analytics/sqle/__init__.py +3 -0
  12. teradataml/analytics/utils.py +4 -1
  13. teradataml/automl/__init__.py +2369 -464
  14. teradataml/automl/autodataprep/__init__.py +15 -0
  15. teradataml/automl/custom_json_utils.py +184 -112
  16. teradataml/automl/data_preparation.py +113 -58
  17. teradataml/automl/data_transformation.py +154 -53
  18. teradataml/automl/feature_engineering.py +113 -53
  19. teradataml/automl/feature_exploration.py +548 -25
  20. teradataml/automl/model_evaluation.py +260 -32
  21. teradataml/automl/model_training.py +399 -206
  22. teradataml/clients/auth_client.py +2 -2
  23. teradataml/common/aed_utils.py +11 -2
  24. teradataml/common/bulk_exposed_utils.py +4 -2
  25. teradataml/common/constants.py +62 -2
  26. teradataml/common/garbagecollector.py +50 -21
  27. teradataml/common/messagecodes.py +47 -2
  28. teradataml/common/messages.py +19 -1
  29. teradataml/common/sqlbundle.py +23 -6
  30. teradataml/common/utils.py +116 -10
  31. teradataml/context/aed_context.py +16 -10
  32. teradataml/data/Employee.csv +5 -0
  33. teradataml/data/Employee_Address.csv +4 -0
  34. teradataml/data/Employee_roles.csv +5 -0
  35. teradataml/data/JulesBelvezeDummyData.csv +100 -0
  36. teradataml/data/byom_example.json +5 -0
  37. teradataml/data/creditcard_data.csv +284618 -0
  38. teradataml/data/docs/byom/docs/ONNXSeq2Seq.py +255 -0
  39. teradataml/data/docs/sqle/docs_17_10/NGramSplitter.py +1 -1
  40. teradataml/data/docs/sqle/docs_17_20/NGramSplitter.py +1 -1
  41. teradataml/data/docs/sqle/docs_17_20/TextParser.py +1 -1
  42. teradataml/data/jsons/byom/ONNXSeq2Seq.json +287 -0
  43. teradataml/data/jsons/sqle/20.00/AI_AnalyzeSentiment.json +3 -7
  44. teradataml/data/jsons/sqle/20.00/AI_AskLLM.json +3 -7
  45. teradataml/data/jsons/sqle/20.00/AI_DetectLanguage.json +3 -7
  46. teradataml/data/jsons/sqle/20.00/AI_ExtractKeyPhrases.json +3 -7
  47. teradataml/data/jsons/sqle/20.00/AI_MaskPII.json +3 -7
  48. teradataml/data/jsons/sqle/20.00/AI_RecognizeEntities.json +3 -7
  49. teradataml/data/jsons/sqle/20.00/AI_RecognizePIIEntities.json +3 -7
  50. teradataml/data/jsons/sqle/20.00/AI_TextClassifier.json +3 -7
  51. teradataml/data/jsons/sqle/20.00/AI_TextEmbeddings.json +3 -7
  52. teradataml/data/jsons/sqle/20.00/AI_TextSummarize.json +3 -7
  53. teradataml/data/jsons/sqle/20.00/AI_TextTranslate.json +3 -7
  54. teradataml/data/jsons/sqle/20.00/TD_API_AzureML.json +151 -0
  55. teradataml/data/jsons/sqle/20.00/TD_API_Sagemaker.json +182 -0
  56. teradataml/data/jsons/sqle/20.00/TD_API_VertexAI.json +183 -0
  57. teradataml/data/load_example_data.py +29 -11
  58. teradataml/data/payment_fraud_dataset.csv +10001 -0
  59. teradataml/data/teradataml_example.json +67 -0
  60. teradataml/dataframe/copy_to.py +714 -54
  61. teradataml/dataframe/dataframe.py +1153 -33
  62. teradataml/dataframe/dataframe_utils.py +8 -3
  63. teradataml/dataframe/functions.py +168 -1
  64. teradataml/dataframe/setop.py +4 -1
  65. teradataml/dataframe/sql.py +141 -9
  66. teradataml/dbutils/dbutils.py +470 -35
  67. teradataml/dbutils/filemgr.py +1 -1
  68. teradataml/hyperparameter_tuner/optimizer.py +456 -142
  69. teradataml/lib/aed_0_1.dll +0 -0
  70. teradataml/lib/libaed_0_1.dylib +0 -0
  71. teradataml/lib/libaed_0_1.so +0 -0
  72. teradataml/lib/libaed_0_1_aarch64.so +0 -0
  73. teradataml/scriptmgmt/UserEnv.py +234 -34
  74. teradataml/scriptmgmt/lls_utils.py +43 -17
  75. teradataml/sdk/_json_parser.py +1 -1
  76. teradataml/sdk/api_client.py +9 -6
  77. teradataml/sdk/modelops/_client.py +3 -0
  78. teradataml/series/series.py +12 -7
  79. teradataml/store/feature_store/constants.py +601 -234
  80. teradataml/store/feature_store/feature_store.py +2886 -616
  81. teradataml/store/feature_store/mind_map.py +639 -0
  82. teradataml/store/feature_store/models.py +5831 -214
  83. teradataml/store/feature_store/utils.py +390 -0
  84. teradataml/table_operators/table_operator_util.py +1 -1
  85. teradataml/table_operators/templates/dataframe_register.template +6 -2
  86. teradataml/table_operators/templates/dataframe_udf.template +6 -2
  87. teradataml/utils/docstring.py +527 -0
  88. teradataml/utils/dtypes.py +93 -0
  89. teradataml/utils/internal_buffer.py +2 -2
  90. teradataml/utils/utils.py +41 -2
  91. teradataml/utils/validators.py +694 -17
  92. {teradataml-20.0.0.6.dist-info → teradataml-20.0.0.7.dist-info}/METADATA +213 -2
  93. {teradataml-20.0.0.6.dist-info → teradataml-20.0.0.7.dist-info}/RECORD +96 -81
  94. {teradataml-20.0.0.6.dist-info → teradataml-20.0.0.7.dist-info}/WHEEL +0 -0
  95. {teradataml-20.0.0.6.dist-info → teradataml-20.0.0.7.dist-info}/top_level.txt +0 -0
  96. {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 = self.__aqg_obj._get_alias_name_for_function(function_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 = self.__aqg_obj._get_alias_name_for_function(function_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',
@@ -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
- "AI_TextEmbeddings": {"authorization": self._remove_quotes},
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},