teradataml 20.0.0.1__py3-none-any.whl → 20.0.0.2__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 (200) hide show
  1. teradataml/LICENSE.pdf +0 -0
  2. teradataml/README.md +112 -0
  3. teradataml/__init__.py +6 -3
  4. teradataml/_version.py +1 -1
  5. teradataml/analytics/__init__.py +3 -2
  6. teradataml/analytics/analytic_function_executor.py +224 -16
  7. teradataml/analytics/analytic_query_generator.py +92 -0
  8. teradataml/analytics/byom/__init__.py +3 -2
  9. teradataml/analytics/json_parser/metadata.py +1 -0
  10. teradataml/analytics/json_parser/utils.py +6 -4
  11. teradataml/analytics/meta_class.py +40 -1
  12. teradataml/analytics/sqle/DecisionTreePredict.py +1 -1
  13. teradataml/analytics/sqle/__init__.py +10 -2
  14. teradataml/analytics/table_operator/__init__.py +3 -2
  15. teradataml/analytics/uaf/__init__.py +21 -2
  16. teradataml/analytics/utils.py +62 -1
  17. teradataml/analytics/valib.py +1 -1
  18. teradataml/automl/__init__.py +1502 -323
  19. teradataml/automl/custom_json_utils.py +139 -61
  20. teradataml/automl/data_preparation.py +245 -306
  21. teradataml/automl/data_transformation.py +32 -12
  22. teradataml/automl/feature_engineering.py +313 -82
  23. teradataml/automl/model_evaluation.py +44 -35
  24. teradataml/automl/model_training.py +109 -146
  25. teradataml/catalog/byom.py +8 -8
  26. teradataml/clients/pkce_client.py +1 -1
  27. teradataml/common/constants.py +37 -0
  28. teradataml/common/deprecations.py +13 -7
  29. teradataml/common/garbagecollector.py +151 -120
  30. teradataml/common/messagecodes.py +4 -1
  31. teradataml/common/messages.py +2 -1
  32. teradataml/common/sqlbundle.py +1 -1
  33. teradataml/common/utils.py +97 -11
  34. teradataml/common/wrapper_utils.py +1 -1
  35. teradataml/context/context.py +72 -2
  36. teradataml/data/complaints_test_tokenized.csv +353 -0
  37. teradataml/data/complaints_tokens_model.csv +348 -0
  38. teradataml/data/covid_confirm_sd.csv +83 -0
  39. teradataml/data/dataframe_example.json +10 -0
  40. teradataml/data/docs/sqle/docs_17_20/CFilter.py +132 -0
  41. teradataml/data/docs/sqle/docs_17_20/NaiveBayes.py +162 -0
  42. teradataml/data/docs/sqle/docs_17_20/OutlierFilterFit.py +2 -0
  43. teradataml/data/docs/sqle/docs_17_20/Pivoting.py +279 -0
  44. teradataml/data/docs/sqle/docs_17_20/Shap.py +197 -0
  45. teradataml/data/docs/sqle/docs_17_20/TDNaiveBayesPredict.py +189 -0
  46. teradataml/data/docs/sqle/docs_17_20/TFIDF.py +142 -0
  47. teradataml/data/docs/sqle/docs_17_20/Unpivoting.py +216 -0
  48. teradataml/data/docs/uaf/docs_17_20/ACF.py +1 -10
  49. teradataml/data/docs/uaf/docs_17_20/ArimaEstimate.py +1 -1
  50. teradataml/data/docs/uaf/docs_17_20/ArimaForecast.py +35 -5
  51. teradataml/data/docs/uaf/docs_17_20/ArimaValidate.py +3 -1
  52. teradataml/data/docs/uaf/docs_17_20/ArimaXEstimate.py +293 -0
  53. teradataml/data/docs/uaf/docs_17_20/AutoArima.py +354 -0
  54. teradataml/data/docs/uaf/docs_17_20/BreuschGodfrey.py +3 -2
  55. teradataml/data/docs/uaf/docs_17_20/BreuschPaganGodfrey.py +1 -1
  56. teradataml/data/docs/uaf/docs_17_20/Convolve.py +13 -10
  57. teradataml/data/docs/uaf/docs_17_20/Convolve2.py +4 -1
  58. teradataml/data/docs/uaf/docs_17_20/CumulPeriodogram.py +5 -4
  59. teradataml/data/docs/uaf/docs_17_20/DFFT2Conv.py +4 -4
  60. teradataml/data/docs/uaf/docs_17_20/DWT.py +235 -0
  61. teradataml/data/docs/uaf/docs_17_20/DWT2D.py +214 -0
  62. teradataml/data/docs/uaf/docs_17_20/DurbinWatson.py +1 -1
  63. teradataml/data/docs/uaf/docs_17_20/ExtractResults.py +1 -1
  64. teradataml/data/docs/uaf/docs_17_20/FilterFactory1d.py +160 -0
  65. teradataml/data/docs/uaf/docs_17_20/GenseriesSinusoids.py +1 -1
  66. teradataml/data/docs/uaf/docs_17_20/GoldfeldQuandt.py +9 -31
  67. teradataml/data/docs/uaf/docs_17_20/HoltWintersForecaster.py +4 -2
  68. teradataml/data/docs/uaf/docs_17_20/IDFFT2.py +1 -8
  69. teradataml/data/docs/uaf/docs_17_20/IDWT.py +236 -0
  70. teradataml/data/docs/uaf/docs_17_20/IDWT2D.py +226 -0
  71. teradataml/data/docs/uaf/docs_17_20/IQR.py +134 -0
  72. teradataml/data/docs/uaf/docs_17_20/LineSpec.py +1 -1
  73. teradataml/data/docs/uaf/docs_17_20/LinearRegr.py +2 -2
  74. teradataml/data/docs/uaf/docs_17_20/MAMean.py +3 -3
  75. teradataml/data/docs/uaf/docs_17_20/Matrix2Image.py +297 -0
  76. teradataml/data/docs/uaf/docs_17_20/MatrixMultiply.py +15 -6
  77. teradataml/data/docs/uaf/docs_17_20/PACF.py +0 -1
  78. teradataml/data/docs/uaf/docs_17_20/Portman.py +2 -2
  79. teradataml/data/docs/uaf/docs_17_20/PowerSpec.py +2 -2
  80. teradataml/data/docs/uaf/docs_17_20/Resample.py +9 -1
  81. teradataml/data/docs/uaf/docs_17_20/SAX.py +246 -0
  82. teradataml/data/docs/uaf/docs_17_20/SeasonalNormalize.py +17 -10
  83. teradataml/data/docs/uaf/docs_17_20/SignifPeriodicities.py +1 -1
  84. teradataml/data/docs/uaf/docs_17_20/WhitesGeneral.py +3 -1
  85. teradataml/data/docs/uaf/docs_17_20/WindowDFFT.py +368 -0
  86. teradataml/data/dwt2d_dataTable.csv +65 -0
  87. teradataml/data/dwt_dataTable.csv +8 -0
  88. teradataml/data/dwt_filterTable.csv +3 -0
  89. teradataml/data/finance_data4.csv +13 -0
  90. teradataml/data/grocery_transaction.csv +19 -0
  91. teradataml/data/idwt2d_dataTable.csv +5 -0
  92. teradataml/data/idwt_dataTable.csv +8 -0
  93. teradataml/data/idwt_filterTable.csv +3 -0
  94. teradataml/data/interval_data.csv +5 -0
  95. teradataml/data/jsons/paired_functions.json +14 -0
  96. teradataml/data/jsons/sqle/17.20/TD_CFilter.json +118 -0
  97. teradataml/data/jsons/sqle/17.20/TD_NaiveBayes.json +193 -0
  98. teradataml/data/jsons/sqle/17.20/TD_NaiveBayesPredict.json +212 -0
  99. teradataml/data/jsons/sqle/17.20/TD_OneClassSVM.json +9 -9
  100. teradataml/data/jsons/sqle/17.20/TD_Pivoting.json +280 -0
  101. teradataml/data/jsons/sqle/17.20/TD_Shap.json +222 -0
  102. teradataml/data/jsons/sqle/17.20/TD_TFIDF.json +162 -0
  103. teradataml/data/jsons/sqle/17.20/TD_Unpivoting.json +235 -0
  104. teradataml/data/jsons/storedprocedure/17.20/TD_FILTERFACTORY1D.json +150 -0
  105. teradataml/data/jsons/uaf/17.20/TD_ACF.json +1 -18
  106. teradataml/data/jsons/uaf/17.20/TD_ARIMAESTIMATE.json +3 -16
  107. teradataml/data/jsons/uaf/17.20/TD_ARIMAFORECAST.json +0 -3
  108. teradataml/data/jsons/uaf/17.20/TD_ARIMAVALIDATE.json +5 -3
  109. teradataml/data/jsons/uaf/17.20/TD_ARIMAXESTIMATE.json +362 -0
  110. teradataml/data/jsons/uaf/17.20/TD_AUTOARIMA.json +469 -0
  111. teradataml/data/jsons/uaf/17.20/TD_BINARYMATRIXOP.json +0 -3
  112. teradataml/data/jsons/uaf/17.20/TD_BINARYSERIESOP.json +0 -2
  113. teradataml/data/jsons/uaf/17.20/TD_BREUSCH_GODFREY.json +2 -1
  114. teradataml/data/jsons/uaf/17.20/TD_BREUSCH_PAGAN_GODFREY.json +2 -5
  115. teradataml/data/jsons/uaf/17.20/TD_CONVOLVE.json +3 -6
  116. teradataml/data/jsons/uaf/17.20/TD_CONVOLVE2.json +1 -3
  117. teradataml/data/jsons/uaf/17.20/TD_CUMUL_PERIODOGRAM.json +0 -5
  118. teradataml/data/jsons/uaf/17.20/TD_DFFT.json +1 -4
  119. teradataml/data/jsons/uaf/17.20/TD_DFFT2.json +2 -7
  120. teradataml/data/jsons/uaf/17.20/TD_DFFT2CONV.json +1 -2
  121. teradataml/data/jsons/uaf/17.20/TD_DFFTCONV.json +0 -2
  122. teradataml/data/jsons/uaf/17.20/TD_DTW.json +3 -6
  123. teradataml/data/jsons/uaf/17.20/TD_DWT.json +173 -0
  124. teradataml/data/jsons/uaf/17.20/TD_DWT2D.json +160 -0
  125. teradataml/data/jsons/uaf/17.20/TD_FITMETRICS.json +1 -1
  126. teradataml/data/jsons/uaf/17.20/TD_GOLDFELD_QUANDT.json +16 -30
  127. teradataml/data/jsons/uaf/17.20/{TD_HOLT_WINTERS_FORECAST.json → TD_HOLT_WINTERS_FORECASTER.json} +1 -2
  128. teradataml/data/jsons/uaf/17.20/TD_IDFFT2.json +1 -15
  129. teradataml/data/jsons/uaf/17.20/TD_IDWT.json +162 -0
  130. teradataml/data/jsons/uaf/17.20/TD_IDWT2D.json +149 -0
  131. teradataml/data/jsons/uaf/17.20/TD_IQR.json +117 -0
  132. teradataml/data/jsons/uaf/17.20/TD_LINEAR_REGR.json +1 -1
  133. teradataml/data/jsons/uaf/17.20/TD_LINESPEC.json +1 -1
  134. teradataml/data/jsons/uaf/17.20/TD_MAMEAN.json +1 -3
  135. teradataml/data/jsons/uaf/17.20/TD_MATRIX2IMAGE.json +209 -0
  136. teradataml/data/jsons/uaf/17.20/TD_PACF.json +2 -2
  137. teradataml/data/jsons/uaf/17.20/TD_POWERSPEC.json +5 -5
  138. teradataml/data/jsons/uaf/17.20/TD_RESAMPLE.json +48 -28
  139. teradataml/data/jsons/uaf/17.20/TD_SAX.json +208 -0
  140. teradataml/data/jsons/uaf/17.20/TD_SEASONALNORMALIZE.json +12 -6
  141. teradataml/data/jsons/uaf/17.20/TD_SIMPLEEXP.json +0 -1
  142. teradataml/data/jsons/uaf/17.20/TD_TRACKINGOP.json +8 -8
  143. teradataml/data/jsons/uaf/17.20/TD_UNDIFF.json +1 -1
  144. teradataml/data/jsons/uaf/17.20/TD_UNNORMALIZE.json +1 -1
  145. teradataml/data/jsons/uaf/17.20/TD_WINDOWDFFT.json +400 -0
  146. teradataml/data/load_example_data.py +8 -2
  147. teradataml/data/naivebayestextclassifier_example.json +1 -1
  148. teradataml/data/naivebayestextclassifierpredict_example.json +11 -0
  149. teradataml/data/peppers.png +0 -0
  150. teradataml/data/real_values.csv +14 -0
  151. teradataml/data/sax_example.json +8 -0
  152. teradataml/data/scripts/deploy_script.py +1 -1
  153. teradataml/data/scripts/sklearn/sklearn_fit.py +17 -10
  154. teradataml/data/scripts/sklearn/sklearn_fit_predict.py +2 -2
  155. teradataml/data/scripts/sklearn/sklearn_function.template +30 -7
  156. teradataml/data/scripts/sklearn/sklearn_neighbors.py +1 -1
  157. teradataml/data/scripts/sklearn/sklearn_score.py +12 -3
  158. teradataml/data/scripts/sklearn/sklearn_transform.py +55 -4
  159. teradataml/data/star_pivot.csv +8 -0
  160. teradataml/data/templates/open_source_ml.json +2 -1
  161. teradataml/data/teradataml_example.json +20 -1
  162. teradataml/data/timestamp_data.csv +4 -0
  163. teradataml/data/titanic_dataset_unpivoted.csv +19 -0
  164. teradataml/data/uaf_example.json +55 -1
  165. teradataml/data/unpivot_example.json +15 -0
  166. teradataml/data/url_data.csv +9 -0
  167. teradataml/data/windowdfft.csv +16 -0
  168. teradataml/dataframe/copy_to.py +1 -1
  169. teradataml/dataframe/data_transfer.py +5 -3
  170. teradataml/dataframe/dataframe.py +474 -41
  171. teradataml/dataframe/fastload.py +3 -3
  172. teradataml/dataframe/functions.py +339 -0
  173. teradataml/dataframe/row.py +160 -0
  174. teradataml/dataframe/setop.py +2 -2
  175. teradataml/dataframe/sql.py +658 -20
  176. teradataml/dataframe/window.py +1 -1
  177. teradataml/dbutils/dbutils.py +322 -16
  178. teradataml/geospatial/geodataframe.py +1 -1
  179. teradataml/geospatial/geodataframecolumn.py +1 -1
  180. teradataml/hyperparameter_tuner/optimizer.py +13 -13
  181. teradataml/lib/aed_0_1.dll +0 -0
  182. teradataml/opensource/sklearn/_sklearn_wrapper.py +154 -69
  183. teradataml/options/__init__.py +3 -1
  184. teradataml/options/configure.py +14 -2
  185. teradataml/options/display.py +2 -2
  186. teradataml/plot/axis.py +4 -4
  187. teradataml/scriptmgmt/UserEnv.py +10 -6
  188. teradataml/scriptmgmt/lls_utils.py +3 -2
  189. teradataml/table_operators/Script.py +2 -2
  190. teradataml/table_operators/TableOperator.py +106 -20
  191. teradataml/table_operators/table_operator_util.py +88 -41
  192. teradataml/table_operators/templates/dataframe_udf.template +63 -0
  193. teradataml/telemetry_utils/__init__.py +0 -0
  194. teradataml/telemetry_utils/queryband.py +52 -0
  195. teradataml/utils/validators.py +1 -1
  196. {teradataml-20.0.0.1.dist-info → teradataml-20.0.0.2.dist-info}/METADATA +115 -2
  197. {teradataml-20.0.0.1.dist-info → teradataml-20.0.0.2.dist-info}/RECORD +200 -140
  198. {teradataml-20.0.0.1.dist-info → teradataml-20.0.0.2.dist-info}/WHEEL +0 -0
  199. {teradataml-20.0.0.1.dist-info → teradataml-20.0.0.2.dist-info}/top_level.txt +0 -0
  200. {teradataml-20.0.0.1.dist-info → teradataml-20.0.0.2.dist-info}/zip-safe +0 -0
@@ -0,0 +1,189 @@
1
+ def TDNaiveBayesPredict(data = None, object = None, id_column = None,
2
+ numeric_inputs = None, categorical_inputs = None,
3
+ attribute_name_column = None, attribute_value_column = None,
4
+ responses = None, output_prob = False, accumulate = None,
5
+ **generic_arguments):
6
+ """
7
+ DESCRIPTION:
8
+ Function predicts classification label using model generated by NaiveBayes function
9
+ for a test set of data.
10
+
11
+ PARAMETERS:
12
+ data:
13
+ Required Argument.
14
+ Specifies the input teradataml DataFrame.
15
+ Types: teradataml DataFrame
16
+
17
+ object:
18
+ Required Argument.
19
+ Specifies the teradataml DataFrame containing the model data
20
+ or instance of NaiveBayes.
21
+ Types: teradataml DataFrame or NaiveBayes
22
+
23
+ id_column:
24
+ Required Argument.
25
+ Specifies the name of the column that uniquely identifies an
26
+ observation in the "data".
27
+ Types: str
28
+
29
+ numeric_inputs:
30
+ Optional Argument.
31
+ Specifies the name of the columns in "data" containing numeric attributes values.
32
+ Types: str OR list of Strings (str)
33
+
34
+ categorical_inputs:
35
+ Optional Argument.
36
+ Specifies the name of the columns in "data" containing categorical attributes values.
37
+ Types: str OR list of Strings (str)
38
+
39
+ attribute_name_column:
40
+ Optional Argument.
41
+ Specifies the name of the columns in "data" containing attributes names.
42
+ Types: str
43
+
44
+ attribute_value_column:
45
+ Optional Argument.
46
+ Specifies the name of the columns in "data" containing attributes values.
47
+ Types: str
48
+
49
+ responses:
50
+ Optional Argument.
51
+ Specifies a list of responses to output.
52
+ Types: str OR list of strs
53
+
54
+ output_prob:
55
+ Optional Argument.
56
+ Specifies whether to output the probability for each response.
57
+ Default Value: False
58
+ Types: bool
59
+
60
+ accumulate:
61
+ Optional Argument.
62
+ Specify the names of the columns in "data" that need to be copied
63
+ from the input to output teradataml DataFrame.
64
+ Types: str OR list of Strings (str)
65
+
66
+ **generic_arguments:
67
+ Specifies the generic keyword arguments SQLE functions accept. Below
68
+ are the generic keyword arguments:
69
+ persist:
70
+ Optional Argument.
71
+ Specifies whether to persist the results of the
72
+ function in a table or not. When set to True,
73
+ results are persisted in a table; otherwise,
74
+ results are garbage collected at the end of the
75
+ session.
76
+ Default Value: False
77
+ Types: bool
78
+
79
+ volatile:
80
+ Optional Argument.
81
+ Specifies whether to put the results of the
82
+ function in a volatile table or not. When set to
83
+ True, results are stored in a volatile table,
84
+ otherwise not.
85
+ Default Value: False
86
+ Types: bool
87
+
88
+ Function allows the user to partition, hash, order or local
89
+ order the input data. These generic arguments are available
90
+ for each argument that accepts teradataml DataFrame as
91
+ input and can be accessed as:
92
+ * "<input_data_arg_name>_partition_column" accepts str or
93
+ list of str (Strings)
94
+ * "<input_data_arg_name>_hash_column" accepts str or list
95
+ of str (Strings)
96
+ * "<input_data_arg_name>_order_column" accepts str or list
97
+ of str (Strings)
98
+ * "local_order_<input_data_arg_name>" accepts boolean
99
+ Note:
100
+ These generic arguments are supported by teradataml if
101
+ the underlying SQL Engine function supports, else an
102
+ exception is raised.
103
+
104
+ RETURNS:
105
+ Instance of NaiveBayesPredict.
106
+ Output teradataml DataFrames can be accessed using attribute
107
+ references, such as NaiveBayesPredictObj.<attribute_name>.
108
+ Output teradataml DataFrame attribute name is:
109
+ result
110
+
111
+
112
+ RAISES:
113
+ TeradataMlException, TypeError, ValueError
114
+
115
+
116
+ EXAMPLES:
117
+ # Notes:
118
+ # 1. Get the connection to Vantage, before importing the
119
+ # function in user space.
120
+ # 2. User can import the function, if it is available on
121
+ # Vantage user is connected to.
122
+ # 3. To check the list of analytic functions available on
123
+ # Vantage user connected to, use
124
+ # "display_analytic_functions()".
125
+
126
+ # Load the example data.
127
+ load_example_data("decisionforestpredict", ["housing_train", "housing_test"])
128
+
129
+ # Create teradataml DataFrame objects.
130
+ housing_train = DataFrame.from_table("housing_train")
131
+ housing_test = DataFrame.from_table("housing_test")
132
+
133
+ # Check the list of available analytic functions.
134
+ display_analytic_functions()
135
+
136
+ # Import function NaiveBayesPredict.
137
+ from teradataml import NaiveBayesPredict
138
+
139
+ # Example 1: NaiveBayesPredict function to predict the classification label using Dense input.
140
+ NaiveBayes_out = NaiveBayes(data=housing_train, response_column='homestyle',
141
+ numeric_inputs=['price','lotsize','bedrooms','bathrms','stories','garagepl'],
142
+ categorical_inputs=['driveway','recroom','fullbase','gashw','airco','prefarea'])
143
+
144
+ NaiveBayesPredict_out = TDNaiveBayesPredict(data=housing_test, object=NaiveBayes_out.result, id_column='sn',
145
+ numeric_inputs=['price','lotsize','bedrooms','bathrms','stories','garagepl'],
146
+ categorical_inputs=['driveway','recroom','fullbase','gashw','airco','prefarea'],
147
+ responses=['Classic', 'Eclectic', 'bungalow'],
148
+ accumulate='homestyle',
149
+ output_prob=True
150
+ )
151
+
152
+ # Print the result DataFrame.
153
+ print( NaiveBayesPredict_out.result)
154
+
155
+ # Example 2: NaiveBayesPredict function to predict the classification label using Sparse input.
156
+
157
+ # Unpivoting the data for sparse input to naive bayes.
158
+ upvt_train = Unpivoting(data = housing_train, id_column = 'sn',
159
+ target_columns = ['price','lotsize','bedrooms','bathrms','stories','garagepl',
160
+ 'driveway','recroom','fullbase','gashw','airco','prefarea'],
161
+ attribute_column = "AttributeName",
162
+ value_column = "AttributeValue",
163
+ accumulate = 'homestyle')
164
+
165
+ upvt_test = Unpivoting(data = housing_test, id_column = 'sn',
166
+ target_columns = ['price','lotsize','bedrooms','bathrms','stories','garagepl','driveway',
167
+ 'recroom','fullbase','gashw','airco','prefarea'],
168
+ attribute_column = "AttributeName", value_column = "AttributeValue",
169
+ accumulate = 'homestyle')
170
+
171
+ NaiveBayes_out1 = NaiveBayes(data=upvt_train.result,
172
+ response_column='homestyle',
173
+ attribute_name_column='AttributeName',
174
+ attribute_value_column='AttributeValue',
175
+ numeric_attributes=['price','lotsize','bedrooms','bathrms','stories','garagepl'],
176
+ categorical_attributes=['driveway','recroom','fullbase','gashw','airco','prefarea'])
177
+
178
+ NaiveBayesPredict_out1 = TDNaiveBayesPredict(data=upvt_test.result, object=NaiveBayes_out1, id_column='sn',
179
+ attribute_name_column='AttributeName',
180
+ attribute_value_column='AttributeValue',
181
+ responses=['Classic', 'Eclectic', 'bungalow'],
182
+ accumulate='homestyle',
183
+ output_prob=True
184
+ )
185
+
186
+ # Print the result DataFrame.
187
+ print( NaiveBayesPredict_out1.result)
188
+
189
+ """
@@ -0,0 +1,142 @@
1
+ def TFIDF(data = None, doc_id_column = None, token_column = None,
2
+ tf_normalization = "NORMAL", idf_normalization = "LOG",
3
+ regularization = "NONE", accumulate = None,
4
+ **generic_arguments):
5
+
6
+ """
7
+ DESCRIPTION:
8
+ Function takes any document set and computes the Term Frequency (TF),
9
+ Inverse Document Frequency (IDF), and Term Frequency Inverse Document
10
+ Frequency (TF-IDF) scores for each term.
11
+
12
+ PARAMETERS:
13
+ data:
14
+ Required Argument.
15
+ Specifies the input teradataml DataFrame that contains
16
+ the document id and the term.
17
+ Types: teradataml DataFrame
18
+
19
+ doc_id_column:
20
+ Required Argument.
21
+ Specifies the name of the column in "data" that contains the
22
+ document identifier.
23
+ Types: str
24
+
25
+ token_column:
26
+ Required Argument.
27
+ Specifies the name of the column in "data" that contains the tokens.
28
+ Types: str
29
+
30
+ tf_normalization:
31
+ Optional Argument.
32
+ Specifies the normalization method for calculating the term frequency (TF).
33
+ Default Value: "NORMAL"
34
+ Permitted Values: BOOL, COUNT, NORMAL, LOG, AUGMENT
35
+ Types: str
36
+
37
+ idf_normalization:
38
+ Optional Argument.
39
+ Specifies the normalization method for calculating the inverse
40
+ document frequency (IDF).
41
+ Default Value: "LOG"
42
+ Permitted Values: UNARY, LOG, LOGNORM, SMOOTH
43
+ Types: str
44
+
45
+ regularization:
46
+ Optional Argument.
47
+ Specifies the regularization method for calculating the TF-IDF score.
48
+ Default Value: "NONE"
49
+ Permitted Values: L2, L1, NONE
50
+ Types: str
51
+
52
+ accumulate:
53
+ Optional Argument.
54
+ Specifies the name(s) of input teradataml DataFrame column(s) to copy to the
55
+ output.
56
+ Types: str OR list of Strings (str)
57
+
58
+ **generic_arguments:
59
+ Specifies the generic keyword arguments SQLE functions accept. Below
60
+ are the generic keyword arguments:
61
+ persist:
62
+ Optional Argument.
63
+ Specifies whether to persist the results of the
64
+ function in a table or not. When set to True,
65
+ results are persisted in a table; otherwise,
66
+ results are garbage collected at the end of the
67
+ session.
68
+ Default Value: False
69
+ Types: bool
70
+
71
+ volatile:
72
+ Optional Argument.
73
+ Specifies whether to put the results of the
74
+ function in a volatile table or not. When set to
75
+ True, results are stored in a volatile table,
76
+ otherwise not.
77
+ Default Value: False
78
+ Types: bool
79
+
80
+ Function allows the user to partition, hash, order or local
81
+ order the input data. These generic arguments are available
82
+ for each argument that accepts teradataml DataFrame as
83
+ input and can be accessed as:
84
+ * "<input_data_arg_name>_partition_column" accepts str or
85
+ list of str (Strings)
86
+ * "<input_data_arg_name>_hash_column" accepts str or list
87
+ of str (Strings)
88
+ * "<input_data_arg_name>_order_column" accepts str or list
89
+ of str (Strings)
90
+ * "local_order_<input_data_arg_name>" accepts boolean
91
+ Note:
92
+ These generic arguments are supported by teradataml if
93
+ the underlying SQL Engine function supports, else an
94
+ exception is raised.
95
+
96
+ RETURNS:
97
+ Instance of TFIDF.
98
+ Output teradataml DataFrames can be accessed using attribute
99
+ references, such as TFIDFObj.<attribute_name>.
100
+ Output teradataml DataFrame attribute name is:
101
+ result
102
+
103
+
104
+ RAISES:
105
+ TeradataMlException, TypeError, ValueError
106
+
107
+
108
+ EXAMPLES:
109
+ # Notes:
110
+ # 1. Get the connection to Vantage, before importing the
111
+ # function in user space.
112
+ # 2. User can import the function, if it is available on
113
+ # Vantage user is connected to.
114
+ # 3. To check the list of analytic functions available on
115
+ # Vantage user connected to, use
116
+ # "display_analytic_functions()".
117
+
118
+ # Load the example data.
119
+ load_example_data('naivebayestextclassifier',"token_table")
120
+
121
+ # Create teradataml DataFrame objects.
122
+ inp = DataFrame.from_table('token_table')
123
+
124
+ # Check the list of available analytic functions.
125
+ display_analytic_functions()
126
+
127
+ # Import function TFIDF.
128
+ from teradataml import TFIDF
129
+
130
+ # Example 1 : Compute the TF, IDF and TF-IDF scores
131
+ # for each term in the input data.
132
+ TFIDF_out = TFIDF(data=inp,
133
+ doc_id_column='doc_id',
134
+ token_column='token',
135
+ tf_normalization = "LOG",
136
+ idf_normalization = "SMOOTH",
137
+ regularization = "L2",
138
+ accumulate=['category'])
139
+
140
+ # Print the result DataFrame.
141
+ print(TFIDF_out.result)
142
+ """
@@ -0,0 +1,216 @@
1
+ def Unpivoting(data = None, id_column = None, target_columns = None,
2
+ alias_names = None, attribute_column = "AttributeName", value_column = "AttributeValue",
3
+ accumulate = None, include_nulls = False, input_types = False, output_varchar = False,
4
+ indexed_attribute = False, include_datatypes = False,
5
+ **generic_arguments):
6
+
7
+ """
8
+ DESCRIPTION:
9
+ Function unpivots the data, that is, changes the data from
10
+ dense format to sparse format.
11
+
12
+ PARAMETERS:
13
+ data:
14
+ Required Argument.
15
+ Specifies the input teradataml DataFrame.
16
+ Types: teradataml DataFrame
17
+
18
+ id_column:
19
+ Required Argument.
20
+ Specifies the name of the column in "data" which contains the input data identifier.
21
+ Types: str
22
+
23
+ target_columns:
24
+ Required Argument.
25
+ Specifies the name(s) of input teradataml DataFrame column(s) which contains the data for
26
+ unpivoting.
27
+ Types: str OR list of Strings (str)
28
+
29
+ Optional Argument.
30
+ Specifies alternate names for the values in the 'attribute_column'.
31
+ Types: str OR list of strs
32
+
33
+ alias_names:
34
+ Optional Argument.
35
+ Specifies alternate names for the values in the 'attribute_column'.
36
+ column.
37
+ Types: str OR list of strs
38
+
39
+ attribute_column:
40
+ Optional Argument.
41
+ Specifies the name of the column in the output DataFrame, which holds the names of pivoted columns.
42
+ Default Value: "AttributeName"
43
+ Types: str
44
+
45
+ value_column:
46
+ Optional Argument.
47
+ Specifies the name of the column in the output DataFrame, which holds the values of pivoted columns.
48
+ Default Value: "AttributeValue"
49
+ Types: str
50
+
51
+ accumulate:
52
+ Optional Argument.
53
+ Specifies the name(s) of input teradataml DataFrame column(s) to copy to the output.
54
+ By default, the function copies no input teradataml DataFrame columns to the output.
55
+ Types: str OR list of Strings (str)
56
+
57
+ include_nulls:
58
+ Optional Argument.
59
+ Specifies whether or not to include nulls in the transformation.
60
+ Default Value: False
61
+ Types: bool
62
+
63
+ input_types:
64
+ Optional Argument.
65
+ Specifies whether attribute values should be organized into multiple columns based on data type groups.
66
+ Note:
67
+ * 'input_types' argument cannot be used when output_varchar is set to True.
68
+ Default Value: False
69
+ Types: bool
70
+
71
+ output_varchar:
72
+ Optional Argument.
73
+ Specifies whether to output the 'value_column' in varchar format regardless of its data type.
74
+ Note:
75
+ * 'output_varchar' argument cannot be used when input_types is set to True.
76
+ Default Value: False
77
+ Types: bool
78
+
79
+ indexed_attribute:
80
+ Optional Argument.
81
+ Specifies whether to output the column indexes instead of column names in AttributeName column.
82
+ When set to True, outputs the column indexes instead of column names.
83
+ Default Value: False
84
+ Types: bool
85
+
86
+ include_datatypes:
87
+ Optional Argument.
88
+ Specifies whether to output the original datatype name. When set to True,
89
+ outputs the original datatype name.
90
+ Default Value: False
91
+ Types: bool
92
+
93
+ **generic_arguments:
94
+ Specifies the generic keyword arguments SQLE functions accept. Below
95
+ are the generic keyword arguments:
96
+ persist:
97
+ Optional Argument.
98
+ Specifies whether to persist the results of the
99
+ function in a table or not. When set to True,
100
+ results are persisted in a table; otherwise,
101
+ results are garbage collected at the end of the
102
+ session.
103
+ Default Value: False
104
+ Types: bool
105
+
106
+ volatile:
107
+ Optional Argument.
108
+ Specifies whether to put the results of the
109
+ function in a volatile table or not. When set to
110
+ True, results are stored in a volatile table,
111
+ otherwise not.
112
+ Default Value: False
113
+ Types: bool
114
+
115
+ Function allows the user to partition, hash, order or local
116
+ order the input data. These generic arguments are available
117
+ for each argument that accepts teradataml DataFrame as
118
+ input and can be accessed as:
119
+ * "<input_data_arg_name>_partition_column" accepts str or
120
+ list of str (Strings)
121
+ * "<input_data_arg_name>_hash_column" accepts str or list
122
+ of str (Strings)
123
+ * "<input_data_arg_name>_order_column" accepts str or list
124
+ of str (Strings)
125
+ * "local_order_<input_data_arg_name>" accepts boolean
126
+ Note:
127
+ These generic arguments are supported by teradataml if
128
+ the underlying SQL Engine function supports, else an
129
+ exception is raised.
130
+
131
+ RETURNS:
132
+ Instance of Unpivoting.
133
+ Output teradataml DataFrames can be accessed using attribute
134
+ references, such as UnpivotingObj.<attribute_name>.
135
+ Output teradataml DataFrame attribute name is:
136
+ result
137
+
138
+
139
+ RAISES:
140
+ TeradataMlException, TypeError, ValueError
141
+
142
+
143
+ EXAMPLES:
144
+ # Notes:
145
+ # 1. Get the connection to Vantage, before importing the
146
+ # function in user space.
147
+ # 2. User can import the function, if it is available on
148
+ # Vantage user is connected to.
149
+ # 3. To check the list of analytic functions available on
150
+ # Vantage user connected to, use
151
+ # "display_analytic_functions()".
152
+
153
+ # Load the example data.
154
+ load_example_data('unpivot', 'unpivot_input')
155
+
156
+ # Create teradataml DataFrame objects.
157
+ upvt_inp = DataFrame('unpivot_input')
158
+
159
+ # Check the list of available analytic functions.
160
+ display_analytic_functions()
161
+
162
+ # Import function Unpivoting.
163
+ from teradataml import Unpivoting
164
+
165
+ # Example 1 : Unpivot the data.
166
+ upvt1 = Unpivoting(data = upvt_inp,
167
+ id_column = 'sn',
168
+ target_columns = 'city',
169
+ accumulate = 'week',
170
+ include_nulls = True)
171
+
172
+ # Print the result DataFrame.
173
+ print( upvt1.result)
174
+
175
+ # Example 2 : Unpivot the data with alternate names for the values in
176
+ # the AttributeName output column.
177
+ upvt2= Unpivoting(data = upvt_inp,
178
+ id_column = 'sn',
179
+ target_columns = 'city',
180
+ alias_names = 'city_us',
181
+ attribute_column = "Attribute",
182
+ value_column = "value",
183
+ accumulate = 'week',
184
+ include_nulls = True)
185
+
186
+ # Print the result DataFrame.
187
+ print( upvt2.result)
188
+
189
+ # Example 3 : Unpivot the data with multiple target columns and output
190
+ # data types.
191
+ upvt3 = Unpivoting(data = upvt_inp,
192
+ id_column = 'sn',
193
+ target_columns = ['city','pressure'],
194
+ attribute_column = "Attribute",
195
+ value_column = "value",
196
+ accumulate = 'week',
197
+ include_nulls = True,
198
+ indexed_attribute = True,
199
+ include_datatypes = True)
200
+
201
+ # Print the result DataFrame.
202
+ print( upvt3.result)
203
+
204
+ # Example 4 : Unpivot the data with multiple target columns and output
205
+ # the input types.
206
+ upvt4 = Unpivoting(data = upvt_inp,
207
+ id_column = 'sn',
208
+ target_columns = ['city','temp'],
209
+ accumulate = 'week',
210
+ include_nulls = True,
211
+ input_types = True)
212
+
213
+ # Print the result DataFrame.
214
+ print( upvt4.result)
215
+
216
+ """
@@ -1,6 +1,6 @@
1
1
  def ACF(data=None, data_filter_expr=None, max_lags=None,
2
2
  func_type=False, unbiased=False, demean=True,
3
- qstat=False, alpha=None, round_results=False,
3
+ qstat=False, alpha=None,
4
4
  **generic_arguments):
5
5
  """
6
6
  DESCRIPTION:
@@ -96,15 +96,6 @@ def ACF(data=None, data_filter_expr=None, max_lags=None,
96
96
  * The function does not return confidence intervals.
97
97
  Types: float
98
98
 
99
- round_results:
100
- Optional Argument.
101
- Specifies whether rounding should be done or not.
102
- When set to True, results in the output row are
103
- rounded before inserting the rows into dataframe,
104
- otherwise not.
105
- Default Value: False
106
- Types: bool
107
-
108
99
  **generic_arguments:
109
100
  Specifies the generic keyword arguments of UAF functions.
110
101
  Below are the generic keyword arguments:
@@ -312,7 +312,7 @@ def ArimaEstimate(data1=None, data1_filter_expr=None, data2=None,
312
312
  references, such as ArimaEstimate_obj.<attribute_name>.
313
313
  Output teradataml DataFrame attribute names are:
314
314
  1. result
315
- 2. fitmetadata - Available when "model_stats" is set to True, otherwise not.
315
+ 2. fitmetadata - Available when "fit_metrics" is set to True, otherwise not.
316
316
  3. fitresiduals - Available when "residuals" is set to True, otherwise not.
317
317
  4. model
318
318
  5. valdata
@@ -118,6 +118,9 @@ def ArimaForecast(data=None, data_filter_expr=None, forecast_periods=None,
118
118
  payload_field="magnitude",
119
119
  payload_content="REAL")
120
120
 
121
+ # Example 1: Forecast 2 periods based on the model fitted by ArimaEstimate.
122
+ # As the fit_percentage is greater than or equal to 100,
123
+ # output of ArimaEstimate is used for ArimaForecast.
121
124
  # Execute ArimaEstimate function.
122
125
  arima_estimate_op = ArimaEstimate(data1=data_series_df,
123
126
  nonseasonal_model_order=[2,0,0],
@@ -128,15 +131,42 @@ def ArimaForecast(data=None, data_filter_expr=None, forecast_periods=None,
128
131
  residuals=True,
129
132
  fit_percentage=100)
130
133
 
131
- # Example 1: Forecast 2 periods based on the model fitted by ArimaEstimate.
132
- # As the fit_percentage is greater than or equal to 100,
133
- # output of ArimaEstimate is used for ArimaForecast.
134
-
135
134
  # Create teradataml TDAnalyticResult object over the result attribute of 'arima_estimate_op'
136
135
  data_art_df = TDAnalyticResult(data=arima_estimate_op.result)
137
136
 
138
- uaf_out = ArimaForecast(data=data_art_df, forecast_periods=2)
137
+ uaf_out = ArimaForecast(data=data_art_df,
138
+ forecast_periods=2)
139
139
 
140
140
  # Print the result DataFrame.
141
141
  print(uaf_out.result)
142
+
143
+ # Example 2: Forecast 2 periods based on the model fitted by ArimaValidate.
144
+ # As the fit_percentage is less than 100,
145
+ # output of ArimaEstimate is used for ArimaValidate and
146
+ # output of ArimaValidate is used for ArimaForecast.
147
+ # Execute ArimaEstimate function.
148
+ arima_estimate_op = ArimaEstimate(data1=data_series_df,
149
+ nonseasonal_model_order=[2,0,0],
150
+ constant=False,
151
+ algorithm="MLE",
152
+ coeff_stats=True,
153
+ fit_metrics=True,
154
+ residuals=True,
155
+ fit_percentage=80)
156
+
157
+ # Create TDAnalyticResult object over the result attribute of 'arima_estimate_op'.
158
+ data_art_df = TDAnalyticResult(data=arima_estimate_op.result)
159
+
160
+ # Execute ArimaValidate function.
161
+ arima_validate_op = ArimaValidate(data=data_art_df,
162
+ fit_metrics=TRUE,
163
+ residuals=TRUE)
164
+
165
+ data_art_df1 = TDAnalyticResult(data=arima_validate_op.result)
166
+
167
+ uaf_out = ArimaForecast(data=data_art_df1,
168
+ forecast_periods=2)
169
+
170
+ # Print the result DataFrames.
171
+ print(uaf_out.result)
142
172
  """
@@ -149,7 +149,9 @@ def ArimaValidate(data=None, data_filter_expr=None, fit_metrics=False,
149
149
  # Create teradataml TDAnalyticResult object over the result attribute of 'arima_estimate_op'.
150
150
  data_art_df = TDAnalyticResult(data=arima_estimate_op.result)
151
151
 
152
- uaf_out = ArimaValidate(data=data_art_df, fit_metrics=True, residuals=True)
152
+ uaf_out = ArimaValidate(data=data_art_df,
153
+ fit_metrics=True,
154
+ residuals=True)
153
155
 
154
156
  # Print the result DataFrames.
155
157
  print(uaf_out.result)