- Import the lightgbm module and create a Booster object.
>>> from lightgbm import Dataset, train >>> pdf_dataset = Dataset(params={},data=pdf_x, label=pdf_y) >>> pdf_dataset <lightgbm.basic.Dataset at 0x29d...a0> >>> local_train = train(train_set=pdf_dataset, params={}) >>> local_train [LightGBM] [Warning] Auto-choosing col-wise multi-threading, the overhead of testing was 0.000096 seconds. You can set `force_col_wise=true` to remove the overhead. [LightGBM] [Info] Total Bins 532 [LightGBM] [Info] Number of data points in the train set: 400, number of used features: 4 [LightGBM] [Info] Start training from score 0.507500 [LightGBM] [Warning] No further splits with positive gain, best gain: -inf [LightGBM] [Warning] No further splits with positive gain, best gain: -inf ... [LightGBM] [Warning] No further splits with positive gain, best gain: -inf <lightgbm.basic.Booster at 0x29d19f446d0> >>> type(local_train) lightgbm.basic.Booster - Deploy the trained lightgbm Booster model in Vantage.
>>> opt_outside = td_lightgbm.deploy(model_name="model_trained_outside_vantage_using_train", model=local_train)
Model is saved.
>>> type(opt_outside) teradataml.opensource._lightgbm._LightgbmBoosterWrapper
- Load the deployed model.
>>> opt_load_outside = td_lightgbm.load("model_trained_outside_vantage_using_train")>>> type(opt_load_outside) teradataml.opensource._lightgbm._LightgbmBoosterWrapper
- Predict on data residing in Vantagee using the loaded model.
>>> opt_load_outside.predict(data=df_x_classif, label=df_y_classif, pred_contrib=True)
col1 col2 col3 col4 label booster_predict_1 ... booster_predict_5 0.19124073041977 1.971001330153 -0.29853017845 0.890194110648 1 0.031404602776514 ... 0.2040997952197996 -1.1699913889726 0.354732459083 -0.19356318494 -0.35802804454 1 0.092682932810633 ... 0.2532883087965086 -0.8449702490257 1.453101117091 -0.33456086466 0.232041220971 1 0.046136151499138 ... 0.2164065785284724 1.61885814289279 0.530672471352 0.101599080962 0.914093399898 0 -0.10520322255265 ... 0.1027900245523291 -1.0093122519523 1.498390036418 -0.36101107471 0.179890827548 1 0.062801639713840 ... 0.2107812341392544 1.49413777147502 0.172801814430 0.145353695535 0.713738112186 0 -0.16550849715057 ... 0.1549907235100593 -0.8103072656328 -0.95301356540 0.061001667799 -0.73930084696 0 -0.00069855457829 ... -0.171764014056180 -0.8156136865920 -1.23797225905 0.106755845337 -0.85838759227 0 0.001558571995085 ... -0.195691235260052 -1.0993936064538 0.871762881447 -0.26950104137 -0.11572200547 1 0.065010292043574 ... 0.2115849205082161 -1.2173132357157 -0.75099738722 -0.01912607171 -0.83162437457 0 0.021267893372609 ... -0.244580217753899