Time Based Early Stopping for Non-Model Trainer | GridSearch | teradataml - Example 5.2: Time Based Early Stopping for Non-Model Trainer Function - 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

This example shows time based early stopping for non-model trainer function Antiselect.

  1. Define hyperparameter tuning for Antiselect.
    1. Define the non-model trainer function parameter space.
      >>> non_model_trainer_params = {"data":data, "exclude":(
                                      ['petal_length', 'petal_width'], 
                                      ['sepal_length', 'sepal_width', 'petal_length'],
                                      ['id', 'sepal_length', 'sepal_width'],
                                      ['petal_width'], 
                                      ['petal_width', 'species'],
                                      ['sepal_width', 'petal_length', 'petal_width', 'species'],
                                      ['sepal_width', 'petal_length', 'petal_width', 'species', 'id'],
                                      ['sepal_length', 'sepal_width',])
                                     }
    2. Import non-model trainer function and optimizer.
      >>> from teradataml import Antiselect, GridSearch
    3. Initialize the GridSearch optimizer with non-model trainer function and parameter space required for non-model training.
      >>> as_obj = GridSearch(func=Antiselect, params=non_model_trainer_params)
  2. Run Antiselect with max_time set to 5 seconds.
    >>> as_obj.fit(max_time=5, verbose=1)
    Computing: |⫿⫿⫿⫿⫿⫿⫿⫿⫿⫿⫿⫿⫿⫿⫿⫿⫿⫿⫿⫿⫿⫿⫿⫿⫿⫿⫿⫿⫿⫿⫾⫾⫾⫾⫾⫾⫾⫾⫾⫾⫾⫾⫾⫾⫾⫾⫾⫾⫾⫾⫾⫾⫾⫾⫾⫾⫾⫾⫾⫾| 50% - 4/8
  3. View the result of hyperparameter tunning using models property.
    >>> as_obj.models
        MODEL_ID                                             PARAMETERS      STATUS
    0    ANTISELECT_3    {'data': '"AUTOML_USER"."ml__td_sqlmr_out__170...    PASS
    1    ANTISELECT_4    {'data': '"AUTOML_USER"."ml__td_sqlmr_out__170...    SKIP
    2    ANTISELECT_5    {'data': '"AUTOML_USER"."ml__td_sqlmr_out__170...    SKIP
    3    ANTISELECT_6    {'data': '"AUTOML_USER"."ml__td_sqlmr_out__170...    SKIP
    4    ANTISELECT_7    {'data': '"AUTOML_USER"."ml__td_sqlmr_out__170...    SKIP
    5    ANTISELECT_0    {'data': '"AUTOML_USER"."ml__td_sqlmr_out__170...    PASS
    6    ANTISELECT_2    {'data': '"AUTOML_USER"."ml__td_sqlmr_out__170...    PASS
    7    ANTISELECT_1    {'data': '"AUTOML_USER"."ml__td_sqlmr_out__170...    PASS