Teradata Package for Python Function Reference | 20.00 - __init__ - Teradata Package for Python - Look here for syntax, methods and examples for the functions included in the Teradata Package for Python.

Teradata® Package for Python Function Reference - 20.00

Deployment
VantageCloud
VantageCore
Edition
VMware
Enterprise
IntelliFlex
Product
Teradata Package for Python
Release Number
20.00.00.11
Published
August 2026
ft:locale
en-US
ft:lastEdition
2026-08-13
dita:id
TeradataPython_FxRef_Enterprise_2000
Product Category
Teradata Vantage
teradataml.automl.auto_cluster.AutoCluster.__init__ = __init__(self, include=None, exclude=None, verbose=0, max_runtime_secs=None, stopping_metric=None, stopping_tolerance=None, max_models=None, custom_config_file=None, skip_phases=None, **kwargs)
DESCRIPTION:
    AutoCluster is a dedicated AutoML pipeline designed specifically for clustering tasks.
    It automates the process of building, training, and evaluating clustering models,
    streamlining the workflow for unsupervised learning use cases where the goal is 
    to group data into clusters.
    Note:
        * configure.temp_object_type="VT" follows sequential execution.
    
PARAMETERS:  
    include:
        Optional Argument.
        Specifies the model algorithms to be used for model training phase.
        By default, all 2 models are used for training for clustering.
        Permitted Values: "kmeans", "gaussianmixture"
        Types: str OR list of str  
    
    exclude:
        Optional Argument.
        Specifies the model algorithms to be excluded from model training phase.
        No model is excluded by default. 
        Permitted Values:  "kmeans", "gaussianmixture"
        Types: str OR list of str
            
    verbose:
        Optional Argument.
        Specifies the detailed execution steps based on verbose level.
        Default Value: 0
        Permitted Values: 
            * 0: prints the progress bar and leaderboard
            * 1: prints the execution steps of AutoML.
            * 2: prints the intermediate data between the execution of each step of AutoML.
        Types: int
        
    max_runtime_secs:
        Optional Argument.
        Specifies the time limit in seconds for model training.
        Types: int
        
    stopping_metric:
        Required, when "stopping_tolerance" is set, otherwise optional.
        Specifies the stopping metrics for stopping tolerance in model training.
        Permitted Values: "SILHOUETTE", "CALINSKI", "DAVIES"                         
        Types: str
 
    stopping_tolerance:
        Required, when "stopping_metric" is set, otherwise optional.
        Specifies the stopping tolerance for stopping metrics in model training.
        Types: float
    
    max_models:
        Optional Argument.
        Specifies the maximum number of models to be trained.
        Types: int
        
    custom_config_file:
        Optional Argument.
        Specifies the path of json file in case of custom run.
        Types: str
 
    skip_phases:
        Optional Argument.
        Specifies the phases to be skipped during the AutoML run.
        Types: str or list of str.
        permitted Values:
            * "Feature_Exploration"
            * "Feature_Engineering"
            * "Data_Preparation"
        Note:
            Enable AutoML Pipeline to Start from Any Step and Allow Skipping Major/Minor Stages
 
            +----------------------+--------------------------------------------------------------+
            | Major Steps          | Comments                                                     |
            +----------------------+--------------------------------------------------------------+
            | Feature Exploration  | Can be safely skipped. If skipped, statistical analysis      |
            |                      | for the provided dataset is not available.                   |
            +----------------------+--------------------------------------------------------------+
            | Feature Engineering  | If skipped, AutoML does not remove duplicates/redundant      |
            |                      | features, handle missing values, encode categorical          |
            |                      | features, or apply custom transforms. User must provide      |
            |                      | fully preprocessed numeric input during fit.                 |
            +----------------------+--------------------------------------------------------------+
            | Data Preparation     | If skipped, AutoML does not perform outlier handling,        |
            |                      | imbalance handling, scaling, or feature selection            |
            |                      | (RFE/LASSO/PCA). User must ensure training-ready features.   |
            +----------------------+--------------------------------------------------------------+
            | Model Training       | If skipped, models are not trained and only prepared data    |
            |                      | is generated. Use AutoDataPrep for such workflows.           |
            +----------------------+--------------------------------------------------------------+
            | Model Evaluation     | Cannot be skipped because it is required for leaderboard     |
            |                      | generation.                                                  |
            +----------------------+--------------------------------------------------------------+
            
    **kwargs:
        Specifies the additional arguments for AutoCluster. Below
        are the additional arguments:
            volatile:
                Optional Argument.
                Specifies whether to put the interim results of the
                functions in a volatile table or not. When set to
                True, results are stored in a volatile table,
                otherwise not.
                Default Value: False
                Types: bool
 
            persist:
                Optional Argument.
                Specifies whether to persist the interim results of the
                functions in a table or not. When set to True,
                results are persisted in a table; otherwise,
                results are garbage collected at the end of the
                session.
                Default Value: False
                Types: bool
 
            seed:
                Optional Argument.
                Specifies the random seed for reproducibility.
                Default Value: 42
                Types: int
 
            enable_lasso:
                Optional Argument.
                Specifies whether to use lasso regression for feature selection.
                By default, only RFE and PCA are used for feature selection.
                Default Value: False
                Types: bool
            
            enable_rfe:
                Optional Argument.
                Specifies whether to enable RFE for feature selection.
                Default Value: True
                Types: bool
            
            enable_pca:
                Optional Argument.
                Specifies whether to enable PCA for feature selection.
                Default Value: True
                Types: bool
            
            raise_errors:
                Optional Argument.
                Specifies whether to raise errors or warnings for
                non-blocking errors. When set to True, raises errors,
                otherwise raises warnings.
                Default Value: False
                Types: bool
        
RETURNS:
    Instance of AutoCluster.
 
RAISES:
    TeradataMlException, TypeError, ValueError
    
EXAMPLES:    
    # Notes:
    #     1. Get the connection to Vantage to execute the function.
    #     2. One must import the required functions mentioned in
    #        the example from teradataml.
    #     3. Function will raise error if not supported on the Vantage
    #        user is connected to.
 
    # Load the example data.
    >>> load_example_data("teradataml", ["bank_marketing", "Mall_customer_data"])
    
    # Create teradataml DataFrame object.
    >>> bank_df = DataFrame.from_table("bank_marketing")
    >>> mall_df = DataFrame.from_table("Mall_customer_data")
 
    # Example 1: Use AutoCluster for unsupervised clustering task based on bank data.
    # Scenario: Automatically group similar records in the dataset into clusters.
    
    # Split the data into train and test.
    >>> bank_sample = bank_df.sample(frac = [0.8, 0.2])
    >>> bank_train= bank_sample[bank_sample['sampleid'] == 1].drop('sampleid', axis=1)
    >>> bank_test = bank_sample[bank_sample['sampleid'] == 2].drop('sampleid', axis=1)
 
    # Create instance of AutoCluster.
    >>> automl_obj = AutoCluster()
 
    # Fit the data.
    >>> automl_obj.fit(bank_train)
    
    # Display leaderboard.
    >>> automl_obj.leaderboard()
 
    # Display best performing model.
    >>> automl_obj.leader()
    
    # Run predict on test data using best performing model.
    >>> prediction = automl_obj.predict(bank_test)
    >>> prediction
    
    # Run predict on test data using second best performing model.
    >>> prediction = automl_obj.predict(bank_test, rank=2)
    >>> prediction
 
    # Example 2: Use AutoCluster to segment Mall customer data.
    # Scenario: Automatically identify and group similar customers into clusters.
    
    # Split the data into train and test.
    >>> mall_sample = mall_df.sample(frac = [0.8, 0.2])
    >>> mall_train= mall_sample[mall_sample['sampleid'] == 1].drop('sampleid', axis=1)
    >>> mall_test = mall_sample[mall_sample['sampleid'] == 2].drop('sampleid', axis=1)
    
    # Generate custom configuration file.
    >>> AutoCluster.generate_custom_config("custom_mall_clustering")
    
    # Create instance of AutoCluster.
    >>> automl_obj = AutoCluster(verbose=2, 
    >>>                          custom_config_file="custom_mall_clustering.json")
 
    # Fit the data.
    >>> automl_obj.fit(mall_train)
 
    # Display leaderboard.
    >>> automl_obj.leaderboard()
 
    # Display best performing model.
    >>> automl_obj.leader()
 
    # Run predict on test data using best performing model.
    >>> prediction = automl_obj.predict(mall_test)
    >>> prediction
 
    # Run predict on test data using second best performing model.
    >>> prediction = automl_obj.predict(mall_test, rank=2)
    >>> prediction