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
|
@@ -64,6 +64,7 @@ class _GenerateCustomJson:
|
|
|
64
64
|
RAISES:
|
|
65
65
|
ValueError: If input data is empty or not valid.
|
|
66
66
|
"""
|
|
67
|
+
|
|
67
68
|
while True:
|
|
68
69
|
try:
|
|
69
70
|
# Checking if input is empty
|
|
@@ -76,7 +77,12 @@ class _GenerateCustomJson:
|
|
|
76
77
|
elif value_type == 'float':
|
|
77
78
|
result = [float(value.strip()) for value in input_data.split(',')]
|
|
78
79
|
elif value_type == 'bool':
|
|
79
|
-
result = [
|
|
80
|
+
result = []
|
|
81
|
+
for value in input_data.split(','):
|
|
82
|
+
if value.strip().lower() not in ['true', 'false']:
|
|
83
|
+
raise ValueError("\nInvalid input. Please provide a valid input from 'True' or 'False'.")
|
|
84
|
+
else:
|
|
85
|
+
result.append(True if value.strip().lower() == 'true' else False)
|
|
80
86
|
else:
|
|
81
87
|
result = [value.strip() for value in input_data.split(',')]
|
|
82
88
|
|
|
@@ -242,17 +248,19 @@ class _GenerateCustomJson:
|
|
|
242
248
|
input("\nEnter the list of indices you want to customize in feature engineering phase: "),
|
|
243
249
|
'int', list(fe_customize_options.keys()))
|
|
244
250
|
|
|
251
|
+
# Setting back_key and exit_key
|
|
252
|
+
fe_back_key, fe_exit_key = 8, 9
|
|
245
253
|
# Flag variable to back to main menu
|
|
246
254
|
fe_exit_to_main_flag = False
|
|
247
255
|
# Flag variable to exit from main menu
|
|
248
256
|
# Handling the scenario when input contains both index 8 and 9
|
|
249
|
-
fe_exit_from_main_flag =
|
|
257
|
+
fe_exit_from_main_flag = fe_exit_key in fe_phase_idx
|
|
250
258
|
|
|
251
259
|
# Processing each functionality for customization in sorted order
|
|
252
260
|
for index in sorted(fe_phase_idx):
|
|
253
|
-
if index ==
|
|
261
|
+
if index == fe_back_key or index == fe_exit_key:
|
|
254
262
|
fe_exit_to_main_flag = True
|
|
255
|
-
if index ==
|
|
263
|
+
if index == fe_exit_key:
|
|
256
264
|
fe_exit_from_main_flag = True
|
|
257
265
|
break
|
|
258
266
|
fe_method_map[index](self.fe_flag[index])
|
|
@@ -273,12 +281,11 @@ class _GenerateCustomJson:
|
|
|
273
281
|
print("\nCustomizing Data Preparation Phase ...")
|
|
274
282
|
# Available options for customization of data preparation phase
|
|
275
283
|
dp_customize_options = {
|
|
276
|
-
1: 'Customize
|
|
277
|
-
2: 'Customize
|
|
278
|
-
3: 'Customize
|
|
279
|
-
4: '
|
|
280
|
-
5: '
|
|
281
|
-
6: 'Generate custom json and exit'
|
|
284
|
+
1: 'Customize Data Imbalance Handling',
|
|
285
|
+
2: 'Customize Outlier Handling',
|
|
286
|
+
3: 'Customize Feature Scaling',
|
|
287
|
+
4: 'Back to main menu',
|
|
288
|
+
5: 'Generate custom json and exit'
|
|
282
289
|
}
|
|
283
290
|
|
|
284
291
|
while True:
|
|
@@ -290,10 +297,9 @@ class _GenerateCustomJson:
|
|
|
290
297
|
print("-"*80)
|
|
291
298
|
# Mapping each index to corresponding functionality
|
|
292
299
|
de_method_map = {
|
|
293
|
-
1: self.
|
|
294
|
-
2: self.
|
|
295
|
-
3: self.
|
|
296
|
-
4: self._get_customize_input_feature_scaling
|
|
300
|
+
1: self._get_customize_input_data_imbalance_handling,
|
|
301
|
+
2: self._get_customize_input_outlier_handling,
|
|
302
|
+
3: self._get_customize_input_feature_scaling
|
|
297
303
|
}
|
|
298
304
|
|
|
299
305
|
# Taking required input for customizing data preparation.
|
|
@@ -301,17 +307,19 @@ class _GenerateCustomJson:
|
|
|
301
307
|
input("\nEnter the list of indices you want to customize in data preparation phase: "),
|
|
302
308
|
'int', list(dp_customize_options.keys()))
|
|
303
309
|
|
|
310
|
+
# Setting back_key and exit_key
|
|
311
|
+
de_back_key, de_exit_key = 4, 5
|
|
304
312
|
# Flag variable to back to main menu
|
|
305
313
|
de_exit_to_main_flag = False
|
|
306
314
|
# Flag variable to exit from main menu
|
|
307
|
-
# Handling the scenario when input contains both
|
|
308
|
-
de_exit_from_main_flag =
|
|
315
|
+
# Handling the scenario when input contains both back_key and exit_key
|
|
316
|
+
de_exit_from_main_flag = de_exit_key in dp_phase_idx
|
|
309
317
|
|
|
310
318
|
# Processing each functionality for customization in sorted order
|
|
311
319
|
for index in sorted(dp_phase_idx):
|
|
312
|
-
if index ==
|
|
320
|
+
if index == de_back_key or index == de_exit_key:
|
|
313
321
|
de_exit_to_main_flag = True
|
|
314
|
-
if index ==
|
|
322
|
+
if index == de_exit_key:
|
|
315
323
|
de_exit_from_main_flag = True
|
|
316
324
|
break
|
|
317
325
|
de_method_map[index](self.de_flag[index])
|
|
@@ -373,6 +381,35 @@ class _GenerateCustomJson:
|
|
|
373
381
|
# Returning flag to exit from main menu
|
|
374
382
|
return mt_exit_from_main_flag
|
|
375
383
|
|
|
384
|
+
def _set_generic_arguement(self,
|
|
385
|
+
func_name):
|
|
386
|
+
"""
|
|
387
|
+
DESCRIPTION:
|
|
388
|
+
Internal Function to set generic arguments for each functionality.
|
|
389
|
+
|
|
390
|
+
PARAMETERS:
|
|
391
|
+
func_name:
|
|
392
|
+
Required Argument.
|
|
393
|
+
Specifies the name of functionality for which generic arguments are to be set.
|
|
394
|
+
Types: str
|
|
395
|
+
"""
|
|
396
|
+
generic_flag = {
|
|
397
|
+
0: 'Default',
|
|
398
|
+
1: 'volatile',
|
|
399
|
+
2: 'persist'
|
|
400
|
+
}
|
|
401
|
+
print("\nAvailable options for generic arguments: ")
|
|
402
|
+
for index, method in generic_flag.items():
|
|
403
|
+
print(f"Index {index}: {method}")
|
|
404
|
+
inp = self._process_list_input(
|
|
405
|
+
input("\nEnter the indices for generic arguments : "), 'int')[0]
|
|
406
|
+
if inp == 0:
|
|
407
|
+
return
|
|
408
|
+
if inp == 1:
|
|
409
|
+
self.data[func_name]['volatile'] = True
|
|
410
|
+
elif inp == 2:
|
|
411
|
+
self.data[func_name]['persist'] = True
|
|
412
|
+
|
|
376
413
|
def _get_customize_input_missing_value_handling(self,
|
|
377
414
|
first_execution_flag=False):
|
|
378
415
|
"""
|
|
@@ -471,7 +508,8 @@ class _GenerateCustomJson:
|
|
|
471
508
|
input(f"\nEnter the specific literal value for imputing missing "
|
|
472
509
|
f"values for feature {feature}: "))
|
|
473
510
|
self.data['MissingValueHandlingParam']['LiteralImputeValue'].append(literal_value)
|
|
474
|
-
|
|
511
|
+
# Setting generic arguments
|
|
512
|
+
self._set_generic_arguement(func_name='MissingValueHandlingParam')
|
|
475
513
|
print("\nCustomization of missing value handling has been completed successfully.")
|
|
476
514
|
|
|
477
515
|
def _get_customize_input_bin_code_encoding(self,
|
|
@@ -554,6 +592,7 @@ class _GenerateCustomJson:
|
|
|
554
592
|
# Setting label for corresponding bin
|
|
555
593
|
self.data['BincodeParam'][feature][bin_num]['label'] = self._process_single_input(
|
|
556
594
|
input(f"\nEnter the label for bin {num} of feature {feature}: "))
|
|
595
|
+
self._set_generic_arguement(func_name='BincodeParam')
|
|
557
596
|
|
|
558
597
|
print("\nCustomization of bincode encoding has been completed successfully.")
|
|
559
598
|
|
|
@@ -621,7 +660,8 @@ class _GenerateCustomJson:
|
|
|
621
660
|
input(f"\nEnter the start value required for string manipulation "
|
|
622
661
|
f"operation for feature {feature}: "), 'int')
|
|
623
662
|
self.data['StringManipulationParam'][feature]["StartIndex"] = str_mnpl_start
|
|
624
|
-
|
|
663
|
+
|
|
664
|
+
self._set_generic_arguement(func_name='StringManipulationParam')
|
|
625
665
|
print("\nCustomization of string manipulation has been completed successfully.")
|
|
626
666
|
|
|
627
667
|
|
|
@@ -713,7 +753,8 @@ class _GenerateCustomJson:
|
|
|
713
753
|
f"for target encoding method for feature {feature}: "), 'int')
|
|
714
754
|
self.data['CategoricalEncodingParam']['TargetEncodingList'][feature]["num_distinct_responses"] = \
|
|
715
755
|
num_distinct_responses
|
|
716
|
-
|
|
756
|
+
|
|
757
|
+
self._set_generic_arguement(func_name='CategoricalEncodingParam')
|
|
717
758
|
print("\nCustomization of categorical encoding has been completed successfully.")
|
|
718
759
|
|
|
719
760
|
def _get_customize_input_mathematical_transformation(self,
|
|
@@ -782,6 +823,7 @@ class _GenerateCustomJson:
|
|
|
782
823
|
f"transformation for feature {feature}: "), 'int')
|
|
783
824
|
self.data['MathameticalTransformationParam'][feature]["exponent"] = exponent
|
|
784
825
|
|
|
826
|
+
self._set_generic_arguement(func_name='MathameticalTransformationParam')
|
|
785
827
|
print("\nCustomization of mathematical transformation has been completed successfully.")
|
|
786
828
|
|
|
787
829
|
def _get_customize_input_nonlinear_transformation(self,
|
|
@@ -828,6 +870,7 @@ class _GenerateCustomJson:
|
|
|
828
870
|
input(f"\nEnter the resultant feature for non-linear combination {num}: "))
|
|
829
871
|
self.data['NonLinearTransformationParam'][combination]["result_column"] = result_column
|
|
830
872
|
|
|
873
|
+
self._set_generic_arguement(func_name='NonLinearTransformationParam')
|
|
831
874
|
print("\nCustomization of nonlinear transformation has been completed successfully.")
|
|
832
875
|
|
|
833
876
|
def _get_customize_input_antiselect(self,
|
|
@@ -850,35 +893,12 @@ class _GenerateCustomJson:
|
|
|
850
893
|
print("\nCustomizing Antiselect Features ...")
|
|
851
894
|
# Setting indicator and parameter for antiselect
|
|
852
895
|
self.data['AntiselectIndicator'] = True
|
|
853
|
-
self.data['AntiselectParam'] =
|
|
896
|
+
self.data['AntiselectParam'] = {}
|
|
897
|
+
self.data['AntiselectParam']['excluded_columns'] = self._process_list_input(
|
|
854
898
|
input("\nEnter the feature or list of features for antiselect: "))
|
|
855
899
|
|
|
900
|
+
self._set_generic_arguement(func_name='AntiselectParam')
|
|
856
901
|
print("\nCustomization of antiselect features has been completed successfully.")
|
|
857
|
-
|
|
858
|
-
def _get_customize_input_train_test_split(self,
|
|
859
|
-
first_execution_flag=False):
|
|
860
|
-
"""
|
|
861
|
-
DESCRIPTION:
|
|
862
|
-
Function takes user input to generate custom json paramaters for train test split.
|
|
863
|
-
|
|
864
|
-
PARAMETERS:
|
|
865
|
-
first_execution_flag:
|
|
866
|
-
Optional Argument.
|
|
867
|
-
Specifies the flag to check if the function is called for the first time.
|
|
868
|
-
Default Value: False
|
|
869
|
-
Types: bool
|
|
870
|
-
"""
|
|
871
|
-
if first_execution_flag:
|
|
872
|
-
print("\nWARNING : Reinitiated train test split customization. "
|
|
873
|
-
"Overwriting the previous input.")
|
|
874
|
-
|
|
875
|
-
print("\nCustomizing Train Test Split ...")
|
|
876
|
-
# Setting indicator and parameter for customizing train test split
|
|
877
|
-
self.data['TrainTestSplitIndicator'] = True
|
|
878
|
-
self.data['TrainingSize']= self._process_single_input(
|
|
879
|
-
input("\nEnter the train size for train test split: "), 'float')
|
|
880
|
-
|
|
881
|
-
print("\nCustomization of train test split has been completed successfully.")
|
|
882
902
|
|
|
883
903
|
def _get_customize_input_data_imbalance_handling(self,
|
|
884
904
|
first_execution_flag):
|
|
@@ -997,6 +1017,7 @@ class _GenerateCustomJson:
|
|
|
997
1017
|
self.data['OutlierFilterParam'][feature]["replacement_value"] = \
|
|
998
1018
|
self._process_single_input(replacement_value, replacement_value_types[value_type_idx])
|
|
999
1019
|
|
|
1020
|
+
self._set_generic_arguement(func_name='OutlierFilterParam')
|
|
1000
1021
|
print("\nCustomization of outlier handling has been completed successfully.")
|
|
1001
1022
|
|
|
1002
1023
|
def _get_customize_input_feature_scaling(self,
|
|
@@ -1027,6 +1048,7 @@ class _GenerateCustomJson:
|
|
|
1027
1048
|
6: 'std',
|
|
1028
1049
|
7: 'sum',
|
|
1029
1050
|
8: 'ustd'}
|
|
1051
|
+
self.data['FeatureScalingParam'] = {}
|
|
1030
1052
|
# Displaying available methods for scaling
|
|
1031
1053
|
print("\nAvailable feature scaling methods with corresponding indices:")
|
|
1032
1054
|
for index, value in scaling_methods.items():
|
|
@@ -1039,7 +1061,7 @@ class _GenerateCustomJson:
|
|
|
1039
1061
|
|
|
1040
1062
|
# Handling for 'rescale' method
|
|
1041
1063
|
if scaling_methods_idx != 5:
|
|
1042
|
-
self.data['FeatureScalingMethod'] = scaling_methods[scaling_methods_idx]
|
|
1064
|
+
self.data['FeatureScalingParam']['FeatureScalingMethod'] = scaling_methods[scaling_methods_idx]
|
|
1043
1065
|
else:
|
|
1044
1066
|
rescaling_params = {
|
|
1045
1067
|
1: 'lower-bound',
|
|
@@ -1085,8 +1107,9 @@ class _GenerateCustomJson:
|
|
|
1085
1107
|
elif ub:
|
|
1086
1108
|
scale_method = f'rescale(ub={ub})'
|
|
1087
1109
|
# Setting parameters for feature scaling
|
|
1088
|
-
self.data['FeatureScalingMethod'] = scale_method
|
|
1110
|
+
self.data['FeatureScalingParam']['FeatureScalingMethod'] = scale_method
|
|
1089
1111
|
|
|
1112
|
+
self._set_generic_arguement(func_name='FeatureScalingParam')
|
|
1090
1113
|
print("\nCustomization of feature scaling has been completed successfully.")
|
|
1091
1114
|
|
|
1092
1115
|
def _get_allowed_hyperparameters(self, model_name):
|
|
@@ -1222,10 +1245,6 @@ class _GenerateCustomJson:
|
|
|
1222
1245
|
|
|
1223
1246
|
update_methods = {1: 'ADD',
|
|
1224
1247
|
2: 'REPLACE'}
|
|
1225
|
-
# Displaying available update methods for hyperparameter tuning
|
|
1226
|
-
print("\nAvailable hyperparamters update methods with corresponding indices:")
|
|
1227
|
-
for index, method in update_methods.items():
|
|
1228
|
-
print(f"Index {index}: {method}")
|
|
1229
1248
|
|
|
1230
1249
|
# Getting list of models for hyperparameter tuning
|
|
1231
1250
|
model_idx_list = self._process_list_input(
|
|
@@ -1247,24 +1266,83 @@ class _GenerateCustomJson:
|
|
|
1247
1266
|
input(f"\nEnter the list of hyperparameter indices for model '{model_name}': "),
|
|
1248
1267
|
'int', list(allowed_hyperparameters.keys()))
|
|
1249
1268
|
|
|
1250
|
-
|
|
1269
|
+
# Setting parameters for each hyperparameter of model
|
|
1251
1270
|
for hyperparameter in model_hyperparameter_list_idx:
|
|
1252
1271
|
hyperparameter_name = allowed_hyperparameters[hyperparameter]
|
|
1253
1272
|
self.data['HyperparameterTuningParam'][model_name][hyperparameter_name] = {}
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
f"'{hyperparameter_name}' for model '{model_name}': "), 'int', list(update_methods.keys()))
|
|
1257
|
-
# Setting update method for hyperparameter
|
|
1258
|
-
self.data['HyperparameterTuningParam'][model_name][hyperparameter_name]["Method"] = \
|
|
1259
|
-
update_methods[method_idx]
|
|
1273
|
+
|
|
1274
|
+
self._display_example_hyperparameter(hyperparameter_name)
|
|
1260
1275
|
|
|
1261
1276
|
hyperparameter_value = input(f"\nEnter the list of value for hyperparameter "
|
|
1262
1277
|
f"'{hyperparameter_name}' for model '{model_name}': ")
|
|
1263
1278
|
|
|
1264
1279
|
hyperparameter_type = self._get_allowed_hyperparameters_types(hyperparameter_name)
|
|
1265
|
-
|
|
1280
|
+
|
|
1266
1281
|
# Setting hyperparameter value specific to each hyperparameter
|
|
1267
1282
|
self.data['HyperparameterTuningParam'][model_name][hyperparameter_name]["Value"] = \
|
|
1268
1283
|
self._process_list_input(hyperparameter_value, hyperparameter_type)
|
|
1284
|
+
|
|
1285
|
+
# Displaying available update methods for hyperparameter tuning
|
|
1286
|
+
print("\nAvailable hyperparamters update methods with corresponding indices:")
|
|
1287
|
+
for index, method in update_methods.items():
|
|
1288
|
+
print(f"Index {index}: {method}")
|
|
1289
|
+
|
|
1290
|
+
method_idx = self._process_single_input(
|
|
1291
|
+
input(f"\nEnter the index of corresponding update method for hyperparameters "
|
|
1292
|
+
f"'{hyperparameter_name}' for model '{model_name}': "), 'int', list(update_methods.keys()))
|
|
1293
|
+
|
|
1294
|
+
# Setting update method for hyperparameter
|
|
1295
|
+
self.data['HyperparameterTuningParam'][model_name][hyperparameter_name]["Method"] = \
|
|
1296
|
+
update_methods[method_idx]
|
|
1269
1297
|
|
|
1270
1298
|
print("\nCustomization of model hyperparameter has been completed successfully.")
|
|
1299
|
+
|
|
1300
|
+
def _display_example_hyperparameter(self, hyperparameter_name):
|
|
1301
|
+
"""
|
|
1302
|
+
DESCRIPTION:
|
|
1303
|
+
Function to display example hyperparameter values for different hyperparameters.
|
|
1304
|
+
|
|
1305
|
+
PARAMETERS:
|
|
1306
|
+
hyperparameter_name:
|
|
1307
|
+
Required Argument.
|
|
1308
|
+
Specifies the hyperparameter for which example values are required.
|
|
1309
|
+
Types: str
|
|
1310
|
+
"""
|
|
1311
|
+
# Setting example hyperparameter values for different hyperparameters
|
|
1312
|
+
example_hyperparameters = {
|
|
1313
|
+
'min_impurity' : ([0.1,0.6], 'float'),
|
|
1314
|
+
'max_depth' : ([1,5,10], 'int'),
|
|
1315
|
+
'min_node_size' : ([1,20,100], 'int'),
|
|
1316
|
+
'num_trees' : ([10,50,100], 'int'),
|
|
1317
|
+
'k' : ([5,25,100], 'int'),
|
|
1318
|
+
'shrinkage_factor': ([0.1,0.5,1.0], 'float'),
|
|
1319
|
+
'alpha' : ([0.1,0.5,1.0], 'float'),
|
|
1320
|
+
'learning_rate' : (['constant','optimal','invtime','adaptive'], 'str'),
|
|
1321
|
+
'initial_eta' : ([0.05,0.1], 'float'),
|
|
1322
|
+
'momentum' : ([0.65,0.95], 'float'),
|
|
1323
|
+
'iter_num_no_change' : ([25,50,100], 'int'),
|
|
1324
|
+
'iter_max' : ([10,100,300], 'int'),
|
|
1325
|
+
'batch_size' : ([10,50,100], 'int'),
|
|
1326
|
+
'tolerance' : ([0.0001,0.01], 'float'),
|
|
1327
|
+
'nesterov' : (['true','false'], 'bool'),
|
|
1328
|
+
'intercept' : (['true','false'], 'bool'),
|
|
1329
|
+
'local_sgd_iterations' : ([10,25,50], 'int'),
|
|
1330
|
+
'iter_num' : ([10,50,100], 'int')
|
|
1331
|
+
}
|
|
1332
|
+
|
|
1333
|
+
print(f"\nExample values for hyperparameter '{hyperparameter_name}' :")
|
|
1334
|
+
if hyperparameter_name in example_hyperparameters:
|
|
1335
|
+
values = example_hyperparameters[hyperparameter_name]
|
|
1336
|
+
|
|
1337
|
+
# Setting example values for hyperparameter
|
|
1338
|
+
if all(isinstance(x, str) for x in values[0]):
|
|
1339
|
+
example_value = ', '.join(f"'{s}'" for s in values[0])
|
|
1340
|
+
else:
|
|
1341
|
+
example_value = ', '.join(map(str, values[0]))
|
|
1342
|
+
|
|
1343
|
+
# Displaying example values for hyperparameter
|
|
1344
|
+
print(f"* Sample value : {example_value}")
|
|
1345
|
+
|
|
1346
|
+
# Displaying example type for hyperparameter
|
|
1347
|
+
print(f"* Type : {values[1]}")
|
|
1348
|
+
|