teradataml 20.0.0.3__py3-none-any.whl → 20.0.0.5__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/LICENSE-3RD-PARTY.pdf +0 -0
- teradataml/README.md +193 -1
- teradataml/__init__.py +2 -1
- teradataml/_version.py +2 -2
- teradataml/analytics/analytic_function_executor.py +25 -18
- teradataml/analytics/byom/__init__.py +1 -1
- teradataml/analytics/json_parser/analytic_functions_argument.py +4 -0
- teradataml/analytics/sqle/__init__.py +20 -2
- teradataml/analytics/utils.py +15 -1
- teradataml/analytics/valib.py +18 -4
- teradataml/automl/__init__.py +341 -112
- teradataml/automl/autodataprep/__init__.py +471 -0
- teradataml/automl/data_preparation.py +84 -42
- teradataml/automl/data_transformation.py +69 -33
- teradataml/automl/feature_engineering.py +76 -9
- teradataml/automl/feature_exploration.py +639 -25
- teradataml/automl/model_training.py +35 -14
- teradataml/clients/auth_client.py +2 -2
- teradataml/common/__init__.py +1 -2
- teradataml/common/constants.py +122 -63
- teradataml/common/messagecodes.py +14 -3
- teradataml/common/messages.py +8 -4
- teradataml/common/sqlbundle.py +40 -10
- teradataml/common/utils.py +366 -74
- teradataml/common/warnings.py +11 -0
- teradataml/context/context.py +348 -86
- teradataml/data/amazon_reviews_25.csv +26 -0
- teradataml/data/apriori_example.json +22 -0
- teradataml/data/byom_example.json +11 -0
- teradataml/data/docs/byom/docs/DataRobotPredict.py +2 -2
- teradataml/data/docs/byom/docs/DataikuPredict.py +40 -1
- teradataml/data/docs/byom/docs/H2OPredict.py +2 -2
- teradataml/data/docs/byom/docs/ONNXEmbeddings.py +242 -0
- teradataml/data/docs/byom/docs/ONNXPredict.py +2 -2
- teradataml/data/docs/byom/docs/PMMLPredict.py +2 -2
- teradataml/data/docs/sqle/docs_17_20/Apriori.py +138 -0
- teradataml/data/docs/sqle/docs_17_20/NERExtractor.py +121 -0
- teradataml/data/docs/sqle/docs_17_20/NGramSplitter.py +3 -3
- teradataml/data/docs/sqle/docs_17_20/SMOTE.py +212 -0
- teradataml/data/docs/sqle/docs_17_20/Shap.py +28 -6
- teradataml/data/docs/sqle/docs_17_20/TextMorph.py +119 -0
- teradataml/data/docs/sqle/docs_17_20/TextParser.py +54 -3
- teradataml/data/docs/uaf/docs_17_20/ACF.py +1 -1
- teradataml/data/docs/uaf/docs_17_20/ArimaEstimate.py +2 -2
- teradataml/data/docs/uaf/docs_17_20/ArimaXEstimate.py +2 -2
- teradataml/data/docs/uaf/docs_17_20/DFFT.py +1 -1
- teradataml/data/docs/uaf/docs_17_20/DFFT2.py +1 -1
- teradataml/data/docs/uaf/docs_17_20/DFFT2Conv.py +1 -1
- teradataml/data/docs/uaf/docs_17_20/DFFTConv.py +1 -1
- teradataml/data/docs/uaf/docs_17_20/DWT2D.py +4 -1
- teradataml/data/docs/uaf/docs_17_20/FilterFactory1d.py +4 -4
- teradataml/data/docs/uaf/docs_17_20/GenseriesSinusoids.py +2 -2
- teradataml/data/docs/uaf/docs_17_20/GoldfeldQuandt.py +2 -2
- teradataml/data/docs/uaf/docs_17_20/HoltWintersForecaster.py +6 -6
- teradataml/data/docs/uaf/docs_17_20/LineSpec.py +1 -1
- teradataml/data/docs/uaf/docs_17_20/LinearRegr.py +1 -1
- teradataml/data/docs/uaf/docs_17_20/Matrix2Image.py +4 -4
- teradataml/data/docs/uaf/docs_17_20/MultivarRegr.py +1 -1
- teradataml/data/docs/uaf/docs_17_20/PACF.py +1 -1
- teradataml/data/docs/uaf/docs_17_20/PowerSpec.py +2 -2
- teradataml/data/docs/uaf/docs_17_20/PowerTransform.py +3 -3
- teradataml/data/docs/uaf/docs_17_20/Resample.py +5 -5
- teradataml/data/docs/uaf/docs_17_20/SAX.py +3 -3
- teradataml/data/docs/uaf/docs_17_20/SignifPeriodicities.py +1 -1
- teradataml/data/docs/uaf/docs_17_20/SimpleExp.py +1 -1
- teradataml/data/docs/uaf/docs_17_20/Smoothma.py +3 -3
- teradataml/data/docs/uaf/docs_17_20/UNDIFF.py +1 -1
- teradataml/data/hnsw_alter_data.csv +5 -0
- teradataml/data/hnsw_data.csv +10 -0
- teradataml/data/jsons/byom/h2opredict.json +1 -1
- teradataml/data/jsons/byom/onnxembeddings.json +266 -0
- teradataml/data/jsons/sqle/17.20/NGramSplitter.json +6 -6
- teradataml/data/jsons/sqle/17.20/TD_Apriori.json +181 -0
- teradataml/data/jsons/sqle/17.20/TD_NERExtractor.json +145 -0
- teradataml/data/jsons/sqle/17.20/TD_SMOTE.json +267 -0
- teradataml/data/jsons/sqle/17.20/TD_Shap.json +0 -1
- teradataml/data/jsons/sqle/17.20/TD_TextMorph.json +134 -0
- teradataml/data/jsons/sqle/17.20/TD_TextParser.json +114 -9
- teradataml/data/jsons/sqle/20.00/AI_AnalyzeSentiment.json +328 -0
- teradataml/data/jsons/sqle/20.00/AI_AskLLM.json +420 -0
- teradataml/data/jsons/sqle/20.00/AI_DetectLanguage.json +343 -0
- teradataml/data/jsons/sqle/20.00/AI_ExtractKeyPhrases.json +328 -0
- teradataml/data/jsons/sqle/20.00/AI_MaskPII.json +328 -0
- teradataml/data/jsons/sqle/20.00/AI_RecognizeEntities.json +328 -0
- teradataml/data/jsons/sqle/20.00/AI_RecognizePIIEntities.json +328 -0
- teradataml/data/jsons/sqle/20.00/AI_TextClassifier.json +359 -0
- teradataml/data/jsons/sqle/20.00/AI_TextEmbeddings.json +360 -0
- teradataml/data/jsons/sqle/20.00/AI_TextSummarize.json +343 -0
- teradataml/data/jsons/sqle/20.00/AI_TextTranslate.json +343 -0
- teradataml/data/jsons/sqle/20.00/TD_HNSW.json +296 -0
- teradataml/data/jsons/sqle/20.00/TD_HNSWPredict.json +206 -0
- teradataml/data/jsons/sqle/20.00/TD_HNSWSummary.json +32 -0
- teradataml/data/jsons/sqle/20.00/TD_KMeans.json +2 -2
- teradataml/data/jsons/sqle/20.00/TD_SMOTE.json +3 -3
- teradataml/data/jsons/sqle/20.00/TD_VectorDistance.json +6 -6
- teradataml/data/ner_dict.csv +8 -0
- teradataml/data/ner_input_eng.csv +7 -0
- teradataml/data/ner_rule.csv +5 -0
- teradataml/data/pos_input.csv +40 -0
- teradataml/data/tdnerextractor_example.json +14 -0
- teradataml/data/teradataml_example.json +21 -0
- teradataml/data/textmorph_example.json +5 -0
- teradataml/data/to_num_data.csv +4 -0
- teradataml/data/tochar_data.csv +5 -0
- teradataml/data/trans_dense.csv +16 -0
- teradataml/data/trans_sparse.csv +55 -0
- teradataml/data/vectordistance_example.json +1 -1
- teradataml/dataframe/copy_to.py +45 -29
- teradataml/dataframe/data_transfer.py +72 -46
- teradataml/dataframe/dataframe.py +642 -166
- teradataml/dataframe/dataframe_utils.py +167 -22
- teradataml/dataframe/functions.py +135 -20
- teradataml/dataframe/setop.py +11 -6
- teradataml/dataframe/sql.py +330 -78
- teradataml/dbutils/dbutils.py +556 -140
- teradataml/dbutils/filemgr.py +14 -10
- teradataml/hyperparameter_tuner/optimizer.py +12 -1
- teradataml/lib/aed_0_1.dll +0 -0
- teradataml/opensource/{sklearn/_sklearn_wrapper.py → _base.py} +168 -1013
- teradataml/opensource/_class.py +141 -17
- teradataml/opensource/{constants.py → _constants.py} +7 -3
- teradataml/opensource/_lightgbm.py +52 -53
- teradataml/opensource/_sklearn.py +1008 -0
- teradataml/opensource/_wrapper_utils.py +5 -5
- teradataml/options/__init__.py +47 -15
- teradataml/options/configure.py +103 -26
- teradataml/options/display.py +13 -2
- teradataml/plot/axis.py +47 -8
- teradataml/plot/figure.py +33 -0
- teradataml/plot/plot.py +63 -13
- teradataml/scriptmgmt/UserEnv.py +307 -40
- teradataml/scriptmgmt/lls_utils.py +428 -145
- teradataml/store/__init__.py +2 -3
- teradataml/store/feature_store/feature_store.py +102 -7
- teradataml/table_operators/Apply.py +48 -19
- teradataml/table_operators/Script.py +23 -2
- teradataml/table_operators/TableOperator.py +3 -1
- teradataml/table_operators/table_operator_util.py +58 -9
- teradataml/utils/dtypes.py +49 -1
- teradataml/utils/internal_buffer.py +38 -0
- teradataml/utils/validators.py +377 -62
- {teradataml-20.0.0.3.dist-info → teradataml-20.0.0.5.dist-info}/METADATA +200 -4
- {teradataml-20.0.0.3.dist-info → teradataml-20.0.0.5.dist-info}/RECORD +146 -112
- teradataml/data/SQL_Fundamentals.pdf +0 -0
- teradataml/libaed_0_1.dylib +0 -0
- teradataml/libaed_0_1.so +0 -0
- teradataml/opensource/sklearn/__init__.py +0 -0
- teradataml/store/vector_store/__init__.py +0 -1586
- {teradataml-20.0.0.3.dist-info → teradataml-20.0.0.5.dist-info}/WHEEL +0 -0
- {teradataml-20.0.0.3.dist-info → teradataml-20.0.0.5.dist-info}/top_level.txt +0 -0
- {teradataml-20.0.0.3.dist-info → teradataml-20.0.0.5.dist-info}/zip-safe +0 -0
|
@@ -13,18 +13,18 @@
|
|
|
13
13
|
#
|
|
14
14
|
# ##################################################################
|
|
15
15
|
|
|
16
|
-
import time
|
|
17
16
|
import functools
|
|
17
|
+
import time
|
|
18
18
|
import uuid
|
|
19
|
-
|
|
20
19
|
from math import floor
|
|
20
|
+
|
|
21
21
|
from teradataml import TeradataMlException
|
|
22
|
+
from teradataml.common.aed_utils import AedUtils
|
|
22
23
|
from teradataml.common.messagecodes import MessageCodes
|
|
23
24
|
from teradataml.common.messages import Messages
|
|
24
|
-
from teradataml.common.aed_utils import AedUtils
|
|
25
|
-
from teradataml.dataframe.dataframe_utils import DataFrameUtils
|
|
26
|
-
from teradataml.dataframe.dataframe import DataFrame
|
|
27
25
|
from teradataml.common.utils import UtilFuncs
|
|
26
|
+
from teradataml.dataframe.dataframe import DataFrame
|
|
27
|
+
from teradataml.dataframe.dataframe_utils import DataFrameUtils
|
|
28
28
|
from teradataml.utils.validators import _Validators
|
|
29
29
|
|
|
30
30
|
aed_utils = AedUtils()
|
teradataml/options/__init__.py
CHANGED
|
@@ -26,36 +26,42 @@ def set_config_params(**kwargs):
|
|
|
26
26
|
Types: str
|
|
27
27
|
|
|
28
28
|
default_varchar_size:
|
|
29
|
-
|
|
30
|
-
Specifies the size of varchar datatype in Vantage, the default
|
|
29
|
+
Specifies the size of varchar datatype in Teradata Vantage, the default
|
|
31
30
|
size is 1024.
|
|
31
|
+
User can configure this parameter using options.
|
|
32
32
|
Types: int
|
|
33
33
|
|
|
34
34
|
vantage_version:
|
|
35
|
-
Specifies the Vantage version teradataml is connected to.
|
|
36
|
-
Types:
|
|
35
|
+
Specifies the Vantage version of the system teradataml is connected to.
|
|
36
|
+
Types: string
|
|
37
37
|
|
|
38
38
|
val_install_location:
|
|
39
|
-
Specifies the database
|
|
39
|
+
Specifies the name of the database where Vantage Analytic Library functions
|
|
40
40
|
are installed.
|
|
41
|
-
Types:
|
|
41
|
+
Types: string
|
|
42
42
|
|
|
43
43
|
byom_install_location:
|
|
44
|
-
Specifies the database
|
|
44
|
+
Specifies the name of the database where Bring Your Own Model functions
|
|
45
45
|
are installed.
|
|
46
|
-
Types:
|
|
46
|
+
Types: string
|
|
47
47
|
|
|
48
48
|
database_version:
|
|
49
|
-
Specifies the database version of the system teradataml is connected to.
|
|
50
|
-
Types:
|
|
49
|
+
Specifies the actual database version of the system teradataml is connected to.
|
|
50
|
+
Types: string
|
|
51
51
|
|
|
52
52
|
read_nos_function_mapping:
|
|
53
|
-
Specifies the mapping
|
|
54
|
-
Types:
|
|
53
|
+
Specifies the function mapping name for the read_nos table operator function.
|
|
54
|
+
Types: string
|
|
55
55
|
|
|
56
56
|
write_nos_function_mapping:
|
|
57
|
-
Specifies the mapping
|
|
58
|
-
Types:
|
|
57
|
+
Specifies the function mapping name for the write_nos table operator function.
|
|
58
|
+
Types: string
|
|
59
|
+
|
|
60
|
+
inline_plot:
|
|
61
|
+
Specifies whether to display the plot inline or not.
|
|
62
|
+
Note:
|
|
63
|
+
Not applicable for machines running Linux and Mac OS.
|
|
64
|
+
Types: bool
|
|
59
65
|
|
|
60
66
|
indb_install_location:
|
|
61
67
|
Specifies the installation location of In-DB Python package.
|
|
@@ -66,9 +72,35 @@ def set_config_params(**kwargs):
|
|
|
66
72
|
Older versions of In-DB packages are installed at
|
|
67
73
|
"/opt/teradata/languages/Python/".
|
|
68
74
|
|
|
75
|
+
openml_user_env:
|
|
76
|
+
Specifies the user environment to be used for OpenML.
|
|
77
|
+
Types: UserEnv
|
|
78
|
+
|
|
69
79
|
local_storage:
|
|
70
80
|
Specifies the location on client where garbage collector folder will be created.
|
|
71
|
-
Types:
|
|
81
|
+
Types: string
|
|
82
|
+
|
|
83
|
+
stored_procedure_install_location:
|
|
84
|
+
Specifies the name of the database where stored procedures
|
|
85
|
+
are installed.
|
|
86
|
+
Types: string
|
|
87
|
+
|
|
88
|
+
table_operator:
|
|
89
|
+
Specifies the name of the table operator.
|
|
90
|
+
Permitted Values: "Apply", "Script"
|
|
91
|
+
Types: string
|
|
92
|
+
|
|
93
|
+
temp_object_type:
|
|
94
|
+
Specifies the type of temporary database objects created internally by teradataml.
|
|
95
|
+
Permitted Values:
|
|
96
|
+
* "VT" - Volatile tables.
|
|
97
|
+
Types: String
|
|
98
|
+
Default Value: None
|
|
99
|
+
Note:
|
|
100
|
+
* If this option is set to "VT" and "persist" argument of analytic functions is
|
|
101
|
+
set to True, then volatile tables are not created as volatile table can't be
|
|
102
|
+
persisted and "persist" argument takes precedence.
|
|
103
|
+
* Default behavior is to create views that will be garbage collected at the end.
|
|
72
104
|
|
|
73
105
|
RETURNS:
|
|
74
106
|
bool
|
teradataml/options/configure.py
CHANGED
|
@@ -13,6 +13,7 @@ from teradataml.common.exceptions import TeradataMlException
|
|
|
13
13
|
from teradataml.common.messages import Messages
|
|
14
14
|
from teradataml.common.messagecodes import MessageCodes
|
|
15
15
|
|
|
16
|
+
|
|
16
17
|
class _ConfigureSuper(object):
|
|
17
18
|
|
|
18
19
|
def __init__(self):
|
|
@@ -60,16 +61,17 @@ class _Configure(_ConfigureSuper):
|
|
|
60
61
|
local_storage = _create_property('local_storage')
|
|
61
62
|
stored_procedure_install_location = _create_property('stored_procedure_install_location')
|
|
62
63
|
table_operator = _create_property('table_operator')
|
|
64
|
+
temp_object_type = _create_property('temp_object_type')
|
|
63
65
|
|
|
64
|
-
def __init__(self, default_varchar_size=1024, column_casesensitive_handler
|
|
66
|
+
def __init__(self, default_varchar_size=1024, column_casesensitive_handler=False,
|
|
65
67
|
vantage_version="vantage1.1", val_install_location=None,
|
|
66
68
|
byom_install_location=None, temp_table_database=None,
|
|
67
69
|
temp_view_database=None, database_version=None,
|
|
68
70
|
read_nos_function_mapping="read_nos", write_nos_function_mapping="write_nos",
|
|
69
|
-
cran_repositories=None, inline_plot=True,
|
|
70
|
-
indb_install_location=
|
|
71
|
+
cran_repositories=None, inline_plot=True,
|
|
72
|
+
indb_install_location=None,
|
|
71
73
|
openml_user_env=None, local_storage=None, stored_procedure_install_location="SYSLIB",
|
|
72
|
-
table_operator=None):
|
|
74
|
+
table_operator=None, temp_object_type=None):
|
|
73
75
|
|
|
74
76
|
"""
|
|
75
77
|
PARAMETERS:
|
|
@@ -81,17 +83,6 @@ class _Configure(_ConfigureSuper):
|
|
|
81
83
|
Example:
|
|
82
84
|
teradataml.options.configure.default_varchar_size = 512
|
|
83
85
|
|
|
84
|
-
column_casesensitive_handler:
|
|
85
|
-
Specifies a boolean value that sets the value of this option to True or
|
|
86
|
-
False.
|
|
87
|
-
One should set this to True, when ML Engine connector property is
|
|
88
|
-
CASE-SENSITIVE, else set to False, which is CASE-INSENSITIVE.
|
|
89
|
-
Types: bool
|
|
90
|
-
Example:
|
|
91
|
-
# When ML Engine connector property is CASE-SENSITIVE, set this
|
|
92
|
-
# parameter to True.
|
|
93
|
-
teradataml.options.configure.column_casesensitive_handler = True
|
|
94
|
-
|
|
95
86
|
vantage_version:
|
|
96
87
|
Specifies the Vantage version of the system teradataml is connected to.
|
|
97
88
|
Types: string
|
|
@@ -141,7 +132,7 @@ class _Configure(_ConfigureSuper):
|
|
|
141
132
|
inline_plot:
|
|
142
133
|
Specifies whether to display the plot inline or not.
|
|
143
134
|
Note:
|
|
144
|
-
Not applicable for machines running
|
|
135
|
+
Not applicable for machines running Linux and Mac OS.
|
|
145
136
|
Types: bool
|
|
146
137
|
Example:
|
|
147
138
|
# Set the option to display plot in a separate window.
|
|
@@ -151,10 +142,6 @@ class _Configure(_ConfigureSuper):
|
|
|
151
142
|
Specifies the installation location of In-DB Python package.
|
|
152
143
|
Types: string
|
|
153
144
|
Default Value: "/var/opt/teradata/languages/sles12sp3/Python/"
|
|
154
|
-
Note:
|
|
155
|
-
The default value is the installation location of In-DB 2.0.0 packages.
|
|
156
|
-
Older versions of In-DB packages are installed at
|
|
157
|
-
"/opt/teradata/languages/Python/".
|
|
158
145
|
Example:
|
|
159
146
|
# Set the installation location for older versions.
|
|
160
147
|
teradataml.options.configure.indb_install_location = "/opt/teradata/languages/Python/"
|
|
@@ -185,11 +172,27 @@ class _Configure(_ConfigureSuper):
|
|
|
185
172
|
|
|
186
173
|
table_operator:
|
|
187
174
|
Specifies the name of the table operator.
|
|
175
|
+
Permitted Values: "Apply", "Script"
|
|
188
176
|
Types: string
|
|
189
177
|
Example:
|
|
190
178
|
# Set the table operator name to "Script"
|
|
191
179
|
teradataml.options.configure.table_operator = "Script"
|
|
192
180
|
|
|
181
|
+
temp_object_type:
|
|
182
|
+
Specifies the type of temporary database objects created internally by teradataml.
|
|
183
|
+
Permitted Values:
|
|
184
|
+
* "VT" - Volatile tables.
|
|
185
|
+
Types: String
|
|
186
|
+
Default Value: None
|
|
187
|
+
Note:
|
|
188
|
+
* If this option is set to "VT" and "persist" argument of analytic functions is
|
|
189
|
+
set to True, then volatile tables are not created as volatile table can't be
|
|
190
|
+
persisted and "persist" argument takes precedence.
|
|
191
|
+
* Default behavior is to create views that will be garbage collected at the end.
|
|
192
|
+
Example:
|
|
193
|
+
# Set the type of temporary database objects to "VT" to create volatile internal
|
|
194
|
+
# tables.
|
|
195
|
+
teradataml.options.configure.temp_object_type = "VT"
|
|
193
196
|
"""
|
|
194
197
|
super().__init__()
|
|
195
198
|
super().__setattr__('default_varchar_size', default_varchar_size)
|
|
@@ -204,11 +207,12 @@ class _Configure(_ConfigureSuper):
|
|
|
204
207
|
super().__setattr__('write_nos_function_mapping', write_nos_function_mapping)
|
|
205
208
|
super().__setattr__('cran_repositories', cran_repositories)
|
|
206
209
|
super().__setattr__('inline_plot', True)
|
|
207
|
-
super().__setattr__('indb_install_location', indb_install_location)
|
|
208
210
|
super().__setattr__('openml_user_env', openml_user_env)
|
|
209
211
|
super().__setattr__('local_storage', local_storage)
|
|
210
212
|
super().__setattr__('stored_procedure_install_location', stored_procedure_install_location)
|
|
211
213
|
super().__setattr__('table_operator', table_operator)
|
|
214
|
+
super().__setattr__('_indb_install_location', indb_install_location)
|
|
215
|
+
super().__setattr__('temp_object_type', self.__get_temp_object_type(temp_object_type))
|
|
212
216
|
|
|
213
217
|
# internal configurations
|
|
214
218
|
# These configurations are internal and should not be
|
|
@@ -240,6 +244,9 @@ class _Configure(_ConfigureSuper):
|
|
|
240
244
|
super().__setattr__('ues_url', None)
|
|
241
245
|
# base URL in Vector Store REST calls
|
|
242
246
|
super().__setattr__('_vector_store_base_url', None)
|
|
247
|
+
# Internal parameter, which is used to specify whether SSL verification is to be done or not.
|
|
248
|
+
# By default, it is set to True.
|
|
249
|
+
super().__setattr__('_ssl_verify', True)
|
|
243
250
|
# Internal parameter, that is used to specify the certificate file in a secured HTTP request.
|
|
244
251
|
super().__setattr__('certificate_file', False)
|
|
245
252
|
# Internal parameter, that is used for specify the maximum size of the file
|
|
@@ -260,6 +267,46 @@ class _Configure(_ConfigureSuper):
|
|
|
260
267
|
# Internal parameter, that is used for specifying the database username associated with current connection.
|
|
261
268
|
super().__setattr__('_database_username', None)
|
|
262
269
|
|
|
270
|
+
@property
|
|
271
|
+
def indb_install_location(self):
|
|
272
|
+
"""
|
|
273
|
+
DESCRIPTION:
|
|
274
|
+
Specifies the installation location of In-DB Python package.
|
|
275
|
+
|
|
276
|
+
RAISES:
|
|
277
|
+
Operational Error.
|
|
278
|
+
"""
|
|
279
|
+
if self._indb_install_location:
|
|
280
|
+
return self._indb_install_location
|
|
281
|
+
from teradataml.context.context import get_context
|
|
282
|
+
if get_context():
|
|
283
|
+
from teradataml.common.constants import TableOperatorConstants
|
|
284
|
+
from teradataml.utils.utils import execute_sql
|
|
285
|
+
_path = execute_sql(TableOperatorConstants.INDB_PYTHON_PATH.value).fetchall()[0][0]
|
|
286
|
+
if 'sles:12:sp3' in _path:
|
|
287
|
+
self._indb_install_location = '/var/opt/teradata/languages/sles12sp3/Python/'
|
|
288
|
+
elif 'sles:15:sp4' in _path:
|
|
289
|
+
self._indb_install_location = '/var/opt/teradata/languages/sles15sp4/Python/'
|
|
290
|
+
else:
|
|
291
|
+
self._indb_install_location = '/opt/teradata/languages/Python/'
|
|
292
|
+
return self._indb_install_location
|
|
293
|
+
else:
|
|
294
|
+
return '/var/opt/teradata/languages/sles12sp3/Python/'
|
|
295
|
+
|
|
296
|
+
@indb_install_location.setter
|
|
297
|
+
def indb_install_location(self, value):
|
|
298
|
+
"""
|
|
299
|
+
DESCRIPTION:
|
|
300
|
+
Sets the value to "indb_install_location" by user.
|
|
301
|
+
|
|
302
|
+
PARAMETERS:
|
|
303
|
+
value:
|
|
304
|
+
Required Argument.
|
|
305
|
+
Specifies the value assigned to "indb_install_location".
|
|
306
|
+
Types: str
|
|
307
|
+
"""
|
|
308
|
+
self._indb_install_location = value
|
|
309
|
+
|
|
263
310
|
def __setattr__(self, name, value):
|
|
264
311
|
if hasattr(self, name):
|
|
265
312
|
if name == 'default_varchar_size':
|
|
@@ -272,7 +319,9 @@ class _Configure(_ConfigureSuper):
|
|
|
272
319
|
"greater than"),
|
|
273
320
|
MessageCodes.TDMLDF_POSITIVE_INT)
|
|
274
321
|
elif name == '_ues_max_file_upload_size':
|
|
275
|
-
|
|
322
|
+
# If the value is bool, isinstance(value, int) returns True
|
|
323
|
+
# which is wrong, hence added the condition on bool.
|
|
324
|
+
if isinstance(value, bool) or not isinstance(value, int):
|
|
276
325
|
raise TeradataMlException(Messages.get_message(MessageCodes.UNSUPPORTED_DATATYPE, name,
|
|
277
326
|
'int'),
|
|
278
327
|
MessageCodes.UNSUPPORTED_DATATYPE)
|
|
@@ -281,7 +330,7 @@ class _Configure(_ConfigureSuper):
|
|
|
281
330
|
"greater than or equal to"),
|
|
282
331
|
MessageCodes.TDMLDF_POSITIVE_INT)
|
|
283
332
|
elif name in ['column_casesensitive_handler', '_validate_metaexpression',
|
|
284
|
-
'_validate_gc', 'inline_plot', '_oauth']:
|
|
333
|
+
'_validate_gc', 'inline_plot', '_oauth', '_ssl_verify']:
|
|
285
334
|
|
|
286
335
|
if not isinstance(value, bool):
|
|
287
336
|
raise TeradataMlException(Messages.get_message(MessageCodes.UNSUPPORTED_DATATYPE, name,
|
|
@@ -338,7 +387,6 @@ class _Configure(_ConfigureSuper):
|
|
|
338
387
|
MessageCodes.PATH_NOT_FOUND)
|
|
339
388
|
|
|
340
389
|
elif name in {'ues_url', '_oauth_end_point', '_oauth_client_id', '_vector_store_base_url'}:
|
|
341
|
-
|
|
342
390
|
if not isinstance(value, str):
|
|
343
391
|
raise TypeError(Messages.get_message(MessageCodes.UNSUPPORTED_DATATYPE, name, 'str'))
|
|
344
392
|
|
|
@@ -367,7 +415,8 @@ class _Configure(_ConfigureSuper):
|
|
|
367
415
|
for url in value:
|
|
368
416
|
if not isinstance(url, str):
|
|
369
417
|
raise TypeError(
|
|
370
|
-
Messages.get_message(MessageCodes.UNSUPPORTED_DATATYPE, name,
|
|
418
|
+
Messages.get_message(MessageCodes.UNSUPPORTED_DATATYPE, name,
|
|
419
|
+
'str, list of str or None'))
|
|
371
420
|
|
|
372
421
|
elif name == 'openml_user_env':
|
|
373
422
|
from teradataml.scriptmgmt.UserEnv import UserEnv
|
|
@@ -387,10 +436,38 @@ class _Configure(_ConfigureSuper):
|
|
|
387
436
|
name,
|
|
388
437
|
"a value in {}".format(valid_names)),
|
|
389
438
|
MessageCodes.INVALID_ARG_VALUE)
|
|
439
|
+
elif name == "temp_object_type":
|
|
440
|
+
self.__validate_db_tbl_attrs(name, value)
|
|
441
|
+
valid_object_typs = ['VT']
|
|
442
|
+
if value and value.upper() not in valid_object_typs:
|
|
443
|
+
raise ValueError(Messages.get_message(MessageCodes.INVALID_ARG_VALUE,
|
|
444
|
+
value,
|
|
445
|
+
name,
|
|
446
|
+
"a value in {}".format(valid_object_typs)))
|
|
447
|
+
|
|
448
|
+
value = self.__get_temp_object_type(value)
|
|
390
449
|
|
|
391
450
|
super().__setattr__(name, value)
|
|
392
451
|
else:
|
|
393
452
|
raise AttributeError("'{}' object has no attribute '{}'".format(self.__class__.__name__, name))
|
|
394
453
|
|
|
454
|
+
def __get_temp_object_type(self, value):
|
|
455
|
+
"""
|
|
456
|
+
Get the temporary object type based on the value provided.
|
|
457
|
+
Default behavior is to create views that will be garbage collected at the end.
|
|
458
|
+
"""
|
|
459
|
+
from teradataml.common.constants import TeradataConstants
|
|
460
|
+
if value and value.upper() == "VT":
|
|
461
|
+
return TeradataConstants.TERADATA_VOLATILE_TABLE
|
|
462
|
+
# This we will need in the future.
|
|
463
|
+
# elif value and value.upper() in ["TT", "PT"]:
|
|
464
|
+
# return TeradataConstants.TERADATA_TABLE
|
|
465
|
+
return TeradataConstants.TERADATA_VIEW
|
|
466
|
+
|
|
467
|
+
def __validate_db_tbl_attrs(self, name, value):
|
|
468
|
+
if not isinstance(value, str) and not isinstance(value, type(None)):
|
|
469
|
+
raise TypeError(Messages.get_message(MessageCodes.UNSUPPORTED_DATATYPE, name,
|
|
470
|
+
'str or None'))
|
|
471
|
+
|
|
395
472
|
|
|
396
|
-
configure = _Configure()
|
|
473
|
+
configure = _Configure()
|
teradataml/options/display.py
CHANGED
|
@@ -51,6 +51,7 @@ class _Display(_DisplaySuper):
|
|
|
51
51
|
blob_length = _create_property('blob_length')
|
|
52
52
|
suppress_vantage_runtime_warnings = _create_property('suppress_vantage_runtime_warnings')
|
|
53
53
|
geometry_column_length = _create_property('geometry_column_length')
|
|
54
|
+
enable_ui = _create_property('enable_ui')
|
|
54
55
|
|
|
55
56
|
def __init__(self,
|
|
56
57
|
max_rows = 10,
|
|
@@ -59,7 +60,8 @@ class _Display(_DisplaySuper):
|
|
|
59
60
|
print_sqlmr_query = False,
|
|
60
61
|
blob_length=10,
|
|
61
62
|
suppress_vantage_runtime_warnings=True,
|
|
62
|
-
geometry_column_length=30
|
|
63
|
+
geometry_column_length=30,
|
|
64
|
+
enable_ui=True):
|
|
63
65
|
"""
|
|
64
66
|
PARAMETERS:
|
|
65
67
|
max_rows:
|
|
@@ -115,6 +117,14 @@ class _Display(_DisplaySuper):
|
|
|
115
117
|
Types: bool
|
|
116
118
|
Example:
|
|
117
119
|
display.suppress_vantage_runtime_warnings = True
|
|
120
|
+
|
|
121
|
+
enable_ui:
|
|
122
|
+
Specifies whether to display exploratory data analysis UI when DataFrame is printed or not.
|
|
123
|
+
When set to True, UI is enabled to be displayed, otherwise it is disabled.
|
|
124
|
+
Default Value: True
|
|
125
|
+
Types: bool
|
|
126
|
+
Example:
|
|
127
|
+
display.enable_ui = True
|
|
118
128
|
"""
|
|
119
129
|
super().__init__()
|
|
120
130
|
super().__setattr__('max_rows', max_rows)
|
|
@@ -124,6 +134,7 @@ class _Display(_DisplaySuper):
|
|
|
124
134
|
super().__setattr__('blob_length', blob_length)
|
|
125
135
|
super().__setattr__('suppress_vantage_runtime_warnings', suppress_vantage_runtime_warnings)
|
|
126
136
|
super().__setattr__('geometry_column_length', geometry_column_length)
|
|
137
|
+
super().__setattr__('enable_ui', enable_ui)
|
|
127
138
|
|
|
128
139
|
def __setattr__(self, name, value):
|
|
129
140
|
if hasattr(self, name):
|
|
@@ -149,7 +160,7 @@ class _Display(_DisplaySuper):
|
|
|
149
160
|
name,
|
|
150
161
|
"a value in {}".format(valid_encodings)),
|
|
151
162
|
MessageCodes.INVALID_ARG_VALUE)
|
|
152
|
-
elif name == 'print_sqlmr_query':
|
|
163
|
+
elif name == 'print_sqlmr_query' or name == 'enable_ui':
|
|
153
164
|
if not isinstance(value, bool):
|
|
154
165
|
raise TeradataMlException(Messages.get_message(MessageCodes.UNSUPPORTED_DATATYPE, name,
|
|
155
166
|
'bool'),
|
teradataml/plot/axis.py
CHANGED
|
@@ -20,6 +20,7 @@ from teradataml.dataframe.sql import ColumnExpression
|
|
|
20
20
|
from teradataml.plot.constants import MapType
|
|
21
21
|
from teradataml.utils.validators import _Validators
|
|
22
22
|
|
|
23
|
+
|
|
23
24
|
class Axis:
|
|
24
25
|
def __init__(self, **kwargs):
|
|
25
26
|
"""
|
|
@@ -421,9 +422,47 @@ class Axis:
|
|
|
421
422
|
self.__series_options = kwargs.get("series_options") # Specifies SQL element - ID_SEQUENCE
|
|
422
423
|
|
|
423
424
|
# Get the series identifier. If it is a column expression, get the column name from it.
|
|
424
|
-
self.
|
|
425
|
-
if not isinstance(self.
|
|
426
|
-
self.
|
|
425
|
+
self.series_identifier = kwargs.get("series_identifier")
|
|
426
|
+
if not isinstance(self.series_identifier, str) and self.series_identifier is not None:
|
|
427
|
+
self.series_identifier = self.series_identifier.name
|
|
428
|
+
|
|
429
|
+
def __eq__(self, other):
|
|
430
|
+
"""
|
|
431
|
+
DESCRIPTION:
|
|
432
|
+
Magic method to check if two Axis objects are equal or not.
|
|
433
|
+
If all the associated parameters are same, then two Axis objects
|
|
434
|
+
are equal. Else, they are not equal.
|
|
435
|
+
|
|
436
|
+
PARAMETERS:
|
|
437
|
+
other:
|
|
438
|
+
Required Argument.
|
|
439
|
+
Specifies the object of Axis.
|
|
440
|
+
Types: Axis
|
|
441
|
+
|
|
442
|
+
RETURNS:
|
|
443
|
+
bool
|
|
444
|
+
|
|
445
|
+
RAISES:
|
|
446
|
+
None.
|
|
447
|
+
|
|
448
|
+
EXAMPLES:
|
|
449
|
+
>>> Axis() == Axis()
|
|
450
|
+
"""
|
|
451
|
+
attrs = ["cmap", "color", "grid_color",
|
|
452
|
+
"grid_format", "grid_linestyle", "grid_linewidth",
|
|
453
|
+
"legend", "legend_style", "linestyle",
|
|
454
|
+
"linewidth", "marker", "markersize", "position",
|
|
455
|
+
"span", "reverse_xaxis", "reverse_yaxis", "series_identifier",
|
|
456
|
+
"title", "xlabel", "xlim", "xtick_format", "ylabel", "ylim", "ytick_format",
|
|
457
|
+
"vmin", "vmax", "ignore_nulls", "kind"]
|
|
458
|
+
|
|
459
|
+
for attr in attrs:
|
|
460
|
+
if getattr(self, attr) == getattr(other, attr):
|
|
461
|
+
continue
|
|
462
|
+
else:
|
|
463
|
+
return False
|
|
464
|
+
|
|
465
|
+
return True
|
|
427
466
|
|
|
428
467
|
def __get_param(self, param):
|
|
429
468
|
"""
|
|
@@ -940,7 +979,7 @@ class Axis:
|
|
|
940
979
|
"""
|
|
941
980
|
from teradataml.dataframe.dataframe import TDSeries
|
|
942
981
|
|
|
943
|
-
if self.
|
|
982
|
+
if self.series_identifier:
|
|
944
983
|
# Remove null values from DataFrame
|
|
945
984
|
if self.ignore_nulls:
|
|
946
985
|
_df = self.__x_axis_data[0]._parent_df
|
|
@@ -954,7 +993,7 @@ class Axis:
|
|
|
954
993
|
self.__y_axis_data[0]._parent_df.materialize()
|
|
955
994
|
|
|
956
995
|
series = TDSeries(data=_df if self.ignore_nulls else self.__x_axis_data[0]._parent_df,
|
|
957
|
-
id=self.
|
|
996
|
+
id=self.series_identifier,
|
|
958
997
|
row_index=self.__x_axis_data[0].name,
|
|
959
998
|
row_index_style=self.__get_index_style(self.__x_axis_data[0]),
|
|
960
999
|
payload_field=self.__y_axis_data[0].name,
|
|
@@ -1038,7 +1077,7 @@ class Axis:
|
|
|
1038
1077
|
"""
|
|
1039
1078
|
from teradataml.dataframe.dataframe import TDMatrix
|
|
1040
1079
|
|
|
1041
|
-
if self.
|
|
1080
|
+
if self.series_identifier:
|
|
1042
1081
|
# Remove null values from DataFrame
|
|
1043
1082
|
if self.ignore_nulls:
|
|
1044
1083
|
_df = self.__x_axis_data[0]._parent_df
|
|
@@ -1052,7 +1091,7 @@ class Axis:
|
|
|
1052
1091
|
self.__y_axis_data[0]._parent_df.materialize()
|
|
1053
1092
|
|
|
1054
1093
|
matrix = TDMatrix(data=_df if self.ignore_nulls else self.__x_axis_data[0]._parent_df,
|
|
1055
|
-
id=self.
|
|
1094
|
+
id=self.series_identifier,
|
|
1056
1095
|
row_index=self.__x_axis_data[0].name,
|
|
1057
1096
|
row_index_style=self.__get_index_style(self.__x_axis_data[0]),
|
|
1058
1097
|
column_index=self.__y_axis_data[0].name,
|
|
@@ -1242,7 +1281,7 @@ class Axis:
|
|
|
1242
1281
|
|
|
1243
1282
|
# For subplot or multiple series, make sure to populate legend.
|
|
1244
1283
|
# For mainplot, leave it to user's choice.
|
|
1245
|
-
if self._is_sub_plot() or self.
|
|
1284
|
+
if self._is_sub_plot() or self.series_identifier or (len(self.__y_axis_data) > 1) and \
|
|
1246
1285
|
self.kind not in (MapType.MESH.value, MapType.WIGGLE.value):
|
|
1247
1286
|
func_params["LEGEND"] = "'{}'".format("best" if not self.legend_style else self.legend_style)
|
|
1248
1287
|
else:
|
teradataml/plot/figure.py
CHANGED
|
@@ -111,6 +111,39 @@ class Figure:
|
|
|
111
111
|
|
|
112
112
|
self._plot_axis = {}
|
|
113
113
|
|
|
114
|
+
def __eq__(self, other):
|
|
115
|
+
"""
|
|
116
|
+
DESCRIPTION:
|
|
117
|
+
Magic method to check if two Figure objects are equal or not.
|
|
118
|
+
If all the associated parameters are same, then two Figure objects
|
|
119
|
+
are equal. Else, they are not equal.
|
|
120
|
+
|
|
121
|
+
PARAMETERS:
|
|
122
|
+
other:
|
|
123
|
+
Required Argument.
|
|
124
|
+
Specifies the object of Figure.
|
|
125
|
+
Types: Figure
|
|
126
|
+
|
|
127
|
+
RETURNS:
|
|
128
|
+
bool
|
|
129
|
+
|
|
130
|
+
RAISES:
|
|
131
|
+
None.
|
|
132
|
+
|
|
133
|
+
EXAMPLES:
|
|
134
|
+
>>> Figure() == Figure()
|
|
135
|
+
"""
|
|
136
|
+
attrs = ["width", "height", "image_type", "dpi", "heading",
|
|
137
|
+
"layout"]
|
|
138
|
+
|
|
139
|
+
for attr in attrs:
|
|
140
|
+
if getattr(self, attr) == getattr(other, attr):
|
|
141
|
+
continue
|
|
142
|
+
else:
|
|
143
|
+
return False
|
|
144
|
+
|
|
145
|
+
return True
|
|
146
|
+
|
|
114
147
|
@property
|
|
115
148
|
def height(self):
|
|
116
149
|
"""
|
teradataml/plot/plot.py
CHANGED
|
@@ -472,26 +472,78 @@ class _Plot:
|
|
|
472
472
|
self.figure = Figure()
|
|
473
473
|
self._figure = self.figure
|
|
474
474
|
|
|
475
|
-
axis = kwargs.get("ax")
|
|
475
|
+
self.axis = kwargs.get("ax", None)
|
|
476
476
|
# If axis is not passed, generate a default one.
|
|
477
|
-
if axis is None:
|
|
478
|
-
axis = Axis(kind=kind, **kwargs)
|
|
477
|
+
if self.axis is None:
|
|
478
|
+
self.axis = Axis(kind=kind, **kwargs)
|
|
479
479
|
else:
|
|
480
480
|
# If user passes axes, i.e., for subplot, add additional params
|
|
481
481
|
# which is passed as kwargs.
|
|
482
|
-
axis.set_params(kind=kind, **kwargs)
|
|
482
|
+
self.axis.set_params(kind=kind, **kwargs)
|
|
483
483
|
|
|
484
484
|
# Set the axis data.
|
|
485
|
-
axis._set_data(x, y, scale=scale)
|
|
485
|
+
self.axis._set_data(x, y, scale=scale)
|
|
486
486
|
|
|
487
487
|
# Add the axis to figure.
|
|
488
|
-
self._figure._add_axis(axis)
|
|
488
|
+
self._figure._add_axis(self.axis)
|
|
489
489
|
self._query = None
|
|
490
490
|
self._plot_image_data = None
|
|
491
|
-
self.
|
|
492
|
-
_Validators._validate_input_columns_not_empty(self.
|
|
491
|
+
self.heading = kwargs.get("heading")
|
|
492
|
+
_Validators._validate_input_columns_not_empty(self.heading, "heading")
|
|
493
493
|
self.__params = kwargs
|
|
494
494
|
|
|
495
|
+
def __eq__(self, other):
|
|
496
|
+
"""
|
|
497
|
+
DESCRIPTION:
|
|
498
|
+
Magic method to check if two Plot objects are equal or not.
|
|
499
|
+
If all the associated parameters are same, then two Plot objects
|
|
500
|
+
are equal. Else, they are not equal.
|
|
501
|
+
|
|
502
|
+
PARAMETERS:
|
|
503
|
+
other:
|
|
504
|
+
Required Argument.
|
|
505
|
+
Specifies the object of Plot.
|
|
506
|
+
Types: Plot
|
|
507
|
+
|
|
508
|
+
RETURNS:
|
|
509
|
+
bool
|
|
510
|
+
|
|
511
|
+
RAISES:
|
|
512
|
+
None.
|
|
513
|
+
|
|
514
|
+
EXAMPLES:
|
|
515
|
+
>>> _Plot() == _Plot()
|
|
516
|
+
"""
|
|
517
|
+
|
|
518
|
+
# Check whether x and y are same or not.
|
|
519
|
+
# If two plots to be same, their data and plot parameters to be same.
|
|
520
|
+
if self.x.compile() != other.x.compile():
|
|
521
|
+
return False
|
|
522
|
+
|
|
523
|
+
self_y = (self.y, ) if isinstance(self.y, ColumnExpression) else self.y
|
|
524
|
+
other_y = (other.y, ) if isinstance(other.y, ColumnExpression) else other.y
|
|
525
|
+
|
|
526
|
+
if len(self_y) != len(other_y):
|
|
527
|
+
return False
|
|
528
|
+
|
|
529
|
+
for self_col, other_col in zip(self_y, other_y):
|
|
530
|
+
if self_col.compile() != other_col.compile():
|
|
531
|
+
return False
|
|
532
|
+
|
|
533
|
+
# Validate plot parameters are same or not.
|
|
534
|
+
attrs = ["scale", "kind",
|
|
535
|
+
"figsize", "figtype", "figdpi",
|
|
536
|
+
"heading", "wiggle_fill", "wiggle_scale",
|
|
537
|
+
"axis", "figure"]
|
|
538
|
+
|
|
539
|
+
for attr in attrs:
|
|
540
|
+
if getattr(self, attr) == getattr(other, attr):
|
|
541
|
+
continue
|
|
542
|
+
else:
|
|
543
|
+
return False
|
|
544
|
+
|
|
545
|
+
return True
|
|
546
|
+
|
|
495
547
|
def _execute_query(self):
|
|
496
548
|
"""
|
|
497
549
|
DESCRIPTION:
|
|
@@ -504,7 +556,6 @@ class _Plot:
|
|
|
504
556
|
query = self._get_query()
|
|
505
557
|
|
|
506
558
|
res = get_connection().execute(text(query))
|
|
507
|
-
|
|
508
559
|
self._plot_image_data = res.fetchone().IMAGE
|
|
509
560
|
|
|
510
561
|
def show_query(self):
|
|
@@ -563,9 +614,8 @@ class _Plot:
|
|
|
563
614
|
>>> plot = ibm_stock.plot(x=ibm_stock.period, y=ibm_stock.stockprice, kind="bar")
|
|
564
615
|
>>> plot.show()
|
|
565
616
|
"""
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
self._execute_query()
|
|
617
|
+
if self._plot_image_data is None:
|
|
618
|
+
self._execute_query()
|
|
569
619
|
|
|
570
620
|
# If user choose for inline plot, then check if Python console supports
|
|
571
621
|
# inline plotting or not. If not supports, then go for outline plot.
|
|
@@ -691,7 +741,7 @@ class _Plot:
|
|
|
691
741
|
"HEIGHT": height
|
|
692
742
|
})
|
|
693
743
|
|
|
694
|
-
heading = self.
|
|
744
|
+
heading = self.heading if self.heading is not None else self._figure.heading
|
|
695
745
|
if heading:
|
|
696
746
|
func_other_args["TITLE"] = "'{}'".format(heading)
|
|
697
747
|
|