Example: Single model deployment and loading of td_lightgbm sklearn model trained in Vantage - Teradata Package for Python

Teradata® Package for Python User Guide

Deployment
VantageCloud
VantageCore
Edition
VMware
Enterprise
IntelliFlex
Product
Teradata Package for Python
Release Number
20.00
Published
March 2025
ft:locale
en-US
ft:lastEdition
2025-08-04
dita:mapPath
nvi1706202040305.ditamap
dita:ditavalPath
plt1683835213376.ditaval
dita:id
rkb1531260709148
Product Category
Teradata Vantage
  1. Create an object of LGBMModel using 'td_lightgbm'.
    >>> obj_skl_s = td_lightgbm.LGBMModel(num_leaves=15, objective="binary", n_estimators=10)
  2. Train the model.
    >>> obj_skl_s.fit(df_x_classif, df_y_classif, callbacks=[td_lightgbm.log_evaluation()])
  3. Deploy the model.
    >>> obj_skl_deploy_s = obj_skl_s.deploy(model_name="lightgbm_sklearn_single_model")
    
    Model is saved.
  4. Load the trained model.
    >>> obj_skl_load_model_s = td_lightgbm.load("lightgbm_sklearn_single_model")
  5. Predict using the loaded model.
    >>> obj_skl_load_model_s.predict(df_x_classif, pred_leaf=True)
    
    			col1  			col2  			col3			col4 lgbmmodel_predict_1 lgbmmodel_predict_2  ... lgbmmodel_predict_10
    0.19124073041977  1.971001330153  -0.29853017845  0.890194110648  				   8   				  13  ...  			        13
    -1.1699913889726  0.354732459083  -0.19356318494  -0.35802804454  				   3   				   1  ...  			    	 1
    -0.8449702490257  1.453101117091  -0.33456086466  0.232041220971  				   8   				  13  ... 			        13
    1.61885814289279  0.530672471352  0.101599080962  0.914093399898  				   7   				   7  ... 			    	 7
    -1.0093122519523  1.498390036418  -0.36101107471  0.179890827548  				   8   				  12  ... 			        12
    1.49413777147502  0.172801814430  0.145353695535  0.713738112186  				   2   				   2  ... 			    	 2
    -0.8103072656328  -0.95301356540  0.061001667799  -0.73930084696  				   4   				   4  ... 			    	 4
    -0.8156136865920  -1.23797225905  0.106755845337  -0.85838759227  				   2   				   9  ... 			    	 3
    -1.0993936064538  0.871762881447  -0.26950104137  -0.11572200547  				   4   				   8  ... 			    	 8
    -1.2173132357157  -0.75099738722  -0.01912607171  5	-0.831624374  				   7   				   4  ... 			    	 4