generate_custom_config | AutoML | teradataml - generate_custom_config - Teradata Package for Python

Teradata® Package for Python User Guide

Deployment
VantageCloud
VantageCore
Edition
Enterprise
IntelliFlex
VMware
Product
Teradata Package for Python
Release Number
20.00
Published
March 2024
Language
English (United States)
Last Update
2024-04-09
dita:mapPath
nvi1706202040305.ditamap
dita:ditavalPath
plt1683835213376.ditaval
dita:id
rkb1531260709148
Product Category
Teradata Vantage

Use the generate_custom_config function to generate custom JSON file containing user customized input under current working directory which can be used for AutoML execution.

Optional Argument:

  • file_name: Specifies the name of the file to be generated.

    Default value is "custom".

    Do not pass the file name with extension. Extension '.json' is automatically added to specified file name.

Example Setup

Before generating custom JSON file, import either AutoML, or AutoClassifier, or AutoRegressor, from teradataml based on the feature you choose.

The following example imports all three.

from teradataml import AutoML, AutoClassifier, AutoRegressor

Example 1: Generate a default file named "custom.json"

Based on the feature for your use case, generate a default file named "custom.json" file using one of the following options.

AutoML.generate_custom_config()
Or,
AutoClassifier.generate_custom_config()
Or,
AutoRegressor.generate_custom_config()

Example 2: Generate file with different file names using file_name argument

The following code generates JSON file with specified file name under current working directory.

AutoML.generate_custom_config("custom_titanic")
Or,
AutoClassifier.generate_custom_config("custom_titanic")
Or,
AutoRegressor.generate_custom_config("custom_housing")

Example system output

The generate_custom_config() method enables the generation of customized JSON by allowing you to provide appropriate responses to available options. It requires either the index value corresponding to the given option or the feature name on which customization needs to be done.

You can provide a single value or a list of values, separated by commas, based on the prompt details.

As AutoML does not have access to features beforehand, it is your responsibility to enter the correct feature names from the dataset.
AutoRegressor.generate_custom_config("custom_housing")
Generating custom config JSON for AutoML ...

Available main options for customization with corresponding indices: 
--------------------------------------------------------------------------------

Index 1: Customize Feature Engineering Phase

Index 2: Customize Data Preparation Phase

Index 3: Customize Model Training Phase

Index 4: Generate custom json and exit
--------------------------------------------------------------------------------

Enter the index you want to customize:  1

Customizing Feature Engineering Phase ...

Available options for customization of feature engineering phase with corresponding indices: 
--------------------------------------------------------------------------------

Index 1: Customize Missing Value Handling

Index 2: Customize Bincode Encoding

Index 3: Customize String Manipulation

Index 4: Customize Categorical Encoding

Index 5: Customize Mathematical Transformation

Index 6: Customize Nonlinear Transformation

Index 7: Customize Antiselect Features

Index 8: Back to main menu

Index 9: Generate custom json and exit
--------------------------------------------------------------------------------

Enter the list of indices you want to customize in feature engineering phase:  2,4,7,8

Customizing Bincode Encoding ...

Provide the following details to customize binning and coding encoding:

Available binning methods with corresponding indices:
Index 1: Equal-Width
Index 2: Variable-Width

Enter the feature or list of features for binning:  bedrooms

Enter the index of corresponding binning method for feature bedrooms:  2

Enter the number of bins for feature bedrooms:  2

Available value type of feature for variable binning with corresponding indices:
Index 1: int
Index 2: float

Provide the range for bin 1 of feature bedrooms: 

Enter the index of corresponding value type of feature bedrooms:  1

Enter the minimum value for bin 1 of feature bedrooms:  0

Enter the maximum value for bin 1 of feature bedrooms:  2

Enter the label for bin 1 of feature bedrooms:  small_house

Provide the range for bin 2 of feature bedrooms: 

Enter the index of corresponding value type of feature bedrooms:  1

Enter the minimum value for bin 2 of feature bedrooms:  3

Enter the maximum value for bin 2 of feature bedrooms:  5

Enter the label for bin 2 of feature bedrooms:  big_house

Customization of bincode encoding has been completed successfully.

Customizing Categorical Encoding ...

Provide the following details to customize categorical encoding:

Available categorical encoding methods with corresponding indices:
Index 1: OneHotEncoding
Index 2: OrdinalEncoding
Index 3: TargetEncoding

Enter the list of corresponding index categorical encoding methods you want to use:  2,3

Enter the feature or list of features for OrdinalEncoding:  homestyle

Enter the feature or list of features for TargetEncoding:  prefarea

Available target encoding methods with corresponding indices:
Index 1: CBM_BETA
Index 2: CBM_DIRICHLET
Index 3: CBM_GAUSSIAN_INVERSE_GAMMA

Enter the index of target encoding method for feature prefarea:  3

Enter the response column for target encoding method for feature prefarea:  price

Customization of categorical encoding has been completed successfully.

Customizing Antiselect Features ...

Enter the feature or list of features for antiselect:  sn

Customization of antiselect features has been completed successfully.

Customization of feature engineering phase has been completed successfully.

Available main options for customization with corresponding indices: 
--------------------------------------------------------------------------------

Index 1: Customize Feature Engineering Phase

Index 2: Customize Data Preparation Phase

Index 3: Customize Model Training Phase

Index 4: Generate custom json and exit
--------------------------------------------------------------------------------

Enter the index you want to customize:  2

Customizing Data Preparation Phase ...

Available options for customization of data preparation phase with corresponding indices: 
--------------------------------------------------------------------------------

Index 1: Customize Train Test Split

Index 2: Customize Data Imbalance Handling

Index 3: Customize Outlier Handling

Index 4: Customize Feature Scaling

Index 5: Back to main menu

Index 6: Generate custom json and exit
--------------------------------------------------------------------------------

Enter the list of indices you want to customize in data preparation phase:  1,2,3,4,5

Customizing Train Test Split ...

Enter the train size for train test split:  0.75

Customization of train test split has been completed successfully.

Customizing Data Imbalance Handling ...

Available data sampling methods with corresponding indices:
Index 1: SMOTE
Index 2: NearMiss

Enter the corresponding index data imbalance handling method:  1

Customization of data imbalance handling has been completed successfully.

Customizing Outlier Handling ...

Available outlier detection methods with corresponding indices:
Index 1: percentile
Index 2: tukey
Index 3: carling

Enter the corresponding index oulier handling method:  1

Enter the lower percentile value for outlier handling:  0.1

Enter the upper percentile value for outlier handling:  0.9

Enter the feature or list of features for outlier handling:  bathrms

Available outlier replacement methods with corresponding indices:
Index 1: delete
Index 2: median
Index 3: Any Numeric Value

Enter the index of corresponding replacement method for feature bathrms:  1

Customization of outlier handling has been completed successfully.

Available feature scaling methods with corresponding indices:
Index 1: maxabs
Index 2: mean
Index 3: midrange
Index 4: range
Index 5: rescale
Index 6: std
Index 7: sum
Index 8: ustd

Enter the corresponding index feature scaling method:  6

Customization of feature scaling has been completed successfully.

Customization of data preparation phase has been completed successfully.

Available main options for customization with corresponding indices: 
--------------------------------------------------------------------------------

Index 1: Customize Feature Engineering Phase

Index 2: Customize Data Preparation Phase

Index 3: Customize Model Training Phase

Index 4: Generate custom json and exit
--------------------------------------------------------------------------------

Enter the index you want to customize:  3

Customizing Model Training Phase ...

Available options for customization of model training phase with corresponding indices: 
--------------------------------------------------------------------------------

Index 1: Customize Model Hyperparameter

Index 2: Back to main menu

Index 3: Generate custom json and exit
--------------------------------------------------------------------------------

Enter the list of indices you want to customize in model training phase:  1

Customizing Model Hyperparameter ...

Available models for hyperparameter tuning with corresponding indices:
Index 1: decision_forest
Index 2: xgboost
Index 3: knn
Index 4: glm
Index 5: svm

Available hyperparamters update methods with corresponding indices:
Index 1: ADD
Index 2: REPLACE

Enter the list of model indices for performing hyperparameter tuning:  2

Available hyperparameters for model 'xgboost' with corresponding indices:
Index 1: min_impurity
Index 2: max_depth
Index 3: min_node_size
Index 4: shrinkage_factor
Index 5: iter_num

Enter the list of hyperparameter indices for model 'xgboost':  3

Enter the index of corresponding update method for hyperparameters 'min_node_size' for model 'xgboost':  1

Enter the list of value for hyperparameter 'min_node_size' for model 'xgboost':  1,2

Customization of model hyperparameter has been completed successfully.

Available options for customization of model training phase with corresponding indices: 
--------------------------------------------------------------------------------

Index 1: Customize Model Hyperparameter

Index 2: Back to main menu

Index 3: Generate custom json and exit
--------------------------------------------------------------------------------

Enter the list of indices you want to customize in model training phase:  2

Customization of model training phase has been completed successfully.

Available main options for customization with corresponding indices: 
--------------------------------------------------------------------------------

Index 1: Customize Feature Engineering Phase

Index 2: Customize Data Preparation Phase

Index 3: Customize Model Training Phase

Index 4: Generate custom json and exit
--------------------------------------------------------------------------------

Enter the index you want to customize:  4

Generating custom json and exiting ...

Process of generating custom config file for AutoML has been completed successfully.

'custom_housing.json' file is generated successfully under the current working directory.