teradataml 20.0.0.1__py3-none-any.whl → 20.0.0.3__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 +306 -0
- teradataml/__init__.py +10 -3
- teradataml/_version.py +1 -1
- teradataml/analytics/__init__.py +3 -2
- teradataml/analytics/analytic_function_executor.py +299 -16
- teradataml/analytics/analytic_query_generator.py +92 -0
- teradataml/analytics/byom/__init__.py +3 -2
- teradataml/analytics/json_parser/metadata.py +13 -3
- teradataml/analytics/json_parser/utils.py +13 -6
- teradataml/analytics/meta_class.py +40 -1
- teradataml/analytics/sqle/DecisionTreePredict.py +1 -1
- teradataml/analytics/sqle/__init__.py +11 -2
- teradataml/analytics/table_operator/__init__.py +4 -3
- teradataml/analytics/uaf/__init__.py +21 -2
- teradataml/analytics/utils.py +66 -1
- teradataml/analytics/valib.py +1 -1
- teradataml/automl/__init__.py +1502 -323
- teradataml/automl/custom_json_utils.py +139 -61
- teradataml/automl/data_preparation.py +247 -307
- teradataml/automl/data_transformation.py +32 -12
- teradataml/automl/feature_engineering.py +325 -86
- teradataml/automl/model_evaluation.py +44 -35
- teradataml/automl/model_training.py +122 -153
- teradataml/catalog/byom.py +8 -8
- teradataml/clients/pkce_client.py +1 -1
- teradataml/common/__init__.py +2 -1
- teradataml/common/constants.py +72 -0
- teradataml/common/deprecations.py +13 -7
- teradataml/common/garbagecollector.py +152 -120
- teradataml/common/messagecodes.py +11 -2
- teradataml/common/messages.py +4 -1
- teradataml/common/sqlbundle.py +26 -4
- teradataml/common/utils.py +225 -14
- teradataml/common/wrapper_utils.py +1 -1
- teradataml/context/context.py +82 -2
- teradataml/data/SQL_Fundamentals.pdf +0 -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/dataframe_example.json +27 -1
- teradataml/data/docs/sqle/docs_17_20/CFilter.py +132 -0
- teradataml/data/docs/sqle/docs_17_20/NaiveBayes.py +162 -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/Shap.py +203 -0
- 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/TextParser.py +3 -3
- teradataml/data/docs/sqle/docs_17_20/Unpivoting.py +216 -0
- teradataml/data/docs/tableoperator/docs_17_20/Image2Matrix.py +118 -0
- 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/CopyArt.py +145 -0
- 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/DickeyFuller.py +18 -21
- 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/grocery_transaction.csv +19 -0
- teradataml/data/idwt2d_dataTable.csv +5 -0
- teradataml/data/idwt_dataTable.csv +8 -0
- teradataml/data/idwt_filterTable.csv +3 -0
- teradataml/data/interval_data.csv +5 -0
- teradataml/data/jsons/paired_functions.json +14 -0
- teradataml/data/jsons/sqle/17.20/TD_CFilter.json +118 -0
- 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_OneClassSVM.json +9 -9
- teradataml/data/jsons/sqle/17.20/TD_Pivoting.json +280 -0
- 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_TextParser.json +1 -1
- teradataml/data/jsons/sqle/17.20/TD_Unpivoting.json +235 -0
- teradataml/data/jsons/sqle/20.00/TD_KMeans.json +250 -0
- teradataml/data/jsons/sqle/20.00/TD_SMOTE.json +266 -0
- teradataml/data/jsons/sqle/20.00/TD_VectorDistance.json +278 -0
- teradataml/data/jsons/storedprocedure/17.20/TD_COPYART.json +71 -0
- teradataml/data/jsons/storedprocedure/17.20/TD_FILTERFACTORY1D.json +150 -0
- teradataml/data/jsons/tableoperator/17.20/IMAGE2MATRIX.json +53 -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_DICKEY_FULLER.json +10 -19
- 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 +210 -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 +410 -0
- teradataml/data/load_example_data.py +8 -2
- teradataml/data/medical_readings.csv +101 -0
- teradataml/data/naivebayestextclassifier_example.json +1 -1
- teradataml/data/naivebayestextclassifierpredict_example.json +11 -0
- teradataml/data/patient_profile.csv +101 -0
- teradataml/data/peppers.png +0 -0
- teradataml/data/real_values.csv +14 -0
- teradataml/data/sax_example.json +8 -0
- teradataml/data/scripts/deploy_script.py +1 -1
- teradataml/data/scripts/lightgbm/dataset.template +157 -0
- teradataml/data/scripts/lightgbm/lightgbm_class_functions.template +247 -0
- teradataml/data/scripts/lightgbm/lightgbm_function.template +216 -0
- teradataml/data/scripts/lightgbm/lightgbm_sklearn.template +159 -0
- teradataml/data/scripts/sklearn/sklearn_fit.py +194 -160
- teradataml/data/scripts/sklearn/sklearn_fit_predict.py +136 -115
- teradataml/data/scripts/sklearn/sklearn_function.template +34 -16
- teradataml/data/scripts/sklearn/sklearn_model_selection_split.py +155 -137
- teradataml/data/scripts/sklearn/sklearn_neighbors.py +1 -1
- teradataml/data/scripts/sklearn/sklearn_score.py +12 -3
- teradataml/data/scripts/sklearn/sklearn_transform.py +162 -24
- teradataml/data/star_pivot.csv +8 -0
- teradataml/data/target_udt_data.csv +8 -0
- teradataml/data/templates/open_source_ml.json +3 -1
- teradataml/data/teradataml_example.json +20 -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/vectordistance_example.json +4 -0
- teradataml/data/windowdfft.csv +16 -0
- teradataml/dataframe/copy_to.py +1 -1
- teradataml/dataframe/data_transfer.py +5 -3
- teradataml/dataframe/dataframe.py +1002 -201
- teradataml/dataframe/fastload.py +3 -3
- teradataml/dataframe/functions.py +867 -0
- teradataml/dataframe/row.py +160 -0
- teradataml/dataframe/setop.py +2 -2
- teradataml/dataframe/sql.py +840 -33
- teradataml/dataframe/window.py +1 -1
- teradataml/dbutils/dbutils.py +878 -34
- teradataml/dbutils/filemgr.py +48 -1
- 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/__init__.py +1 -1
- teradataml/opensource/{sklearn/_class.py → _class.py} +102 -17
- teradataml/opensource/_lightgbm.py +950 -0
- teradataml/opensource/{sklearn/_wrapper_utils.py → _wrapper_utils.py} +1 -2
- teradataml/opensource/{sklearn/constants.py → constants.py} +13 -10
- teradataml/opensource/sklearn/__init__.py +0 -1
- teradataml/opensource/sklearn/_sklearn_wrapper.py +1019 -574
- teradataml/options/__init__.py +9 -23
- teradataml/options/configure.py +42 -4
- teradataml/options/display.py +2 -2
- teradataml/plot/axis.py +4 -4
- teradataml/scriptmgmt/UserEnv.py +13 -9
- teradataml/scriptmgmt/lls_utils.py +77 -23
- teradataml/store/__init__.py +13 -0
- teradataml/store/feature_store/__init__.py +0 -0
- teradataml/store/feature_store/constants.py +291 -0
- teradataml/store/feature_store/feature_store.py +2223 -0
- teradataml/store/feature_store/models.py +1505 -0
- teradataml/store/vector_store/__init__.py +1586 -0
- teradataml/table_operators/Script.py +2 -2
- teradataml/table_operators/TableOperator.py +106 -20
- teradataml/table_operators/query_generator.py +3 -0
- teradataml/table_operators/table_operator_query_generator.py +3 -1
- teradataml/table_operators/table_operator_util.py +102 -56
- teradataml/table_operators/templates/dataframe_register.template +69 -0
- 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/dtypes.py +4 -2
- teradataml/utils/validators.py +34 -2
- {teradataml-20.0.0.1.dist-info → teradataml-20.0.0.3.dist-info}/METADATA +311 -3
- {teradataml-20.0.0.1.dist-info → teradataml-20.0.0.3.dist-info}/RECORD +240 -157
- {teradataml-20.0.0.1.dist-info → teradataml-20.0.0.3.dist-info}/WHEEL +0 -0
- {teradataml-20.0.0.1.dist-info → teradataml-20.0.0.3.dist-info}/top_level.txt +0 -0
- {teradataml-20.0.0.1.dist-info → teradataml-20.0.0.3.dist-info}/zip-safe +0 -0
teradataml/dbutils/filemgr.py
CHANGED
|
@@ -15,12 +15,16 @@ import os
|
|
|
15
15
|
from pathlib import Path
|
|
16
16
|
from sqlalchemy import func
|
|
17
17
|
from sqlalchemy.sql.expression import text
|
|
18
|
+
import teradataml.dataframe as tdmldf
|
|
19
|
+
from teradataml.utils.internal_buffer import _InternalBuffer
|
|
18
20
|
from teradatasql import OperationalError as SqlOperationalError
|
|
19
21
|
from teradataml.common.exceptions import TeradataMlException
|
|
20
22
|
from teradataml.common.messages import Messages
|
|
21
23
|
from teradataml.common.messagecodes import MessageCodes
|
|
22
|
-
from teradataml.dbutils.dbutils import _execute_stored_procedure
|
|
24
|
+
from teradataml.dbutils.dbutils import _execute_stored_procedure, set_session_param
|
|
23
25
|
from teradataml.utils.validators import _Validators
|
|
26
|
+
from teradataml.options.configure import configure
|
|
27
|
+
from teradataml.common.constants import TableOperatorConstants
|
|
24
28
|
|
|
25
29
|
def install_file(file_identifier, file_path = None, file_on_client = True, is_binary = False,
|
|
26
30
|
replace = False, force_replace = False, suppress_output = False):
|
|
@@ -265,3 +269,46 @@ def remove_file(file_identifier, force_remove = None, suppress_output = False):
|
|
|
265
269
|
raise TeradataMlException(Messages.get_message(MessageCodes.REMOVE_FILE_FAILED, file_identifier) +
|
|
266
270
|
'\n' + str(err),
|
|
267
271
|
MessageCodes.REMOVE_FILE_FAILED)
|
|
272
|
+
|
|
273
|
+
def list_files():
|
|
274
|
+
"""
|
|
275
|
+
DESCRIPTION:
|
|
276
|
+
List all the files installed in Vantage or in Vantage Languages Ecosystem.
|
|
277
|
+
|
|
278
|
+
PARAMETERS:
|
|
279
|
+
None
|
|
280
|
+
|
|
281
|
+
RETURNS:
|
|
282
|
+
teradataml DataFrame
|
|
283
|
+
|
|
284
|
+
RAISES:
|
|
285
|
+
TeradataMLException.
|
|
286
|
+
|
|
287
|
+
EXAMPLES:
|
|
288
|
+
# Example 1: List files installed in the Vantage Ecosystem.
|
|
289
|
+
# Install the file mapper.py found at the relative path data/scripts/
|
|
290
|
+
>>> install_file (file_identifier='mapper', file_path='data/scripts/mapper.py')
|
|
291
|
+
File mapper.py installed in Vantage
|
|
292
|
+
|
|
293
|
+
# List file installed in the Vantage Ecosystem.
|
|
294
|
+
>>> list_files()
|
|
295
|
+
Files
|
|
296
|
+
0 mapper.py
|
|
297
|
+
"""
|
|
298
|
+
# Get the current database name.
|
|
299
|
+
import teradataml.context.context as context
|
|
300
|
+
database = context._get_current_databasename()
|
|
301
|
+
|
|
302
|
+
# set_session_param maintains a buffer of session parameters.
|
|
303
|
+
# If the session parameter is not set or if setted SearchUIFDBPath is different
|
|
304
|
+
# from the current database, then we will set the SEARCHUIFDBPATH to the current
|
|
305
|
+
# database. This will avoid setting the SEARCHUIFDBPATH multiple times.
|
|
306
|
+
session_params = _InternalBuffer.get('session_params')
|
|
307
|
+
if session_params is None or session_params["SearchUIFDBPath"] != database:
|
|
308
|
+
set_session_param("SEARCHUIFDBPATH", database)
|
|
309
|
+
|
|
310
|
+
# Get the query to list files installed in Vantage.
|
|
311
|
+
list_files_query = TableOperatorConstants.SCRIPT_LIST_FILES_QUERY.value \
|
|
312
|
+
.format(database, configure.default_varchar_size)
|
|
313
|
+
|
|
314
|
+
return tdmldf.dataframe.DataFrame.from_query(list_files_query)
|
|
@@ -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
|
|
@@ -1 +1 @@
|
|
|
1
|
-
from teradataml.opensource.
|
|
1
|
+
from teradataml.opensource._class import td_sklearn, td_lightgbm
|
|
@@ -16,10 +16,9 @@
|
|
|
16
16
|
|
|
17
17
|
from importlib import import_module
|
|
18
18
|
from teradataml.opensource.sklearn._sklearn_wrapper import _SkLearnObjectWrapper, _SKLearnFunctionWrapper
|
|
19
|
-
from teradataml.opensource.
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
sklearn_functions = ["k_means"]
|
|
19
|
+
from teradataml.opensource._lightgbm import _LightgbmDatasetWrapper, \
|
|
20
|
+
_LightgbmFunctionWrapper, _LightgbmBoosterWrapper, _LighgbmSklearnWrapper
|
|
21
|
+
from teradataml.opensource.constants import _SKL_MODULES, _LIGHTGBM_MODULES
|
|
23
22
|
|
|
24
23
|
|
|
25
24
|
class _OpenSource:
|
|
@@ -33,21 +32,30 @@ class _OpenSource:
|
|
|
33
32
|
self._object_wrapper = None
|
|
34
33
|
self._function_wrapper = None
|
|
35
34
|
|
|
35
|
+
def _get_module_and_class_instance(self, name):
|
|
36
|
+
"""
|
|
37
|
+
Internal function to get the module and class instance/function which will
|
|
38
|
+
be passed to object/function wrapper.
|
|
39
|
+
"""
|
|
40
|
+
class_instance = None
|
|
41
|
+
module = None
|
|
42
|
+
for module in self._modules:
|
|
43
|
+
lib = import_module(module)
|
|
44
|
+
try:
|
|
45
|
+
class_instance = getattr(lib, name)
|
|
46
|
+
break
|
|
47
|
+
except AttributeError as ex:
|
|
48
|
+
continue
|
|
49
|
+
|
|
50
|
+
if not class_instance:
|
|
51
|
+
raise ValueError(f"The class/function '{name}' does not exist in '{self.__class__.name.lower()}' modules.")
|
|
52
|
+
|
|
53
|
+
return module, class_instance
|
|
54
|
+
|
|
36
55
|
def __getattr__(self, name):
|
|
37
56
|
|
|
38
57
|
def __get_module(*c, **kwargs):
|
|
39
|
-
class_instance =
|
|
40
|
-
module = None
|
|
41
|
-
for module in self._modules:
|
|
42
|
-
lib = import_module(module)
|
|
43
|
-
try:
|
|
44
|
-
class_instance = getattr(lib, name)
|
|
45
|
-
break
|
|
46
|
-
except AttributeError as ex:
|
|
47
|
-
continue
|
|
48
|
-
|
|
49
|
-
if not class_instance:
|
|
50
|
-
raise ValueError(f"The class/function '{name}' does not exist in 'sklearn' modules.")
|
|
58
|
+
module, class_instance = self._get_module_and_class_instance(name)
|
|
51
59
|
|
|
52
60
|
# If the attribute is a function, then return the function object.
|
|
53
61
|
if type(class_instance).__name__ == "function":
|
|
@@ -247,9 +255,86 @@ class Sklearn(_OpenSource):
|
|
|
247
255
|
"""
|
|
248
256
|
def __init__(self):
|
|
249
257
|
super().__init__()
|
|
250
|
-
self._modules =
|
|
258
|
+
self._modules = _SKL_MODULES
|
|
251
259
|
self._object_wrapper = _SkLearnObjectWrapper
|
|
252
260
|
self._function_wrapper = _SKLearnFunctionWrapper
|
|
253
261
|
|
|
254
262
|
|
|
263
|
+
class Lightgbm(_OpenSource):
|
|
264
|
+
"""
|
|
265
|
+
DESCRIPTION:
|
|
266
|
+
Interface object to access exposed classes and functions of lightgbm
|
|
267
|
+
opensource package. All the classes and functions can be run and attributes
|
|
268
|
+
can be accessed using the object created by "td_lightgbm" interface object.
|
|
269
|
+
Refer Teradata Python Package User Guide for more information about OpenML
|
|
270
|
+
and exposed interface objects.
|
|
271
|
+
|
|
272
|
+
PARAMETERS:
|
|
273
|
+
None
|
|
274
|
+
|
|
275
|
+
RETURNS:
|
|
276
|
+
None
|
|
277
|
+
|
|
278
|
+
EXAMPLES:
|
|
279
|
+
# Load example data.
|
|
280
|
+
>>> load_example_data("openml", ["test_classification"])
|
|
281
|
+
>>> df = DataFrame("test_classification")
|
|
282
|
+
>>> df.head(3)
|
|
283
|
+
col2 col3 col4 label
|
|
284
|
+
col1
|
|
285
|
+
-2.560430 0.402232 -1.100742 -2.959588 0
|
|
286
|
+
-3.587546 0.291819 -1.850169 -4.331055 0
|
|
287
|
+
-3.697436 1.576888 -0.461220 -3.598652 0
|
|
288
|
+
|
|
289
|
+
# Get the feature and label data.
|
|
290
|
+
>>> df_x = df.select(df.columns[:-1])
|
|
291
|
+
>>> df_y = df.select(df.columns[-1])
|
|
292
|
+
|
|
293
|
+
# Create lightgbm Dataset object.
|
|
294
|
+
>>> lgbm_data = td_lightgbm.Dataset(data=df_x, label=df_y, free_raw_data=False)
|
|
295
|
+
>>> lgbm_data
|
|
296
|
+
<lightgbm.basic.Dataset object at 0x7f33f0656820>
|
|
297
|
+
"""
|
|
298
|
+
|
|
299
|
+
def __init__(self):
|
|
300
|
+
super().__init__()
|
|
301
|
+
self._modules = _LIGHTGBM_MODULES
|
|
302
|
+
self._object_wrapper = _LightgbmDatasetWrapper
|
|
303
|
+
self._function_wrapper = _LightgbmFunctionWrapper
|
|
304
|
+
|
|
305
|
+
def __getattr__(self, name):
|
|
306
|
+
|
|
307
|
+
def __get_module(*c, **kwargs):
|
|
308
|
+
module, class_instance = self._get_module_and_class_instance(name)
|
|
309
|
+
|
|
310
|
+
# If the attribute is a function, then return the function object.
|
|
311
|
+
if type(class_instance).__name__ == "function":
|
|
312
|
+
kwargs.update(zip(class_instance.__code__.co_varnames, c))
|
|
313
|
+
|
|
314
|
+
if module == "lightgbm.callback":
|
|
315
|
+
return {"module": module, "func_name": name, "kwargs": kwargs}
|
|
316
|
+
|
|
317
|
+
return self._function_wrapper(module_name=module, func_name=name)(**kwargs)
|
|
318
|
+
|
|
319
|
+
kwargs.update(zip(class_instance.__init__.__code__.co_varnames[1:], c))
|
|
320
|
+
if module == "lightgbm.basic" and name == "Booster":
|
|
321
|
+
return _LightgbmBoosterWrapper(module_name=module, class_name=name, kwargs=kwargs)
|
|
322
|
+
|
|
323
|
+
if module == "lightgbm.sklearn":
|
|
324
|
+
return _LighgbmSklearnWrapper(module_name=module, class_name=name, kwargs=kwargs)
|
|
325
|
+
|
|
326
|
+
return self._object_wrapper(module_name=module, class_name=name, kwargs=kwargs)
|
|
327
|
+
|
|
328
|
+
return __get_module
|
|
329
|
+
|
|
330
|
+
def deploy(self, model_name, model, replace_if_exists=False):
|
|
331
|
+
raise NotImplementedError("The deploy() function is not yet supported for td_lightgbm. \
|
|
332
|
+
Support will be added in future releases.")
|
|
333
|
+
|
|
334
|
+
def load(self, model_name):
|
|
335
|
+
raise NotImplementedError("The load() function is not yet supported for td_lightgbm. \
|
|
336
|
+
Support will be added in future releases.")
|
|
337
|
+
|
|
338
|
+
|
|
255
339
|
td_sklearn = Sklearn()
|
|
340
|
+
td_lightgbm = Lightgbm()
|