This example shows time based early stopping for non-model trainer function Antiselect.
- Define hyperparameter tuning for Antiselect.
- 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'])}
- Import non-model trainer function and optimizer.
>>> from teradataml import Antiselect, RandomSearch
- Initialize the GridSearch optimizer with non-model trainer function and parameter space required for non-model training.
>>> rs_obj = RandomSearch(func=Antiselect, params=non_model_trainer_params, n_iter=5)
- Define the non-model trainer function parameter space.
- Run Antiselect with max_time set to 4 seconds.
>>> rs_obj.fit(max_time=4, verbose=2)
Model_id:ANTISELECT_3 - Run time:4.588s - Status:PASS Model_id:ANTISELECT_2 - Run time:4.619s - Status:PASS Model_id:ANTISELECT_0 - Run time:4.621s - Status:PASS Model_id:ANTISELECT_1 - Run time:4.621s - Status:PASS Computing: |⫿⫿⫿⫿⫿⫿⫿⫿⫿⫿⫿⫿⫿⫿⫿⫿⫿⫿⫿⫿⫿⫿⫿⫿⫿⫿⫿⫿⫿⫿⫿⫿⫿⫿⫿⫿⫿⫿⫿⫿⫿⫿⫿⫿⫿⫿⫿⫿⫾⫾⫾⫾⫾⫾⫾⫾⫾⫾⫾⫾| 80% - 4/5
- View the result of hyperparameter tunning using models property.
>>> rs_obj.models
MODEL_ID PARAMETERS STATUS 0 ANTISELECT_3 {'data': '"ALICE"."ml__td_sqlmr_out__171014558... PASS 1 ANTISELECT_4 {'data': '"ALICE"."ml__td_sqlmr_out__171014558... SKIP 2 ANTISELECT_2 {'data': '"ALICE"."ml__td_sqlmr_out__171014558... PASS 3 ANTISELECT_0 {'data': '"ALICE"."ml__td_sqlmr_out__171014558... PASS 4 ANTISELECT_1 {'data': '"ALICE"."ml__td_sqlmr_out__171014558... PASS