teradataml 20.0.0.0__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.
- teradataml/LICENSE-3RD-PARTY.pdf +0 -0
- teradataml/LICENSE.pdf +0 -0
- teradataml/README.md +183 -0
- teradataml/__init__.py +6 -3
- teradataml/_version.py +2 -2
- teradataml/analytics/__init__.py +3 -2
- teradataml/analytics/analytic_function_executor.py +275 -40
- teradataml/analytics/analytic_query_generator.py +92 -0
- teradataml/analytics/byom/__init__.py +3 -2
- teradataml/analytics/json_parser/metadata.py +1 -0
- teradataml/analytics/json_parser/utils.py +17 -21
- teradataml/analytics/meta_class.py +40 -1
- teradataml/analytics/sqle/DecisionTreePredict.py +1 -1
- teradataml/analytics/sqle/__init__.py +10 -2
- teradataml/analytics/table_operator/__init__.py +3 -2
- teradataml/analytics/uaf/__init__.py +21 -2
- teradataml/analytics/utils.py +62 -1
- teradataml/analytics/valib.py +1 -1
- teradataml/automl/__init__.py +1553 -319
- teradataml/automl/custom_json_utils.py +139 -61
- teradataml/automl/data_preparation.py +276 -319
- teradataml/automl/data_transformation.py +163 -81
- teradataml/automl/feature_engineering.py +402 -239
- teradataml/automl/feature_exploration.py +9 -2
- teradataml/automl/model_evaluation.py +48 -51
- teradataml/automl/model_training.py +291 -189
- teradataml/catalog/byom.py +8 -8
- teradataml/catalog/model_cataloging_utils.py +1 -1
- teradataml/clients/auth_client.py +133 -0
- teradataml/clients/pkce_client.py +1 -1
- teradataml/common/aed_utils.py +3 -2
- teradataml/common/constants.py +48 -6
- teradataml/common/deprecations.py +13 -7
- teradataml/common/garbagecollector.py +156 -120
- teradataml/common/messagecodes.py +6 -1
- teradataml/common/messages.py +3 -1
- teradataml/common/sqlbundle.py +1 -1
- teradataml/common/utils.py +103 -11
- teradataml/common/wrapper_utils.py +1 -1
- teradataml/context/context.py +121 -31
- teradataml/data/advertising.csv +201 -0
- teradataml/data/bank_marketing.csv +11163 -0
- teradataml/data/bike_sharing.csv +732 -0
- teradataml/data/boston2cols.csv +721 -0
- teradataml/data/breast_cancer.csv +570 -0
- teradataml/data/complaints_test_tokenized.csv +353 -0
- teradataml/data/complaints_tokens_model.csv +348 -0
- teradataml/data/covid_confirm_sd.csv +83 -0
- teradataml/data/customer_segmentation_test.csv +2628 -0
- teradataml/data/customer_segmentation_train.csv +8069 -0
- teradataml/data/dataframe_example.json +10 -0
- teradataml/data/docs/sqle/docs_17_10/OneHotEncodingFit.py +3 -1
- teradataml/data/docs/sqle/docs_17_10/OneHotEncodingTransform.py +6 -0
- teradataml/data/docs/sqle/docs_17_10/OutlierFilterTransform.py +5 -1
- teradataml/data/docs/sqle/docs_17_20/ANOVA.py +61 -1
- teradataml/data/docs/sqle/docs_17_20/CFilter.py +132 -0
- teradataml/data/docs/sqle/docs_17_20/ColumnTransformer.py +2 -0
- teradataml/data/docs/sqle/docs_17_20/FTest.py +105 -26
- teradataml/data/docs/sqle/docs_17_20/GLM.py +162 -1
- teradataml/data/docs/sqle/docs_17_20/GetFutileColumns.py +5 -3
- teradataml/data/docs/sqle/docs_17_20/KMeans.py +48 -1
- teradataml/data/docs/sqle/docs_17_20/NaiveBayes.py +162 -0
- teradataml/data/docs/sqle/docs_17_20/NonLinearCombineFit.py +3 -2
- teradataml/data/docs/sqle/docs_17_20/OneHotEncodingFit.py +5 -0
- teradataml/data/docs/sqle/docs_17_20/OneHotEncodingTransform.py +6 -0
- teradataml/data/docs/sqle/docs_17_20/OutlierFilterFit.py +2 -0
- teradataml/data/docs/sqle/docs_17_20/Pivoting.py +279 -0
- teradataml/data/docs/sqle/docs_17_20/ROC.py +3 -2
- teradataml/data/docs/sqle/docs_17_20/SVMPredict.py +13 -2
- teradataml/data/docs/sqle/docs_17_20/ScaleFit.py +119 -1
- teradataml/data/docs/sqle/docs_17_20/ScaleTransform.py +93 -1
- teradataml/data/docs/sqle/docs_17_20/Shap.py +197 -0
- teradataml/data/docs/sqle/docs_17_20/TDGLMPredict.py +163 -1
- teradataml/data/docs/sqle/docs_17_20/TDNaiveBayesPredict.py +189 -0
- teradataml/data/docs/sqle/docs_17_20/TFIDF.py +142 -0
- teradataml/data/docs/sqle/docs_17_20/Unpivoting.py +216 -0
- teradataml/data/docs/sqle/docs_17_20/XGBoost.py +12 -4
- teradataml/data/docs/sqle/docs_17_20/XGBoostPredict.py +7 -1
- teradataml/data/docs/sqle/docs_17_20/ZTest.py +72 -7
- teradataml/data/docs/uaf/docs_17_20/ACF.py +1 -10
- teradataml/data/docs/uaf/docs_17_20/ArimaEstimate.py +1 -1
- teradataml/data/docs/uaf/docs_17_20/ArimaForecast.py +35 -5
- teradataml/data/docs/uaf/docs_17_20/ArimaValidate.py +3 -1
- teradataml/data/docs/uaf/docs_17_20/ArimaXEstimate.py +293 -0
- teradataml/data/docs/uaf/docs_17_20/AutoArima.py +354 -0
- teradataml/data/docs/uaf/docs_17_20/BreuschGodfrey.py +3 -2
- teradataml/data/docs/uaf/docs_17_20/BreuschPaganGodfrey.py +1 -1
- teradataml/data/docs/uaf/docs_17_20/Convolve.py +13 -10
- teradataml/data/docs/uaf/docs_17_20/Convolve2.py +4 -1
- teradataml/data/docs/uaf/docs_17_20/CumulPeriodogram.py +5 -4
- teradataml/data/docs/uaf/docs_17_20/DFFT2Conv.py +4 -4
- teradataml/data/docs/uaf/docs_17_20/DWT.py +235 -0
- teradataml/data/docs/uaf/docs_17_20/DWT2D.py +214 -0
- teradataml/data/docs/uaf/docs_17_20/DurbinWatson.py +1 -1
- teradataml/data/docs/uaf/docs_17_20/ExtractResults.py +1 -1
- teradataml/data/docs/uaf/docs_17_20/FilterFactory1d.py +160 -0
- teradataml/data/docs/uaf/docs_17_20/GenseriesSinusoids.py +1 -1
- teradataml/data/docs/uaf/docs_17_20/GoldfeldQuandt.py +9 -31
- teradataml/data/docs/uaf/docs_17_20/HoltWintersForecaster.py +4 -2
- teradataml/data/docs/uaf/docs_17_20/IDFFT2.py +1 -8
- teradataml/data/docs/uaf/docs_17_20/IDWT.py +236 -0
- teradataml/data/docs/uaf/docs_17_20/IDWT2D.py +226 -0
- teradataml/data/docs/uaf/docs_17_20/IQR.py +134 -0
- teradataml/data/docs/uaf/docs_17_20/LineSpec.py +1 -1
- teradataml/data/docs/uaf/docs_17_20/LinearRegr.py +2 -2
- teradataml/data/docs/uaf/docs_17_20/MAMean.py +3 -3
- teradataml/data/docs/uaf/docs_17_20/Matrix2Image.py +297 -0
- teradataml/data/docs/uaf/docs_17_20/MatrixMultiply.py +15 -6
- teradataml/data/docs/uaf/docs_17_20/PACF.py +0 -1
- teradataml/data/docs/uaf/docs_17_20/Portman.py +2 -2
- teradataml/data/docs/uaf/docs_17_20/PowerSpec.py +2 -2
- teradataml/data/docs/uaf/docs_17_20/Resample.py +9 -1
- teradataml/data/docs/uaf/docs_17_20/SAX.py +246 -0
- teradataml/data/docs/uaf/docs_17_20/SeasonalNormalize.py +17 -10
- teradataml/data/docs/uaf/docs_17_20/SignifPeriodicities.py +1 -1
- teradataml/data/docs/uaf/docs_17_20/WhitesGeneral.py +3 -1
- teradataml/data/docs/uaf/docs_17_20/WindowDFFT.py +368 -0
- teradataml/data/dwt2d_dataTable.csv +65 -0
- teradataml/data/dwt_dataTable.csv +8 -0
- teradataml/data/dwt_filterTable.csv +3 -0
- teradataml/data/finance_data4.csv +13 -0
- teradataml/data/glm_example.json +28 -1
- teradataml/data/grocery_transaction.csv +19 -0
- teradataml/data/housing_train_segment.csv +201 -0
- teradataml/data/idwt2d_dataTable.csv +5 -0
- teradataml/data/idwt_dataTable.csv +8 -0
- teradataml/data/idwt_filterTable.csv +3 -0
- teradataml/data/insect2Cols.csv +61 -0
- teradataml/data/interval_data.csv +5 -0
- teradataml/data/jsons/paired_functions.json +14 -0
- teradataml/data/jsons/sqle/17.20/TD_ANOVA.json +99 -27
- teradataml/data/jsons/sqle/17.20/TD_CFilter.json +118 -0
- teradataml/data/jsons/sqle/17.20/TD_FTest.json +166 -83
- teradataml/data/jsons/sqle/17.20/TD_GLM.json +90 -14
- teradataml/data/jsons/sqle/17.20/TD_GLMPREDICT.json +48 -5
- teradataml/data/jsons/sqle/17.20/TD_GetFutileColumns.json +5 -3
- teradataml/data/jsons/sqle/17.20/TD_KMeans.json +31 -11
- teradataml/data/jsons/sqle/17.20/TD_NaiveBayes.json +193 -0
- teradataml/data/jsons/sqle/17.20/TD_NaiveBayesPredict.json +212 -0
- teradataml/data/jsons/sqle/17.20/TD_NonLinearCombineFit.json +3 -2
- teradataml/data/jsons/sqle/17.20/TD_OneClassSVM.json +9 -9
- teradataml/data/jsons/sqle/17.20/TD_Pivoting.json +280 -0
- teradataml/data/jsons/sqle/17.20/TD_ROC.json +2 -1
- teradataml/data/jsons/sqle/17.20/TD_SVM.json +16 -16
- teradataml/data/jsons/sqle/17.20/TD_SVMPredict.json +19 -1
- teradataml/data/jsons/sqle/17.20/TD_ScaleFit.json +168 -15
- teradataml/data/jsons/sqle/17.20/TD_ScaleTransform.json +50 -1
- teradataml/data/jsons/sqle/17.20/TD_Shap.json +222 -0
- teradataml/data/jsons/sqle/17.20/TD_TFIDF.json +162 -0
- teradataml/data/jsons/sqle/17.20/TD_Unpivoting.json +235 -0
- teradataml/data/jsons/sqle/17.20/TD_XGBoost.json +25 -7
- teradataml/data/jsons/sqle/17.20/TD_XGBoostPredict.json +17 -4
- teradataml/data/jsons/sqle/17.20/TD_ZTest.json +157 -80
- teradataml/data/jsons/storedprocedure/17.20/TD_FILTERFACTORY1D.json +150 -0
- teradataml/data/jsons/uaf/17.20/TD_ACF.json +1 -18
- teradataml/data/jsons/uaf/17.20/TD_ARIMAESTIMATE.json +3 -16
- teradataml/data/jsons/uaf/17.20/TD_ARIMAFORECAST.json +0 -3
- teradataml/data/jsons/uaf/17.20/TD_ARIMAVALIDATE.json +5 -3
- teradataml/data/jsons/uaf/17.20/TD_ARIMAXESTIMATE.json +362 -0
- teradataml/data/jsons/uaf/17.20/TD_AUTOARIMA.json +469 -0
- teradataml/data/jsons/uaf/17.20/TD_BINARYMATRIXOP.json +0 -3
- teradataml/data/jsons/uaf/17.20/TD_BINARYSERIESOP.json +0 -2
- teradataml/data/jsons/uaf/17.20/TD_BREUSCH_GODFREY.json +2 -1
- teradataml/data/jsons/uaf/17.20/TD_BREUSCH_PAGAN_GODFREY.json +2 -5
- teradataml/data/jsons/uaf/17.20/TD_CONVOLVE.json +3 -6
- teradataml/data/jsons/uaf/17.20/TD_CONVOLVE2.json +1 -3
- teradataml/data/jsons/uaf/17.20/TD_CUMUL_PERIODOGRAM.json +0 -5
- teradataml/data/jsons/uaf/17.20/TD_DFFT.json +1 -4
- teradataml/data/jsons/uaf/17.20/TD_DFFT2.json +2 -7
- teradataml/data/jsons/uaf/17.20/TD_DFFT2CONV.json +1 -2
- teradataml/data/jsons/uaf/17.20/TD_DFFTCONV.json +0 -2
- teradataml/data/jsons/uaf/17.20/TD_DTW.json +3 -6
- teradataml/data/jsons/uaf/17.20/TD_DWT.json +173 -0
- teradataml/data/jsons/uaf/17.20/TD_DWT2D.json +160 -0
- teradataml/data/jsons/uaf/17.20/TD_FITMETRICS.json +1 -1
- teradataml/data/jsons/uaf/17.20/TD_GOLDFELD_QUANDT.json +16 -30
- teradataml/data/jsons/uaf/17.20/{TD_HOLT_WINTERS_FORECAST.json → TD_HOLT_WINTERS_FORECASTER.json} +1 -2
- teradataml/data/jsons/uaf/17.20/TD_IDFFT2.json +1 -15
- teradataml/data/jsons/uaf/17.20/TD_IDWT.json +162 -0
- teradataml/data/jsons/uaf/17.20/TD_IDWT2D.json +149 -0
- teradataml/data/jsons/uaf/17.20/TD_IQR.json +117 -0
- teradataml/data/jsons/uaf/17.20/TD_LINEAR_REGR.json +1 -1
- teradataml/data/jsons/uaf/17.20/TD_LINESPEC.json +1 -1
- teradataml/data/jsons/uaf/17.20/TD_MAMEAN.json +1 -3
- teradataml/data/jsons/uaf/17.20/TD_MATRIX2IMAGE.json +209 -0
- teradataml/data/jsons/uaf/17.20/TD_PACF.json +2 -2
- teradataml/data/jsons/uaf/17.20/TD_POWERSPEC.json +5 -5
- teradataml/data/jsons/uaf/17.20/TD_RESAMPLE.json +48 -28
- teradataml/data/jsons/uaf/17.20/TD_SAX.json +208 -0
- teradataml/data/jsons/uaf/17.20/TD_SEASONALNORMALIZE.json +12 -6
- teradataml/data/jsons/uaf/17.20/TD_SIMPLEEXP.json +0 -1
- teradataml/data/jsons/uaf/17.20/TD_TRACKINGOP.json +8 -8
- teradataml/data/jsons/uaf/17.20/TD_UNDIFF.json +1 -1
- teradataml/data/jsons/uaf/17.20/TD_UNNORMALIZE.json +1 -1
- teradataml/data/jsons/uaf/17.20/TD_WINDOWDFFT.json +400 -0
- teradataml/data/kmeans_example.json +5 -0
- teradataml/data/kmeans_table.csv +10 -0
- teradataml/data/load_example_data.py +8 -2
- teradataml/data/naivebayestextclassifier_example.json +1 -1
- teradataml/data/naivebayestextclassifierpredict_example.json +11 -0
- teradataml/data/onehot_encoder_train.csv +4 -0
- teradataml/data/openml_example.json +29 -0
- teradataml/data/peppers.png +0 -0
- teradataml/data/real_values.csv +14 -0
- teradataml/data/sax_example.json +8 -0
- teradataml/data/scale_attributes.csv +3 -0
- teradataml/data/scale_example.json +52 -1
- teradataml/data/scale_input_part_sparse.csv +31 -0
- teradataml/data/scale_input_partitioned.csv +16 -0
- teradataml/data/scale_input_sparse.csv +11 -0
- teradataml/data/scale_parameters.csv +3 -0
- teradataml/data/scripts/deploy_script.py +21 -2
- teradataml/data/scripts/sklearn/sklearn_fit.py +40 -37
- teradataml/data/scripts/sklearn/sklearn_fit_predict.py +22 -30
- teradataml/data/scripts/sklearn/sklearn_function.template +42 -24
- teradataml/data/scripts/sklearn/sklearn_model_selection_split.py +23 -33
- teradataml/data/scripts/sklearn/sklearn_neighbors.py +19 -28
- teradataml/data/scripts/sklearn/sklearn_score.py +32 -32
- teradataml/data/scripts/sklearn/sklearn_transform.py +85 -42
- teradataml/data/star_pivot.csv +8 -0
- teradataml/data/templates/open_source_ml.json +2 -1
- teradataml/data/teradataml_example.json +97 -1
- teradataml/data/timestamp_data.csv +4 -0
- teradataml/data/titanic_dataset_unpivoted.csv +19 -0
- teradataml/data/uaf_example.json +55 -1
- teradataml/data/unpivot_example.json +15 -0
- teradataml/data/url_data.csv +9 -0
- teradataml/data/windowdfft.csv +16 -0
- teradataml/data/ztest_example.json +16 -0
- teradataml/dataframe/copy_to.py +9 -4
- teradataml/dataframe/data_transfer.py +125 -64
- teradataml/dataframe/dataframe.py +575 -57
- teradataml/dataframe/dataframe_utils.py +47 -9
- teradataml/dataframe/fastload.py +273 -90
- teradataml/dataframe/functions.py +339 -0
- teradataml/dataframe/row.py +160 -0
- teradataml/dataframe/setop.py +2 -2
- teradataml/dataframe/sql.py +740 -18
- teradataml/dataframe/window.py +1 -1
- teradataml/dbutils/dbutils.py +324 -18
- teradataml/geospatial/geodataframe.py +1 -1
- teradataml/geospatial/geodataframecolumn.py +1 -1
- teradataml/hyperparameter_tuner/optimizer.py +13 -13
- teradataml/lib/aed_0_1.dll +0 -0
- teradataml/opensource/sklearn/_sklearn_wrapper.py +254 -122
- teradataml/options/__init__.py +16 -5
- teradataml/options/configure.py +39 -6
- teradataml/options/display.py +2 -2
- teradataml/plot/axis.py +4 -4
- teradataml/scriptmgmt/UserEnv.py +26 -19
- teradataml/scriptmgmt/lls_utils.py +120 -16
- teradataml/table_operators/Script.py +4 -5
- teradataml/table_operators/TableOperator.py +160 -26
- teradataml/table_operators/table_operator_util.py +88 -41
- teradataml/table_operators/templates/dataframe_udf.template +63 -0
- teradataml/telemetry_utils/__init__.py +0 -0
- teradataml/telemetry_utils/queryband.py +52 -0
- teradataml/utils/validators.py +41 -3
- {teradataml-20.0.0.0.dist-info → teradataml-20.0.0.2.dist-info}/METADATA +191 -6
- {teradataml-20.0.0.0.dist-info → teradataml-20.0.0.2.dist-info}/RECORD +263 -185
- {teradataml-20.0.0.0.dist-info → teradataml-20.0.0.2.dist-info}/WHEEL +0 -0
- {teradataml-20.0.0.0.dist-info → teradataml-20.0.0.2.dist-info}/top_level.txt +0 -0
- {teradataml-20.0.0.0.dist-info → teradataml-20.0.0.2.dist-info}/zip-safe +0 -0
teradataml/dataframe/window.py
CHANGED
|
@@ -16,7 +16,7 @@ from sqlalchemy import desc, nullsfirst, nullslast
|
|
|
16
16
|
from teradataml.common.exceptions import TeradataMlException
|
|
17
17
|
from teradataml.common.utils import UtilFuncs
|
|
18
18
|
from teradataml.utils.dtypes import _Dtypes
|
|
19
|
-
from
|
|
19
|
+
from teradataml.telemetry_utils.queryband import collect_queryband
|
|
20
20
|
|
|
21
21
|
|
|
22
22
|
class Window:
|
teradataml/dbutils/dbutils.py
CHANGED
|
@@ -20,18 +20,20 @@ from teradataml.common.messagecodes import MessageCodes
|
|
|
20
20
|
from teradataml.common.exceptions import TeradataMlException
|
|
21
21
|
from teradataml.common.constants import TeradataTableKindConstants
|
|
22
22
|
from teradataml.common.sqlbundle import SQLBundle
|
|
23
|
-
from teradataml.common.constants import SQLConstants
|
|
23
|
+
from teradataml.common.constants import SQLConstants, SessionParamsSQL, SessionParamsPythonNames
|
|
24
24
|
from teradataml.common.constants import TableOperatorConstants
|
|
25
25
|
import teradataml.dataframe as tdmldf
|
|
26
26
|
from teradataml.options.configure import configure
|
|
27
27
|
from teradataml.utils.utils import execute_sql
|
|
28
28
|
from teradataml.utils.validators import _Validators
|
|
29
|
+
from teradataml.utils.internal_buffer import _InternalBuffer
|
|
29
30
|
from teradatasql import OperationalError
|
|
30
31
|
from teradatasqlalchemy.dialect import preparer, dialect as td_dialect
|
|
31
32
|
from teradatasqlalchemy.dialect import TDCreateTablePost as post
|
|
32
|
-
from
|
|
33
|
+
from teradataml.telemetry_utils.queryband import collect_queryband
|
|
33
34
|
from sqlalchemy import Table, Column, MetaData, CheckConstraint, \
|
|
34
35
|
PrimaryKeyConstraint, ForeignKeyConstraint, UniqueConstraint
|
|
36
|
+
from teradataml.utils.internal_buffer import _InternalBuffer
|
|
35
37
|
|
|
36
38
|
|
|
37
39
|
@collect_queryband(queryband='DrpTbl')
|
|
@@ -737,7 +739,7 @@ def _check_if_python_packages_installed():
|
|
|
737
739
|
"""
|
|
738
740
|
# Check if Python interpreter and add-ons packages are installed or not.
|
|
739
741
|
try:
|
|
740
|
-
query = TableOperatorConstants.CHECK_PYTHON_INSTALLED.value
|
|
742
|
+
query = TableOperatorConstants.CHECK_PYTHON_INSTALLED.value.format(configure.indb_install_location)
|
|
741
743
|
UtilFuncs._execute_query(query=query)
|
|
742
744
|
|
|
743
745
|
# If query execution is successful, then Python and add-on packages are
|
|
@@ -841,7 +843,7 @@ def db_python_package_details(names=None):
|
|
|
841
843
|
package_str = "grep -E \"{0}\" | ".format(package_str)
|
|
842
844
|
|
|
843
845
|
query = TableOperatorConstants.PACKAGE_VERSION_QUERY.value. \
|
|
844
|
-
format(package_str, configure.default_varchar_size)
|
|
846
|
+
format(configure.indb_install_location, package_str, configure.default_varchar_size)
|
|
845
847
|
|
|
846
848
|
ret_val = tdmldf.dataframe.DataFrame.from_query(query)
|
|
847
849
|
|
|
@@ -1017,26 +1019,26 @@ def _create_table(table_name,
|
|
|
1017
1019
|
def list_td_reserved_keywords(key=None, raise_error=False):
|
|
1018
1020
|
"""
|
|
1019
1021
|
DESCRIPTION:
|
|
1020
|
-
Function validates if the specified string is Teradata reserved keyword or not.
|
|
1021
|
-
If key is not specified, list all the Teradata reserved keywords.
|
|
1022
|
+
Function validates if the specified string or the list of strings is Teradata reserved keyword or not.
|
|
1023
|
+
If key is not specified or is a empty list, list all the Teradata reserved keywords.
|
|
1022
1024
|
|
|
1023
1025
|
PARAMETERS:
|
|
1024
1026
|
key:
|
|
1025
1027
|
Optional Argument.
|
|
1026
|
-
Specifies a string to validate for Teradata reserved keyword.
|
|
1027
|
-
Types: string
|
|
1028
|
+
Specifies a string or list of strings to validate for Teradata reserved keyword.
|
|
1029
|
+
Types: string or list of strings
|
|
1028
1030
|
|
|
1029
1031
|
raise_error:
|
|
1030
1032
|
Optional Argument.
|
|
1031
1033
|
Specifies whether to raise exception or not.
|
|
1032
1034
|
When set to True, an exception is raised,
|
|
1033
|
-
if specified "key"
|
|
1035
|
+
if specified "key" contains Teradata reserved keyword, otherwise not.
|
|
1034
1036
|
Default Value: False
|
|
1035
1037
|
Types: bool
|
|
1036
1038
|
|
|
1037
1039
|
RETURNS:
|
|
1038
|
-
teradataml DataFrame, if "key" is None.
|
|
1039
|
-
True, if "key"
|
|
1040
|
+
teradataml DataFrame, if "key" is None or a empty list.
|
|
1041
|
+
True, if "key" contains Teradata reserved keyword, False otherwise.
|
|
1040
1042
|
|
|
1041
1043
|
RAISES:
|
|
1042
1044
|
TeradataMlException.
|
|
@@ -1065,21 +1067,38 @@ def list_td_reserved_keywords(key=None, raise_error=False):
|
|
|
1065
1067
|
|
|
1066
1068
|
>>> # Example 3: Validate and raise exception if keyword "account" is a Teradata reserved keyword.
|
|
1067
1069
|
>>> list_td_reserved_keywords("account", raise_error=True)
|
|
1068
|
-
TeradataMlException: [Teradata][teradataml](TDML_2121) '
|
|
1070
|
+
TeradataMlException: [Teradata][teradataml](TDML_2121) '['ACCOUNT']' is a Teradata reserved keyword.
|
|
1071
|
+
|
|
1072
|
+
>>> # Example 4: Validate if the list of keywords contains Teradata reserved keyword or not.
|
|
1073
|
+
>>> list_td_reserved_keywords(["account", 'add', 'abc'])
|
|
1074
|
+
True
|
|
1075
|
+
|
|
1076
|
+
>>> # Example 5: Validate and raise exception if the list of keywords contains Teradata reserved keyword.
|
|
1077
|
+
>>> list_td_reserved_keywords(["account", 'add', 'abc'], raise_error=True)
|
|
1078
|
+
TeradataMlException: [Teradata][teradataml](TDML_2121) '['ADD', 'ACCOUNT']' is a Teradata reserved keyword.
|
|
1069
1079
|
"""
|
|
1080
|
+
|
|
1070
1081
|
from teradataml.dataframe.dataframe import DataFrame, in_schema
|
|
1071
1082
|
# Get the reserved keywords from the table
|
|
1072
1083
|
reserved_keys = DataFrame(in_schema("SYSLIB", "SQLRestrictedWords"))
|
|
1073
1084
|
|
|
1074
|
-
# If key is not passed, return the list of Teradata reserved keywords.
|
|
1075
|
-
if key is None:
|
|
1085
|
+
# If key is not passed or is a empty list, return the list of Teradata reserved keywords.
|
|
1086
|
+
if key is None or len(key) == 0:
|
|
1076
1087
|
return reserved_keys.select(['restricted_word'])
|
|
1077
1088
|
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1089
|
+
key = [key] if isinstance(key, str) else key
|
|
1090
|
+
|
|
1091
|
+
# Store the reserved keywords in buffer.
|
|
1092
|
+
if _InternalBuffer.get("reservered_words") is None:
|
|
1093
|
+
_InternalBuffer.add(reservered_words={word_[0] for word_ in reserved_keys.itertuples(name=None)})
|
|
1094
|
+
reservered_words = _InternalBuffer.get("reservered_words")
|
|
1095
|
+
|
|
1096
|
+
# Check if key contains Teradata reserved keyword or not.
|
|
1097
|
+
res_key = (k.upper() for k in key if k.upper() in reservered_words)
|
|
1098
|
+
res_key = list(res_key)
|
|
1099
|
+
if len(res_key)>0:
|
|
1081
1100
|
if raise_error:
|
|
1082
|
-
raise TeradataMlException(Messages.get_message(MessageCodes.RESERVED_KEYWORD,
|
|
1101
|
+
raise TeradataMlException(Messages.get_message(MessageCodes.RESERVED_KEYWORD, res_key),
|
|
1083
1102
|
MessageCodes.RESERVED_KEYWORD)
|
|
1084
1103
|
return True
|
|
1085
1104
|
return False
|
|
@@ -1150,6 +1169,10 @@ def _execute_query_and_generate_pandas_df(query, index=None, **kwargs):
|
|
|
1150
1169
|
if cur is not None:
|
|
1151
1170
|
cur.close()
|
|
1152
1171
|
|
|
1172
|
+
# Set coerce_float to True for Decimal type columns.
|
|
1173
|
+
if 'coerce_float' not in kwargs:
|
|
1174
|
+
kwargs['coerce_float'] = True
|
|
1175
|
+
|
|
1153
1176
|
try:
|
|
1154
1177
|
pandas_df = pd.DataFrame.from_records(data=list(tuple(row) for row in rows),
|
|
1155
1178
|
columns=columns,
|
|
@@ -1165,3 +1188,286 @@ def _execute_query_and_generate_pandas_df(query, index=None, **kwargs):
|
|
|
1165
1188
|
MessageCodes.TDMLDF_SELECT_DF_FAIL)
|
|
1166
1189
|
|
|
1167
1190
|
return pandas_df
|
|
1191
|
+
|
|
1192
|
+
class _TDSessionParams:
|
|
1193
|
+
"""
|
|
1194
|
+
A successfull connection through teradataml establishes a session with Vantage.
|
|
1195
|
+
Every session will have default parameters. For example one can set Offset value
|
|
1196
|
+
for parameter 'Session Time Zone'.
|
|
1197
|
+
This is an internal utility to store all session related parameters.
|
|
1198
|
+
"""
|
|
1199
|
+
def __init__(self, data):
|
|
1200
|
+
"""
|
|
1201
|
+
Constructor to store columns and rows of session params.
|
|
1202
|
+
|
|
1203
|
+
PARAMETERS:
|
|
1204
|
+
data:
|
|
1205
|
+
Required Argument.
|
|
1206
|
+
Specifies the Session parameters.
|
|
1207
|
+
Types: dict
|
|
1208
|
+
"""
|
|
1209
|
+
self.__session_params = data
|
|
1210
|
+
|
|
1211
|
+
def __getitem__(self, parameter):
|
|
1212
|
+
"""
|
|
1213
|
+
Return the value of Session parameter.
|
|
1214
|
+
|
|
1215
|
+
PARAMETERS:
|
|
1216
|
+
parameter:
|
|
1217
|
+
Required Argument.
|
|
1218
|
+
Specifies name of the session parameter.
|
|
1219
|
+
Types: str
|
|
1220
|
+
"""
|
|
1221
|
+
if parameter in self.__session_params:
|
|
1222
|
+
return self.__session_params[parameter]
|
|
1223
|
+
raise AttributeError("'TDSessionParams' object has no attribute '{}'".format(parameter))
|
|
1224
|
+
|
|
1225
|
+
def set_session_param(name, value):
|
|
1226
|
+
"""
|
|
1227
|
+
DESCRIPTION:
|
|
1228
|
+
Function to set the session parameter.
|
|
1229
|
+
Note:
|
|
1230
|
+
* Look at Vantage documentation for session parameters.
|
|
1231
|
+
|
|
1232
|
+
PARAMETERS:
|
|
1233
|
+
name:
|
|
1234
|
+
Required Argument.
|
|
1235
|
+
Specifies the name of the parameter to set.
|
|
1236
|
+
Permitted Values: timezone, calendar, account, character_set_unicode,
|
|
1237
|
+
collation, constraint, database, dateform, debug_function,
|
|
1238
|
+
dot_notation, isolated_loading, function_trace, json_ignore_errors,
|
|
1239
|
+
searchuifdbpath, transaction_isolation_level, query_band, udfsearchpath
|
|
1240
|
+
Types: str
|
|
1241
|
+
|
|
1242
|
+
value:
|
|
1243
|
+
Required Argument.
|
|
1244
|
+
Specifies the value for the parameter "name" to set.
|
|
1245
|
+
Permitted Values:
|
|
1246
|
+
1. timezone: timezone strings
|
|
1247
|
+
2. calendar: Teradata, ISO, Compatible
|
|
1248
|
+
3. character_set_unicode: ON, OFF
|
|
1249
|
+
4. account: should be a list in which first item should be "account string" second should be
|
|
1250
|
+
either SESSION or REQUEST.
|
|
1251
|
+
5. collation: ASCII, CHARSET_COLL, EBCDIC, HOST, JIS_COLL, MULTINATIONAL
|
|
1252
|
+
6. constraint: row_level_security_constraint_name {( level_name | category_name [,...] | NULL )}
|
|
1253
|
+
where,
|
|
1254
|
+
row_level_security_constraint_name:
|
|
1255
|
+
Name of an existing constraint.
|
|
1256
|
+
The specified constraint_name must be currently assigned to the user.
|
|
1257
|
+
User can specify a maximum of 6 hierarchical constraints and 2 non-hierarchical
|
|
1258
|
+
constraints per SET SESSION CONSTRAINT statement.
|
|
1259
|
+
level_name:
|
|
1260
|
+
Name of a hierarchical level, valid for the constraint_name, that is to replace the
|
|
1261
|
+
default level.
|
|
1262
|
+
The specified level_name must be currently assigned to the user. Otherwise, Vantage
|
|
1263
|
+
returns an error to the requestor.
|
|
1264
|
+
category_name:
|
|
1265
|
+
A set of one or more existing non-hierarchical category names valid for the
|
|
1266
|
+
constraint_name.
|
|
1267
|
+
Because all assigned category (non-hierarchical) constraint values assigned to a
|
|
1268
|
+
user are automatically active, "set_session_param" is only useful to specify a
|
|
1269
|
+
subset of the assigned categories for the constraint.
|
|
1270
|
+
For example, assume that User BOB has 3 country codes, and wants to load a table
|
|
1271
|
+
with data that is to be made available to User CARL who only has rights to see data
|
|
1272
|
+
for his own country. User BOB can use "set_session_param" to specify only the
|
|
1273
|
+
country code for User CARL when loading the data so Carl can access the data later.
|
|
1274
|
+
7. database: Name of the new default database for the remainder of the current session.
|
|
1275
|
+
8. dateform: ANSIDATE, INTEGERDATE
|
|
1276
|
+
9. debug_function: should be a list in which first item should be "function_name" second should be
|
|
1277
|
+
either ON or OFF.
|
|
1278
|
+
10. dot_notation: DEFAULT, LIST, NULL ERROR
|
|
1279
|
+
11. isolated_loading: NO, '', CONCURRENT
|
|
1280
|
+
12. function_trace: should be a list first item should be "mask_string" and second should be table name.
|
|
1281
|
+
13. json_ignore_errors: ON, OFF
|
|
1282
|
+
14. searchuifdbpath: string in format 'database_name, user_name'
|
|
1283
|
+
15. transaction_isolation_level: READ UNCOMMITTED, RU, SERIALIZABLE, SR
|
|
1284
|
+
16. query_band: should be a list first item should be "band_specification" and second should be either
|
|
1285
|
+
SESSION or TRANSACTION
|
|
1286
|
+
17. udfsearchpath: should be a list first item should be "database_name" and second should be "udf_name"
|
|
1287
|
+
Types: str or list of strings
|
|
1288
|
+
|
|
1289
|
+
Returns:
|
|
1290
|
+
True, if session parameter is set successfully.
|
|
1291
|
+
|
|
1292
|
+
RAISES:
|
|
1293
|
+
ValueError, teradatasql.OperationalError
|
|
1294
|
+
|
|
1295
|
+
EXAMPLES:
|
|
1296
|
+
# Example 1: Set time zone offset for the session as the system default.
|
|
1297
|
+
>>> set_session_param('timezone', "'LOCAL'")
|
|
1298
|
+
True
|
|
1299
|
+
|
|
1300
|
+
# Example 2: Set time zone to "AMERICA PACIFIC".
|
|
1301
|
+
>>> set_session_param('timezone', "'AMERICA PACIFIC'")
|
|
1302
|
+
True
|
|
1303
|
+
|
|
1304
|
+
# Example 3: Set time zone to "-07:00".
|
|
1305
|
+
>>> set_session_param('timezone', "'-07:00'")
|
|
1306
|
+
True
|
|
1307
|
+
|
|
1308
|
+
# Example 4: Set time zone to 3 hours ahead of 'GMT'.
|
|
1309
|
+
>>> set_session_param('timezone', "3")
|
|
1310
|
+
True
|
|
1311
|
+
|
|
1312
|
+
# Example 6: Set calendar to 'COMPATIBLE'.
|
|
1313
|
+
>>> set_session_param('calendar', "COMPATIBLE")
|
|
1314
|
+
True
|
|
1315
|
+
|
|
1316
|
+
# Example 7: Dynamically changes your account to 'dbc' for the remainder of the session.
|
|
1317
|
+
>>> set_session_param('account', ['dbc', 'SESSION'])
|
|
1318
|
+
True
|
|
1319
|
+
|
|
1320
|
+
# Example 8: Enables Unicode Pass Through processing.
|
|
1321
|
+
>>> set_session_param('character_set_unicode', 'ON')
|
|
1322
|
+
True
|
|
1323
|
+
|
|
1324
|
+
# Example 9: Session set to ASCII collation.
|
|
1325
|
+
>>> set_session_param('collation', 'ASCII')
|
|
1326
|
+
True
|
|
1327
|
+
|
|
1328
|
+
# Example 10: The resulting session has a row-level security label consisting of an unclassified level
|
|
1329
|
+
# and nato category.
|
|
1330
|
+
>>> set_session_param('constraint', 'classification_category (norway)')
|
|
1331
|
+
True
|
|
1332
|
+
|
|
1333
|
+
# Example 11: Changes the default database for the session.
|
|
1334
|
+
>>> set_session_param('database', 'alice')
|
|
1335
|
+
True
|
|
1336
|
+
|
|
1337
|
+
# Example 12: Changes the DATE format to 'INTEGERDATE'.
|
|
1338
|
+
>>> set_session_param('dateform', 'INTEGERDATE')
|
|
1339
|
+
True
|
|
1340
|
+
|
|
1341
|
+
# Example 13: Enable Debugging for the Session.
|
|
1342
|
+
>>> set_session_param('debug_function', ['function_name', 'ON'])
|
|
1343
|
+
True
|
|
1344
|
+
|
|
1345
|
+
# Example 14: Sets the session response for dot notation query result.
|
|
1346
|
+
>>> set_session_param('dot_notation', 'DEFAULT')
|
|
1347
|
+
True
|
|
1348
|
+
|
|
1349
|
+
# Example 15: DML operations are not performed as concurrent load isolated operations.
|
|
1350
|
+
>>> set_session_param('isolated_loading', 'NO')
|
|
1351
|
+
True
|
|
1352
|
+
|
|
1353
|
+
# Example 16: Enables function trace output for debugging external user-defined functions and
|
|
1354
|
+
# external SQL procedures for the current session.
|
|
1355
|
+
>>> set_session_param('function_trace', ["'diag,3'", 'titanic'])
|
|
1356
|
+
True
|
|
1357
|
+
|
|
1358
|
+
# Example 17: Enables the validation of JSON data on INSERT operations.
|
|
1359
|
+
>>> set_session_param('json_ignore_errors', 'ON')
|
|
1360
|
+
True
|
|
1361
|
+
|
|
1362
|
+
# Example 18: Sets the database search path for the SCRIPT execution in the SessionTbl.SearchUIFDBPath column.
|
|
1363
|
+
>>> set_session_param('SEARCHUIFDBPATH', 'dbc, alice')
|
|
1364
|
+
True
|
|
1365
|
+
|
|
1366
|
+
# Example 19: Sets the read-only locking severity for all SELECT requests made against nontemporal tables,
|
|
1367
|
+
# whether they are outer SELECT requests or subqueries, in the current session to READ regardless
|
|
1368
|
+
# of the setting for the DBS Control parameter AccessLockForUncomRead.
|
|
1369
|
+
# Note: SR and SERIALIZABLE are synonyms.
|
|
1370
|
+
>>> set_session_param('TRANSACTION_ISOLATION_LEVEL', 'SR')
|
|
1371
|
+
True
|
|
1372
|
+
|
|
1373
|
+
# Example 20: This example uses the PROXYROLE name:value pair in a query band to set the proxy
|
|
1374
|
+
# role in a trusted session to a specific role.
|
|
1375
|
+
>>> set_session_param('query_band', ["'PROXYUSER=fred;PROXYROLE=administration;'", 'SESSION'])
|
|
1376
|
+
True
|
|
1377
|
+
|
|
1378
|
+
# Example 21: Allows you to specify a custom UDF search path. When you execute a UDF,
|
|
1379
|
+
# Vantage searches this path first, before looking in the default Vantage
|
|
1380
|
+
# search path for the UDF.
|
|
1381
|
+
>>> set_session_param('udfsearchpath', ["alice, SYSLIB, TD_SYSFNLIB", 'bitor'])
|
|
1382
|
+
True
|
|
1383
|
+
"""
|
|
1384
|
+
# Validate argument types
|
|
1385
|
+
function_args = []
|
|
1386
|
+
function_args.append(["name", name, True, str, True])
|
|
1387
|
+
function_args.append(["value", value, True, (int, str, float, list), False])
|
|
1388
|
+
_Validators._validate_function_arguments(function_args)
|
|
1389
|
+
|
|
1390
|
+
if not isinstance(value, list):
|
|
1391
|
+
value = [value]
|
|
1392
|
+
|
|
1393
|
+
# Before setting the session, first extract the session parameters
|
|
1394
|
+
# and store it in buffer. This helps while unsetting the parameter.
|
|
1395
|
+
result = execute_sql('help session')
|
|
1396
|
+
data = dict(zip(
|
|
1397
|
+
[param[0] for param in result.description],
|
|
1398
|
+
[value for value in next(result)]
|
|
1399
|
+
))
|
|
1400
|
+
_InternalBuffer.add(session_params = _TDSessionParams(data))
|
|
1401
|
+
# Store function name of 'DEBUG_FUNCTION' used.
|
|
1402
|
+
_InternalBuffer.add(function_name = value[0] if name.upper() == 'DEBUG_FUNCTION' else '')
|
|
1403
|
+
|
|
1404
|
+
# Set the session parameter.
|
|
1405
|
+
execute_sql(getattr(SessionParamsSQL, name.upper()).format(*value))
|
|
1406
|
+
|
|
1407
|
+
return True
|
|
1408
|
+
|
|
1409
|
+
def unset_session_param(name):
|
|
1410
|
+
"""
|
|
1411
|
+
DESCRIPTION:
|
|
1412
|
+
Function to unset the session parameter.
|
|
1413
|
+
|
|
1414
|
+
PARAMETERS:
|
|
1415
|
+
name:
|
|
1416
|
+
Required Argument.
|
|
1417
|
+
Specifies the parameter to unset for the session.
|
|
1418
|
+
Permitted Values: timezone, account, calendar, collation,
|
|
1419
|
+
database, dataform, character_set_unicode,
|
|
1420
|
+
debug_function, isolated_loading, function_trace,
|
|
1421
|
+
json_ignore_errors, query_band
|
|
1422
|
+
Type: str
|
|
1423
|
+
|
|
1424
|
+
Returns:
|
|
1425
|
+
True, if successfully unsets the session parameter.
|
|
1426
|
+
|
|
1427
|
+
RAISES:
|
|
1428
|
+
ValueError, teradatasql.OperationalError
|
|
1429
|
+
|
|
1430
|
+
EXAMPLES:
|
|
1431
|
+
# Example 1: unset session to previous time zone.
|
|
1432
|
+
>>> set_session_param('timezone', "'GMT+1'")
|
|
1433
|
+
True
|
|
1434
|
+
>>> unset_session_param("timezone")
|
|
1435
|
+
True
|
|
1436
|
+
|
|
1437
|
+
"""
|
|
1438
|
+
# Validate argument types
|
|
1439
|
+
function_args = []
|
|
1440
|
+
function_args.append(["name", name, True, str, True])
|
|
1441
|
+
_Validators._validate_function_arguments(function_args)
|
|
1442
|
+
|
|
1443
|
+
# Check whether session param is set or not first.
|
|
1444
|
+
session_params = _InternalBuffer.get('session_params')
|
|
1445
|
+
if session_params is None:
|
|
1446
|
+
msg_code = MessageCodes.FUNC_EXECUTION_FAILED
|
|
1447
|
+
error_msg = Messages.get_message(msg_code, "unset_session_param", "Set the parameter before unsetting it.")
|
|
1448
|
+
raise TeradataMlException(error_msg, msg_code)
|
|
1449
|
+
# unset_values stores params which are not available in _InternalBuffer, to unset create a dictionary
|
|
1450
|
+
# with param as key and unset param as value
|
|
1451
|
+
unset_values = {"CHARACTER_SET_UNICODE": "OFF", "DEBUG_FUNCTION": [_InternalBuffer.get('function_name'), "OFF"],
|
|
1452
|
+
"ISOLATED_LOADING":"NO", "FUNCTION_TRACE":"SET SESSION FUNCTION TRACE OFF",
|
|
1453
|
+
"JSON_IGNORE_ERRORS": "OFF", "QUERY_BAND": ["", "SESSION"]}
|
|
1454
|
+
|
|
1455
|
+
# If 'name' in unset_values unset the params
|
|
1456
|
+
if name.upper() in unset_values:
|
|
1457
|
+
# When name is 'FUNCTION_TRACE' unset_values already have query for that, use execute_sql on that.
|
|
1458
|
+
if name.upper() == "FUNCTION_TRACE":
|
|
1459
|
+
execute_sql(unset_values[name.upper()])
|
|
1460
|
+
# When name is other than 'FUNCTION_TRACE' use value and key of unset_values to unset param.
|
|
1461
|
+
else:
|
|
1462
|
+
set_session_param(name, unset_values[name.upper()])
|
|
1463
|
+
return True
|
|
1464
|
+
|
|
1465
|
+
previous_value = "{}".format(session_params[getattr(SessionParamsPythonNames, name.upper())]) \
|
|
1466
|
+
if name.upper() != 'TIMEZONE' else "'{}'".format(session_params[getattr(SessionParamsPythonNames, name.upper())])
|
|
1467
|
+
|
|
1468
|
+
if name.upper() == "ACCOUNT":
|
|
1469
|
+
previous_value = [previous_value, 'SESSION']
|
|
1470
|
+
set_session_param(name, previous_value)
|
|
1471
|
+
|
|
1472
|
+
return True
|
|
1473
|
+
|
|
@@ -22,7 +22,7 @@ from teradataml.geospatial.geodataframecolumn import GeoDataFrameColumn
|
|
|
22
22
|
from teradataml.plot.plot import _Plot
|
|
23
23
|
from teradataml.utils.validators import _Validators
|
|
24
24
|
from teradatasqlalchemy import (GEOMETRY, MBR, MBB)
|
|
25
|
-
from
|
|
25
|
+
from teradataml.telemetry_utils.queryband import collect_queryband
|
|
26
26
|
|
|
27
27
|
class GeoDataFrame(DataFrame):
|
|
28
28
|
"""
|
|
@@ -23,7 +23,7 @@ from teradataml.dataframe.vantage_function_types import \
|
|
|
23
23
|
from teradataml.geospatial.geometry_types import GeometryType
|
|
24
24
|
from teradataml.utils.validators import _Validators
|
|
25
25
|
from teradatasqlalchemy import (GEOMETRY, MBR, MBB, BLOB, CLOB)
|
|
26
|
-
from
|
|
26
|
+
from teradataml.telemetry_utils.queryband import collect_queryband
|
|
27
27
|
|
|
28
28
|
# Geospatial Function name mappers
|
|
29
29
|
geo_func_as_property = \
|
|
@@ -302,7 +302,7 @@ class _BaseSearch:
|
|
|
302
302
|
'batch_size': 75, 'iter_max': 100, 'lambda1': 0.1, 'alpha': 0.5,
|
|
303
303
|
'iter_num_no_change': 60, 'tolerance': 0.01, 'intercept': False,
|
|
304
304
|
'learning_rate': 'INVTIME', 'initial_data': 0.5, 'decay_rate': 0.5,
|
|
305
|
-
'momentum': 0.6, '
|
|
305
|
+
'momentum': 0.6, 'nesterov': True, 'local_sgd_iterations': 1,
|
|
306
306
|
'data': '"ALICE"."ml__select__1696593660430612"'},
|
|
307
307
|
'data_id': 'DF_0'},
|
|
308
308
|
{'param': {'input_columns': ['MedInc', 'HouseAge', 'AveRooms', 'AveBedrms',
|
|
@@ -311,7 +311,7 @@ class _BaseSearch:
|
|
|
311
311
|
'batch_size': 75, 'iter_max': 100, 'lambda1': 0.1, 'alpha': 0.5,
|
|
312
312
|
'iter_num_no_change': 60, 'tolerance': 0.01, 'intercept': False,
|
|
313
313
|
'learning_rate': 'INVTIME', 'initial_data': 0.5, 'decay_rate': 0.5,
|
|
314
|
-
'momentum': 0.6, '
|
|
314
|
+
'momentum': 0.6, 'nesterov': True, 'local_sgd_iterations': 1,
|
|
315
315
|
'data': '"ALICE"."ml__select__1696593660430612"'},
|
|
316
316
|
'data_id': 'DF_1'}]
|
|
317
317
|
"""
|
|
@@ -450,7 +450,7 @@ class _BaseSearch:
|
|
|
450
450
|
'batch_size': 50, 'iter_max': 301, 'lambda1': 0.1, 'alpha': 0.5,
|
|
451
451
|
'iter_num_no_change': 60, 'tolerance': 0.01, 'intercept': False,
|
|
452
452
|
'learning_rate': 'INVTIME', 'initial_data': 0.5, 'decay_rate': 0.5,
|
|
453
|
-
'momentum': 0.6, '
|
|
453
|
+
'momentum': 0.6, 'nesterov': True, 'local_sgd_iterations': 1,
|
|
454
454
|
'data': '"ALICE"."ml__select__1696595493985650"'}
|
|
455
455
|
"""
|
|
456
456
|
return self.__best_params_
|
|
@@ -858,7 +858,7 @@ class _BaseSearch:
|
|
|
858
858
|
id_column=sample_id_column,
|
|
859
859
|
seed=sample_seed)
|
|
860
860
|
# Represent the sample. Otherwise, split consistency is lost.
|
|
861
|
-
|
|
861
|
+
train_test_sample.materialize()
|
|
862
862
|
|
|
863
863
|
_sample_id = "sampleid"
|
|
864
864
|
_split_value = [1, 2]
|
|
@@ -874,8 +874,8 @@ class _BaseSearch:
|
|
|
874
874
|
_sample_id, axis = 1)
|
|
875
875
|
|
|
876
876
|
# Represent train and test dataset.
|
|
877
|
-
|
|
878
|
-
|
|
877
|
+
_train_data.materialize()
|
|
878
|
+
_test_data.materialize()
|
|
879
879
|
|
|
880
880
|
# Update train and test dataset using data id with train and test
|
|
881
881
|
# arguments. Unique Data-structure to store train and test sampled
|
|
@@ -1206,7 +1206,7 @@ class _BaseSearch:
|
|
|
1206
1206
|
"iter_max":(100, 301),
|
|
1207
1207
|
"intercept":False,
|
|
1208
1208
|
"learning_rate":"INVTIME",
|
|
1209
|
-
"
|
|
1209
|
+
"nesterov":True,
|
|
1210
1210
|
"local_sgd_iterations":1}
|
|
1211
1211
|
|
|
1212
1212
|
>>> # Create "optimizer_obj" using any search algorithm and perform
|
|
@@ -2344,7 +2344,7 @@ class GridSearch(_BaseSearch):
|
|
|
2344
2344
|
"initial_data":0.5,
|
|
2345
2345
|
"decay_rate":0.5,
|
|
2346
2346
|
"momentum":0.6,
|
|
2347
|
-
"
|
|
2347
|
+
"nesterov":True,
|
|
2348
2348
|
"local_sgd_iterations":1}
|
|
2349
2349
|
|
|
2350
2350
|
>>> # Required argument for model prediction and evaluation.
|
|
@@ -2693,7 +2693,7 @@ class GridSearch(_BaseSearch):
|
|
|
2693
2693
|
"initial_data":0.5,
|
|
2694
2694
|
"decay_rate":0.5,
|
|
2695
2695
|
"momentum":0.6,
|
|
2696
|
-
"
|
|
2696
|
+
"nesterov":True,
|
|
2697
2697
|
"local_sgd_iterations":1}
|
|
2698
2698
|
|
|
2699
2699
|
>>> # Initialize the GridSearch optimizer with model trainer
|
|
@@ -3084,7 +3084,7 @@ class GridSearch(_BaseSearch):
|
|
|
3084
3084
|
"iter_max":(100, 301),
|
|
3085
3085
|
"intercept":False,
|
|
3086
3086
|
"learning_rate":"INVTIME",
|
|
3087
|
-
"
|
|
3087
|
+
"nesterov":True,
|
|
3088
3088
|
"local_sgd_iterations":1}
|
|
3089
3089
|
|
|
3090
3090
|
>>> # Create "optimizer_obj" using GridSearch algorithm and perform
|
|
@@ -3277,7 +3277,7 @@ class RandomSearch(_BaseSearch):
|
|
|
3277
3277
|
"initial_data":0.5,
|
|
3278
3278
|
"decay_rate":0.5,
|
|
3279
3279
|
"momentum":0.6,
|
|
3280
|
-
"
|
|
3280
|
+
"nesterov":True,
|
|
3281
3281
|
"local_sgd_iterations":1}
|
|
3282
3282
|
|
|
3283
3283
|
>>> # Import trainer function and optimizer.
|
|
@@ -3374,7 +3374,7 @@ class RandomSearch(_BaseSearch):
|
|
|
3374
3374
|
'batch_size': 50, 'iter_max': 301, 'lambda1': 0.1, 'alpha': 0.5,
|
|
3375
3375
|
'iter_num_no_change': 60, 'tolerance': 0.01, 'intercept': False,
|
|
3376
3376
|
'learning_rate': 'INVTIME', 'initial_data': 0.5, 'decay_rate': 0.5,
|
|
3377
|
-
'momentum': 0.6, '
|
|
3377
|
+
'momentum': 0.6, 'nesterov': True, 'local_sgd_iterations': 1,
|
|
3378
3378
|
'data': '"ALICE"."ml__select__1696595493985650"'}
|
|
3379
3379
|
|
|
3380
3380
|
>>> # Update the default model.
|
|
@@ -3697,7 +3697,7 @@ class RandomSearch(_BaseSearch):
|
|
|
3697
3697
|
"iter_max":(100, 301),
|
|
3698
3698
|
"intercept":False,
|
|
3699
3699
|
"learning_rate":"INVTIME",
|
|
3700
|
-
"
|
|
3700
|
+
"nesterov":True,
|
|
3701
3701
|
"local_sgd_iterations":1}
|
|
3702
3702
|
|
|
3703
3703
|
>>> # Create "optimizer_obj" using RandomSearch algorithm and perform
|
teradataml/lib/aed_0_1.dll
CHANGED
|
Binary file
|