- Train with valid_sets argument.
>>> opt_m = td_lightgbm.train(params={}, train_set=obj_m, num_boost_round=30, early_stopping_rounds=50, valid_sets=[obj_m_v, obj_m_v]) - Deploy distributed models.
>>> opt_m_deploy = opt_m.deploy(model_name="lightgbm_deploy_train_multi_model") >>> opt_m_deploy partition_column_1 partition_column_2
model \ 0 1 11 <lightgbm.basic.Booster object at 0x00..18... 1 0 11 <lightgbm.basic.Booster object at 0x00..18... 2 1 10 <lightgbm.basic.Booster object at 0x00..18... 3 0 10 <lightgbm.basic.Booster object at 0x00..18... console_output 0 [LightGBM] [Warning] Auto-choosing col-wise mu... 1 [LightGBM] [Warning] Auto-choosing col-wise mu... 2 [LightGBM] [Warning] Auto-choosing row-wise mu... 3 [LightGBM] [Warning] Auto-choosing col-wise mu... - Load the deployed distributed models.
>>> opt_m_load = td_lightgbm.load("lightgbm_deploy_train_multi_model") - Predict using loaded models.
>>> opt_m_load.predict(df_x_classif)
partition_column_1 partition_column_2 col1 col2 col3 col4 booster_predict_1 1 10 0.32696596570584 1.47330535418833 -0.20178393176355 0.74459119624978 1.023338334370605 1 10 -1.0004943664752 -0.5036412703804 -0.03420420369756 -0.6369398278106 0.139315093910313 1 10 0.52297759126479 1.06716836387948 -0.11293733853424 0.66245837528695 0.938397513812559 1 10 1.05259185573158 1.19821169185417 -0.07277200487147 0.94405839783240 0.921848136707542 1 10 0.31320927089271 1.40774148153391 -0.19271215342466 0.71179749886599 0.925780938479566 1 10 -0.8238860682069 2.14052731749492 -0.44397524257905 0.52288679440173 0.925780938479566 0 10 0.73106437158004 -1.7427860510320 0.368475460169321 -0.3997941143268 -0.01629951110533 0 10 1.77127535720407 0.47018240258731 0.129138419955093 0.95488182548344 0.640713746422475 0 10 -1.0974686702160 1.97082483622747 -0.44812380705639 0.33560750373566 1.003188524949226 0 10 -3.0355858113854 -1.6588988201468 -0.08249259860607 -1.9861478027571 0.066485139499413 - Create a multi model with record_evaluation callback.
>>> rec = {} - Train with valid_sets and callbacks argument.
>>> opt_m_r = td_lightgbm.train(params={}, train_set=obj_m, num_boost_round=30, callbacks=[td_lightgbm.record_evaluation(rec)], valid_sets=[obj_m_v, obj_m_v])>>> opt_m_r
partition_column_1 partition_column_2 \ 0 1 11 1 0 11 2 1 10 3 0 10 model \ 0 <lightgbm.basic.Booster object at 0x0000029D18... 1 <lightgbm.basic.Booster object at 0x0000029D18... 2 <lightgbm.basic.Booster object at 0x0000029D18... 3 <lightgbm.basic.Booster object at 0x0000029D18... console_output \ 0 [LightGBM] [Warning] Auto-choosing col-wise mu... 1 [LightGBM] [Warning] Auto-choosing col-wise mu... 2 [LightGBM] [Warning] Auto-choosing col-wise mu... 3 [LightGBM] [Warning] Auto-choosing row-wise mu... record_evaluation_result 0 {'valid_0': {'l2': [0.2196373768349857, 0.1965... 1 {'valid_0': {'l2': [0.22299048654779868, 0.200... 2 {'valid_0': {'l2': [0.21514138095238086, 0.191... 3 {'valid_0': {'l2': [0.2195184911242605, 0.1948... - Deploy trained distributed models.
>>> opt_m_r_deploy = opt_m_r.deploy("lightgbm_deploy_train_multi_model_with_record_eval") - Load the deployed models.
>>> opt_m_r_load = td_lightgbm.load("lightgbm_deploy_train_multi_model_with_record_eval") - Predict using loaded models.
>>> opt_m_r_load.predict(df_x_classif, label=df_y_classif)
partition_column_1 partition_column_2 col1 col2 col3 col4 label booster_predict_1 1 10 1.05259185573158 1.19821169185417 -0.0727720048714 0.944058397832 1 0.921848136707542 1 10 -1.0004943664752 -0.5036412703804 -0.0342042036975 -0.63693982781 0 0.139315093910313 1 10 0.52297759126479 1.06716836387948 -0.1129373385342 0.662458375286 1 0.938397513812559 1 10 -0.5066609936524 2.31850732028455 -0.4361066493234 0.732337775994 1 1.023338334370605 1 10 -1.5819640423908 -0.9365785479499 -0.0312640459629 -1.06459785797 0 0.078450464059613 1 10 -0.8238860682069 2.14052731749492 -0.4439752425790 0.522886794401 1 0.925780938479566 0 10 1.09867539212952 -0.7489871189513 0.24943881268310 0.165738276697 0 0.142214969318460 0 10 1.77127535720407 0.47018240258731 0.12913841995509 0.954881825483 1 0.640713746422523 0 10 -1.0257898611087 -0.2476906693605 -0.0787909605284 -0.54291097851 1 0.380117443587507 0 10 -1.2011699609085 -1.3113290698053 0.07392888868973 -1.05435592604 0 0.001931702920989